Use `.orEmpty()` instead of `?: ""`

This commit is contained in:
Benoit Marty 2022-06-01 16:01:11 +02:00 committed by Benoit Marty
parent 5e10449746
commit f1e57d2970
3 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class PushersManager @Inject constructor(
currentSession.pushersService().testPush(
unifiedPushHelper.getPushGateway()!!,
stringProvider.getString(R.string.pusher_app_id),
unifiedPushHelper.getEndpointOrToken() ?: "",
unifiedPushHelper.getEndpointOrToken().orEmpty(),
TEST_EVENT_ID
)
}

View File

@ -191,7 +191,7 @@ class UnifiedPushHelper @Inject constructor(
vectorPreferences?.setFdroidSyncBackgroundMode(mode)
runBlocking {
try {
pushersManager?.unregisterPusher(getEndpointOrToken() ?: "")
pushersManager?.unregisterPusher(getEndpointOrToken().orEmpty())
} catch (e: Exception) {
Timber.d("Probably unregistering a non existant pusher")
}

View File

@ -192,7 +192,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
guardServiceStarter.start()
runBlocking {
try {
pushersManager.unregisterPusher(unifiedPushHelper.getEndpointOrToken() ?: "")
pushersManager.unregisterPusher(unifiedPushHelper.getEndpointOrToken().orEmpty())
} catch (e: Exception) {
Timber.tag(loggerTag.value).d("Probably unregistering a non existant pusher")
}