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( currentSession.pushersService().testPush(
unifiedPushHelper.getPushGateway()!!, unifiedPushHelper.getPushGateway()!!,
stringProvider.getString(R.string.pusher_app_id), stringProvider.getString(R.string.pusher_app_id),
unifiedPushHelper.getEndpointOrToken() ?: "", unifiedPushHelper.getEndpointOrToken().orEmpty(),
TEST_EVENT_ID TEST_EVENT_ID
) )
} }

View File

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

View File

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