Skip to content

Commit 7785aaf

Browse files
jennantillajinliu9508
authored andcommitted
Update core module property naming
address linting error that enforces camel case/screaming snake case & disallows backticks
1 parent 13f4244 commit 7785aaf

File tree

30 files changed

+372
-373
lines changed

30 files changed

+372
-373
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/IOneSignal.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,38 @@ interface IOneSignal {
2323
* The user manager for accessing user-scoped
2424
* management.
2525
*/
26-
val User: IUserManager
26+
val user: IUserManager
2727

2828
/**
2929
* The session manager for accessing session-scoped management.
3030
*/
31-
val Session: ISessionManager
31+
val session: ISessionManager
3232

3333
/**
3434
* The notification manager for accessing device-scoped
3535
* notification management.
3636
*/
37-
val Notifications: INotificationsManager
37+
val notifications: INotificationsManager
3838

3939
/**
4040
* The location manager for accessing device-scoped
4141
* location management.
4242
*/
43-
val Location: ILocationManager
43+
val location: ILocationManager
4444

4545
/**
4646
* The In App Messaging manager for accessing device-scoped
4747
* IAP management.
4848
*/
49-
val InAppMessages: IInAppMessagesManager
49+
val inAppMessages: IInAppMessagesManager
5050

5151
/**
5252
* Access to debug the SDK in the event additional information is required to diagnose any
5353
* SDK-related issues.
5454
*
5555
* WARNING: This should not be used in a production setting.
5656
*/
57-
val Debug: IDebugManager
57+
val debug: IDebugManager
5858

5959
/**
6060
* Determines whether a user must consent to privacy prior
@@ -90,7 +90,7 @@ interface IOneSignal {
9090

9191
/**
9292
* Login to OneSignal under the user identified by the [externalId] provided. The act of
93-
* logging a user into the OneSignal SDK will switch the [User] context to that specific user.
93+
* logging a user into the OneSignal SDK will switch the [user] context to that specific user.
9494
*
9595
* * If the [externalId] exists the user will be retrieved and the context set from that
9696
* user information. If operations have already been performed under a guest user, they
@@ -117,7 +117,7 @@ interface IOneSignal {
117117
fun login(externalId: String) = login(externalId, null)
118118

119119
/**
120-
* Logout the user previously logged in via [login]. The [User] property now references
120+
* Logout the user previously logged in via [login]. The [user] property now references
121121
* a new device-scoped user. A device-scoped user has no user identity that can later
122122
* be retrieved, except through this device as long as the app remains installed and the app
123123
* data is not cleared.

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/OneSignal.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,39 @@ object OneSignal {
4343
*/
4444
@JvmStatic
4545
val User: IUserManager
46-
get() = oneSignal.User
46+
get() = oneSignal.user
4747

4848
/**
4949
* The session manager for accessing session-scoped management. Initialized only after [initWithContext]
5050
* has been called.
5151
*/
5252
@JvmStatic
5353
val Session: ISessionManager
54-
get() = oneSignal.Session
54+
get() = oneSignal.session
5555

5656
/**
5757
* The notification manager for accessing device-scoped notification management. Initialized
5858
* only after [initWithContext] has been called.
5959
*/
6060
@JvmStatic
6161
val Notifications: INotificationsManager
62-
get() = oneSignal.Notifications
62+
get() = oneSignal.notifications
6363

6464
/**
6565
* The location manager for accessing device-scoped location management. Initialized
6666
* only after [initWithContext] has been called.
6767
*/
6868
@JvmStatic
6969
val Location: ILocationManager
70-
get() = oneSignal.Location
70+
get() = oneSignal.location
7171

7272
/**
7373
* The In App Messaging manager for accessing device-scoped IAP management. Initialized
7474
* only after [initWithContext] has been called.
7575
*/
7676
@JvmStatic
7777
val InAppMessages: IInAppMessagesManager
78-
get() = oneSignal.InAppMessages
78+
get() = oneSignal.inAppMessages
7979

8080
/**
8181
* Access to debug the SDK in the additional information is required to diagnose any
@@ -85,7 +85,7 @@ object OneSignal {
8585
*/
8686
@JvmStatic
8787
val Debug: IDebugManager
88-
get() = oneSignal.Debug
88+
get() = oneSignal.debug
8989

9090
/**
9191
* Determines whether a user must consent to privacy prior

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/NetworkUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object NetworkUtils {
99
CONFLICT,
1010
}
1111

12-
var MAX_NETWORK_REQUEST_ATTEMPT_COUNT = 3
12+
var maxNetworkRequestAttemptCount = 3
1313

1414
fun getResponseStatusType(statusCode: Int): ResponseStatusType {
1515
return when (statusCode) {

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/OneSignalUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object OneSignalUtils {
66
/**
77
* The version of this SDK.
88
*/
9-
const val sdkVersion: String = "050003"
9+
const val SDK_VERSION: String = "050003"
1010

1111
fun isValidEmail(email: String): Boolean {
1212
if (email.isEmpty()) {

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/events/CallbackProducer.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import kotlinx.coroutines.withContext
99
* make callbacks less burdensome to the user.
1010
*/
1111
open class CallbackProducer<THandler>() : ICallbackNotifier<THandler> {
12-
private var _callback: THandler? = null
12+
private var callback: THandler? = null
1313

1414
override val hasCallback: Boolean
15-
get() = _callback != null
15+
get() = callback != null
1616

1717
override fun set(handler: THandler?) {
18-
_callback = handler
18+
callback = handler
1919
}
2020

2121
/**
@@ -26,8 +26,8 @@ open class CallbackProducer<THandler>() : ICallbackNotifier<THandler> {
2626
* @param callback The callback will be invoked if one exists, allowing you to call the handler.
2727
*/
2828
fun fire(callback: (THandler) -> Unit) {
29-
if (_callback != null) {
30-
callback(_callback!!)
29+
if (this.callback != null) {
30+
callback(this.callback!!)
3131
}
3232
}
3333

@@ -42,8 +42,8 @@ open class CallbackProducer<THandler>() : ICallbackNotifier<THandler> {
4242
*/
4343
fun fireOnMain(callback: (THandler) -> Unit) {
4444
suspendifyOnMain {
45-
if (_callback != null) {
46-
callback(_callback!!)
45+
if (this.callback != null) {
46+
callback(this.callback!!)
4747
}
4848
}
4949
}
@@ -56,8 +56,8 @@ open class CallbackProducer<THandler>() : ICallbackNotifier<THandler> {
5656
* @param callback The callback will be invoked if one exists, allowing you to call the handler.
5757
*/
5858
suspend fun suspendingFire(callback: suspend (THandler) -> Unit) {
59-
if (_callback != null) {
60-
callback(_callback!!)
59+
if (this.callback != null) {
60+
callback(this.callback!!)
6161
}
6262
}
6363

@@ -70,9 +70,9 @@ open class CallbackProducer<THandler>() : ICallbackNotifier<THandler> {
7070
* @param callback The callback will be invoked if one exists, allowing you to call the handler.
7171
*/
7272
suspend fun suspendingFireOnMain(callback: suspend (THandler) -> Unit) {
73-
if (_callback != null) {
73+
if (this.callback != null) {
7474
withContext(Dispatchers.Main) {
75-
callback(_callback!!)
75+
callback(this@CallbackProducer.callback!!)
7676
}
7777
}
7878
}

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/events/EventProducer.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ import java.util.Collections
1111
*/
1212
open class EventProducer<THandler> : IEventNotifier<THandler> {
1313
override val hasSubscribers: Boolean
14-
get() = _subscribers.any()
14+
get() = subscribers.any()
1515

16-
private val _subscribers: MutableList<THandler> = Collections.synchronizedList(mutableListOf())
16+
private val subscribers: MutableList<THandler> = Collections.synchronizedList(mutableListOf())
1717

1818
override fun subscribe(handler: THandler) {
19-
_subscribers.add(handler)
19+
subscribers.add(handler)
2020
}
2121

2222
override fun unsubscribe(handler: THandler) {
23-
_subscribers.remove(handler)
23+
subscribers.remove(handler)
2424
}
2525

2626
/**
2727
* Subscribe all from an existing producer to this subscriber.
2828
*/
2929
fun subscribeAll(from: EventProducer<THandler>) {
30-
for (s in from._subscribers) {
30+
for (s in from.subscribers) {
3131
subscribe(s)
3232
}
3333
}
@@ -39,7 +39,7 @@ open class EventProducer<THandler> : IEventNotifier<THandler> {
3939
* @param callback The callback will be invoked for each subscribed handler, allowing you to call the handler.
4040
*/
4141
fun fire(callback: (THandler) -> Unit) {
42-
for (s in _subscribers) {
42+
for (s in subscribers) {
4343
callback(s)
4444
}
4545
}
@@ -53,7 +53,7 @@ open class EventProducer<THandler> : IEventNotifier<THandler> {
5353
*/
5454
fun fireOnMain(callback: (THandler) -> Unit) {
5555
suspendifyOnMain {
56-
for (s in _subscribers) {
56+
for (s in subscribers) {
5757
callback(s)
5858
}
5959
}
@@ -66,7 +66,7 @@ open class EventProducer<THandler> : IEventNotifier<THandler> {
6666
* @param callback The callback will be invoked for each subscribed handler, allowing you to call the handler.
6767
*/
6868
suspend fun suspendingFire(callback: suspend (THandler) -> Unit) {
69-
for (s in _subscribers) {
69+
for (s in subscribers) {
7070
callback(s)
7171
}
7272
}
@@ -79,7 +79,7 @@ open class EventProducer<THandler> : IEventNotifier<THandler> {
7979
*/
8080
suspend fun suspendingFireOnMain(callback: suspend (THandler) -> Unit) {
8181
withContext(Dispatchers.Main) {
82-
for (s in _subscribers) {
82+
for (s in subscribers) {
8383
callback(s)
8484
}
8585
}

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/modeling/Model.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ open class Model(
6262
}
6363

6464
protected val data: MutableMap<String, Any?> = Collections.synchronizedMap(mutableMapOf())
65-
private val _changeNotifier = EventProducer<IModelChangedHandler>()
65+
private val changeNotifier = EventProducer<IModelChangedHandler>()
6666

6767
init {
6868
if (_parentModel != null && _parentProperty == null) {
@@ -644,7 +644,7 @@ open class Model(
644644
) {
645645
// if there are any changed listeners for this specific model, notify them.
646646
val changeArgs = ModelChangedArgs(this, path, property, oldValue, newValue)
647-
_changeNotifier.fire { it.onChanged(changeArgs, tag) }
647+
changeNotifier.fire { it.onChanged(changeArgs, tag) }
648648

649649
// if there is a parent model, propagate the change up to the parent for it's own processing.
650650
if (_parentModel != null) {
@@ -684,10 +684,10 @@ open class Model(
684684
return jsonObject
685685
}
686686

687-
override fun subscribe(handler: IModelChangedHandler) = _changeNotifier.subscribe(handler)
687+
override fun subscribe(handler: IModelChangedHandler) = changeNotifier.subscribe(handler)
688688

689-
override fun unsubscribe(handler: IModelChangedHandler) = _changeNotifier.unsubscribe(handler)
689+
override fun unsubscribe(handler: IModelChangedHandler) = changeNotifier.unsubscribe(handler)
690690

691691
override val hasSubscribers: Boolean
692-
get() = _changeNotifier.hasSubscribers
692+
get() = changeNotifier.hasSubscribers
693693
}

0 commit comments

Comments
 (0)