From 1069f77bd5735e7b9c768bbef67336f0053e756a Mon Sep 17 00:00:00 2001 From: sim Date: Mon, 28 Feb 2022 20:48:02 +0100 Subject: [PATCH] Lint --- .../app/push/fcm/EmbeddedFCMDistributor.kt | 2 +- ...NotificationTroubleshootTestManagerFactory.kt | 3 +-- .../vector/app/core/pushers/UnifiedPushHelper.kt | 16 ++++++++-------- .../app/core/pushers/VectorMessagingReceiver.kt | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/EmbeddedFCMDistributor.kt b/vector/src/gplay/java/im/vector/app/push/fcm/EmbeddedFCMDistributor.kt index 0d0e066eb4..14600ccbb3 100644 --- a/vector/src/gplay/java/im/vector/app/push/fcm/EmbeddedFCMDistributor.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/EmbeddedFCMDistributor.kt @@ -19,7 +19,7 @@ package im.vector.app.push.fcm import android.content.Context import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorReceiver -class EmbeddedFCMDistributor: EmbeddedDistributorReceiver() { +class EmbeddedFCMDistributor : EmbeddedDistributorReceiver() { override fun getEndpoint(context: Context, token: String, instance: String): String { // Here token is the FCM Token, used by the gateway (sygnal) return token diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt b/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt index 5a31affcf7..7c9e8b8c26 100644 --- a/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt @@ -25,11 +25,11 @@ import im.vector.app.features.settings.troubleshoot.TestCurrentUnifiedPushDistri import im.vector.app.features.settings.troubleshoot.TestDeviceSettings import im.vector.app.features.settings.troubleshoot.TestEndpointAsTokenRegistration import im.vector.app.features.settings.troubleshoot.TestNotification +import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings import im.vector.app.features.settings.troubleshoot.TestSystemSettings import im.vector.app.features.settings.troubleshoot.TestUnifiedPushEndpoint import im.vector.app.features.settings.troubleshoot.TestUnifiedPushGateway -import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway import im.vector.app.gplay.features.settings.troubleshoot.TestFirebaseToken import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices import im.vector.app.gplay.features.settings.troubleshoot.TestTokenRegistration @@ -66,7 +66,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor( mgr.addTest(testPlayServices) mgr.addTest(testFirebaseToken) mgr.addTest(testTokenRegistration) - } else { mgr.addTest(testUnifiedPushGateway) mgr.addTest(testUnifiedPushEndpoint) 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 9e0836e4f0..9a47a6232f 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 @@ -132,8 +132,8 @@ object UnifiedPushHelper { context.getString(R.string.unifiedpush_distributor_background_sync) } - if (distributors.size == 1 - && !force){ + if (distributors.size == 1 && + !force) { up.saveDistributor(context, distributors.first()) up.registerApp(context) onDoneRunnable?.run() @@ -239,14 +239,14 @@ object UnifiedPushHelper { } as String } - fun isEmbeddedDistributor(context: Context) : Boolean { - return ( up.getDistributor(context) == context.packageName - && FcmHelper.isPushSupported()) + fun isEmbeddedDistributor(context: Context): Boolean { + return (up.getDistributor(context) == context.packageName && + FcmHelper.isPushSupported()) } - fun isBackgroundSync(context: Context) : Boolean { - return ( up.getDistributor(context) == context.packageName - && !FcmHelper.isPushSupported()) + fun isBackgroundSync(context: Context): Boolean { + return (up.getDistributor(context) == context.packageName && + !FcmHelper.isPushSupported()) } fun getPrivacyFriendlyUpEndpoint(context: Context): String? { diff --git a/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt b/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt index a9d3845bba..ec29b7c0d9 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/VectorMessagingReceiver.kt @@ -159,8 +159,8 @@ class VectorMessagingReceiver : MessagingReceiver() { val gateway = UnifiedPushHelper.customOrDefaultGateway(context, endpoint) // If the endpoint has changed // or the gateway has changed - if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint - || UnifiedPushHelper.getPushGateway(context) != gateway) { + if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint || + UnifiedPushHelper.getPushGateway(context) != gateway) { UnifiedPushHelper.storePushGateway(context, gateway) UnifiedPushHelper.storeUpEndpoint(context, endpoint) pushersManager.enqueueRegisterPusher(endpoint, gateway)