fix klint + findbugs warnings

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
drone 2022-01-26 17:02:13 +00:00 committed by Marcel Hibbe
parent 70b4eed654
commit ca7861358d
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
4 changed files with 32 additions and 19 deletions

View file

@ -42,22 +42,27 @@ class GetFirebasePushTokenWorker(val context: Context, workerParameters: WorkerP
@SuppressLint("LongLogTag")
override fun doWork(): Result {
FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
Log.w(TAG, "Fetching FCM registration token failed", task.exception)
return@OnCompleteListener
FirebaseMessaging.getInstance().token.addOnCompleteListener(
OnCompleteListener { task ->
if (!task.isSuccessful) {
Log.w(TAG, "Fetching FCM registration token failed", task.exception)
return@OnCompleteListener
}
val token = task.result
appPreferences?.pushToken = token
val data: Data =
Data.Builder()
.putString(PushRegistrationWorker.ORIGIN, "GetFirebasePushTokenWorker")
.build()
val pushRegistrationWork = OneTimeWorkRequest.Builder(PushRegistrationWorker::class.java)
.setInputData(data)
.build()
WorkManager.getInstance(context).enqueue(pushRegistrationWork)
}
val token = task.result
appPreferences?.pushToken = token
val data: Data = Data.Builder().putString(PushRegistrationWorker.ORIGIN, "GetFirebasePushTokenWorker").build()
val pushRegistrationWork = OneTimeWorkRequest.Builder(PushRegistrationWorker::class.java)
.setInputData(data)
.build()
WorkManager.getInstance(context).enqueue(pushRegistrationWork)
})
)
return Result.success()
}

View file

@ -75,7 +75,11 @@ class ClosedInterfaceImpl : ClosedInterface, ProviderInstaller.ProviderInstallLi
}
private fun registerLocalToken() {
val data: Data = Data.Builder().putString(PushRegistrationWorker.ORIGIN, "ClosedInterfaceImpl#registerLocalToken").build()
val data: Data = Data.Builder().putString(
PushRegistrationWorker.ORIGIN,
"ClosedInterfaceImpl#registerLocalToken"
)
.build()
val pushRegistrationWork = OneTimeWorkRequest.Builder(PushRegistrationWorker::class.java)
.setInputData(data)
.build()
@ -83,7 +87,11 @@ class ClosedInterfaceImpl : ClosedInterface, ProviderInstaller.ProviderInstallLi
}
private fun setUpPeriodicLocalTokenRegistration() {
val data: Data = Data.Builder().putString(PushRegistrationWorker.ORIGIN, "ClosedInterfaceImpl#setUpPeriodicLocalTokenRegistration").build()
val data: Data = Data.Builder().putString(
PushRegistrationWorker.ORIGIN,
"ClosedInterfaceImpl#setUpPeriodicLocalTokenRegistration"
)
.build()
val periodicTokenRegistration = PeriodicWorkRequest.Builder(
PushRegistrationWorker::class.java,

View file

@ -1 +1 @@
558
554

View file

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 1 error and 224 warnings</span>
<span class="mdl-layout-title">Lint Report: 1 error and 222 warnings</span>