Skip to content

Commit c5ed180

Browse files
jennantillajinliu9508
authored andcommitted
Merge pull request #1882 from OneSignal/fix/linting
Fix linting errors in GitHub Actions build test workflow
2 parents 5e5abe3 + ee12575 commit c5ed180

File tree

346 files changed

+8123
-4916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+8123
-4916
lines changed

OneSignalSDK/onesignal/core/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ dependencies {
9393

9494
ktlint {
9595
version = "$ktlintVersion"
96+
additionalEditorconfig = [
97+
"max_line_length": "500",
98+
]
9699
}
97100

98101
apply from: '../maven-push.gradle'

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ import kotlin.coroutines.CoroutineContext
1111
* The result provided by [Continue.with] when the Java user wants to inspect the results
1212
* of a Kotlin coroutine completing.
1313
*/
14-
class ContinueResult<R> (
14+
class ContinueResult<R>(
1515
/**
1616
* Whether the coroutine call was successful (`true`) or not (`false`)
1717
*/
1818
val isSuccess: Boolean,
19-
2019
/**
2120
* The data that is returned by the coroutine when complete. This will be `null` if [isSuccess]
2221
* is `false`.
2322
*/
2423
val data: R?,
25-
2624
/**
2725
* The throwable that was thrown by the coroutine. This will be `null` if [isSuccess] is `true`.
2826
*/
@@ -47,7 +45,6 @@ class ContinueResult<R> (
4745
* ```
4846
*/
4947
object Continue {
50-
5148
/**
5249
* Allows java code to provide a lambda as a continuation to a Kotlin coroutine.
5350
*
@@ -62,7 +59,10 @@ object Continue {
6259
@RequiresApi(Build.VERSION_CODES.N)
6360
@JvmOverloads
6461
@JvmStatic
65-
fun <R> with(onFinished: Consumer<ContinueResult<R>>, context: CoroutineContext = Dispatchers.Main): Continuation<R> {
62+
fun <R> with(
63+
onFinished: Consumer<ContinueResult<R>>,
64+
context: CoroutineContext = Dispatchers.Main,
65+
): Continuation<R> {
6666
return object : Continuation<R> {
6767
override val context: CoroutineContext
6868
get() = context

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

Lines changed: 17 additions & 10 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
@@ -83,11 +83,14 @@ interface IOneSignal {
8383
*
8484
* @return true if the SDK could be successfully initialized, false otherwise.
8585
*/
86-
fun initWithContext(context: Context, appId: String?): Boolean
86+
fun initWithContext(
87+
context: Context,
88+
appId: String?,
89+
): Boolean
8790

8891
/**
8992
* Login to OneSignal under the user identified by the [externalId] provided. The act of
90-
* 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.
9194
*
9295
* * If the [externalId] exists the user will be retrieved and the context set from that
9396
* user information. If operations have already been performed under a guest user, they
@@ -106,11 +109,15 @@ interface IOneSignal {
106109
* trust for the login operation. Required when identity verification has been enabled. See
107110
* [Identity Verification | OneSignal](https://documentation.onesignal.com/docs/identity-verification)
108111
*/
109-
fun login(externalId: String, jwtBearerToken: String? = null)
112+
fun login(
113+
externalId: String,
114+
jwtBearerToken: String? = null,
115+
)
116+
110117
fun login(externalId: String) = login(externalId, null)
111118

112119
/**
113-
* 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
114121
* a new device-scoped user. A device-scoped user has no user identity that can later
115122
* be retrieved, except through this device as long as the app remains installed and the app
116123
* data is not cleared.

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

Lines changed: 23 additions & 11 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
@@ -96,7 +96,9 @@ object OneSignal {
9696
@JvmStatic
9797
var consentRequired: Boolean
9898
get() = oneSignal.consentRequired
99-
set(value) { oneSignal.consentRequired = value }
99+
set(value) {
100+
oneSignal.consentRequired = value
101+
}
100102

101103
/**
102104
* Indicates whether privacy consent has been granted. This field is only relevant when
@@ -105,15 +107,19 @@ object OneSignal {
105107
@JvmStatic
106108
var consentGiven: Boolean
107109
get() = oneSignal.consentGiven
108-
set(value) { oneSignal.consentGiven = value }
110+
set(value) {
111+
oneSignal.consentGiven = value
112+
}
109113

110114
/**
111115
* Whether to disable the "GMS is missing" prompt to the user.
112116
*/
113117
@JvmStatic
114118
var disableGMSMissingPrompt: Boolean
115119
get() = oneSignal.disableGMSMissingPrompt
116-
set(value) { oneSignal.disableGMSMissingPrompt = value }
120+
set(value) {
121+
oneSignal.disableGMSMissingPrompt = value
122+
}
117123

118124
/**
119125
* Initialize the OneSignal SDK. This should be called during startup of the application.
@@ -122,7 +128,10 @@ object OneSignal {
122128
* @param appId The application ID the OneSignal SDK is bound to.
123129
*/
124130
@JvmStatic
125-
fun initWithContext(context: Context, appId: String) {
131+
fun initWithContext(
132+
context: Context,
133+
appId: String,
134+
) {
126135
oneSignal.initWithContext(context, appId)
127136
}
128137

@@ -169,7 +178,10 @@ object OneSignal {
169178
* [Identity Verification | OneSignal](https://documentation.onesignal.com/docs/identity-verification)
170179
*/
171180
@JvmStatic
172-
fun login(externalId: String, jwtBearerToken: String? = null) = oneSignal.login(externalId, jwtBearerToken)
181+
fun login(
182+
externalId: String,
183+
jwtBearerToken: String? = null,
184+
) = oneSignal.login(externalId, jwtBearerToken)
173185

174186
/**
175187
* Logout the user previously logged in via [login]. The [User] property now references

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ import android.util.Log
3939
// Designed as a compat for use of Android Support v4 revision 23.+ methods when an older revision of the library is included with the app developer's project.
4040
class AndroidSupportV4Compat {
4141
object ContextCompat {
42-
fun checkSelfPermission(context: Context, permission: String): Int {
42+
fun checkSelfPermission(
43+
context: Context,
44+
permission: String,
45+
): Int {
4346
// Catch for rare "Unknown exception code: 1 msg null" exception
4447
// See https://github.com/one-signal/OneSignal-Android-SDK/issues/48 for more details.
4548
return try {
@@ -50,7 +53,10 @@ class AndroidSupportV4Compat {
5053
}
5154
}
5255

53-
fun getColor(context: Context, id: Int): Int {
56+
fun getColor(
57+
context: Context,
58+
id: Int,
59+
): Int {
5460
return if (Build.VERSION.SDK_INT > 22) {
5561
context.getColor(id)
5662
} else {
@@ -66,7 +72,11 @@ class AndroidSupportV4Compat {
6672
}
6773

6874
internal object ActivityCompat {
69-
fun requestPermissions(activity: Activity, permissions: Array<String?>, requestCode: Int) {
75+
fun requestPermissions(
76+
activity: Activity,
77+
permissions: Array<String?>,
78+
requestCode: Int,
79+
) {
7080
// OneSignal SDK code already checks that device is Android M, omit else code from the support library.
7181
ActivityCompatApi23.requestPermissions(activity, permissions, requestCode)
7282
}
@@ -81,7 +91,11 @@ class AndroidSupportV4Compat {
8191

8292
@TargetApi(23)
8393
internal object ActivityCompatApi23 {
84-
fun requestPermissions(activity: Activity, permissions: Array<String?>?, requestCode: Int) {
94+
fun requestPermissions(
95+
activity: Activity,
96+
permissions: Array<String?>?,
97+
requestCode: Int,
98+
) {
8599
if (activity is RequestPermissionsRequestCodeValidator) {
86100
(activity as RequestPermissionsRequestCodeValidator).validateRequestPermissionsRequestCode(
87101
requestCode,

0 commit comments

Comments
 (0)