From 87087197e522ba8215d31e1257bba3db08a5b276 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 2 Jun 2022 15:25:54 +0200 Subject: [PATCH] shorter code --- .../im/vector/app/core/pushers/UnifiedPushHelper.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt b/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt index 88646a778d..1fd7fcaac5 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/UnifiedPushHelper.kt @@ -236,14 +236,11 @@ class UnifiedPushHelper @Inject constructor( } fun getCurrentDistributorName(): String { - if (isEmbeddedDistributor()) { - return stringProvider.getString(R.string.unifiedpush_distributor_fcm_fallback) + return when { + isEmbeddedDistributor() -> stringProvider.getString(R.string.unifiedpush_distributor_fcm_fallback) + isBackgroundSync() -> stringProvider.getString(R.string.unifiedpush_distributor_background_sync) + else -> context.getApplicationLabel(up.getDistributor(context)) } - if (isBackgroundSync()) { - return stringProvider.getString(R.string.unifiedpush_distributor_background_sync) - } - val distributor = up.getDistributor(context) - return context.getApplicationLabel(distributor) } fun isEmbeddedDistributor(): Boolean {