From 045398d06feddff81be334cddf8c834a86383d68 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Tue, 9 Aug 2022 10:42:44 +0100 Subject: [PATCH] fixing import ordering and duplicated documentation --- .../app/features/debug/di/DebugModule.kt | 5 ++--- .../app/receivers/VectorDebugReceiver.kt | 2 +- .../im/vector/app/push/fcm/FdroidFcmHelper.kt | 15 --------------- ...ificationTroubleshootTestManagerFactory.kt | 2 +- .../java/im/vector/app/di/FlavorModule.kt | 1 - .../im/vector/app/push/fcm/GoogleFcmHelper.kt | 19 +------------------ .../im/vector/app/core/pushers/FcmHelper.kt | 13 +++++++------ .../features/navigation/DefaultNavigator.kt | 3 +-- 8 files changed, 13 insertions(+), 47 deletions(-) diff --git a/vector/src/debug/java/im/vector/app/features/debug/di/DebugModule.kt b/vector/src/debug/java/im/vector/app/features/debug/di/DebugModule.kt index 56df9fa0bc..b15f6dce62 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/di/DebugModule.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/di/DebugModule.kt @@ -23,10 +23,10 @@ import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import im.vector.app.core.debug.DebugReceiver -import im.vector.app.features.debug.DebugMenuActivity import im.vector.app.core.debug.DebugNavigator +import im.vector.app.core.debug.DebugReceiver import im.vector.app.core.debug.FlipperProxy +import im.vector.app.features.debug.DebugMenuActivity import im.vector.app.flipper.VectorFlipperProxy import im.vector.app.receivers.VectorDebugReceiver @@ -49,5 +49,4 @@ abstract class DebugModule { @Binds abstract fun bindsFlipperProxy(flipperProxy: VectorFlipperProxy): FlipperProxy - } diff --git a/vector/src/debug/java/im/vector/app/receivers/VectorDebugReceiver.kt b/vector/src/debug/java/im/vector/app/receivers/VectorDebugReceiver.kt index 827fc540f7..550dc055d9 100644 --- a/vector/src/debug/java/im/vector/app/receivers/VectorDebugReceiver.kt +++ b/vector/src/debug/java/im/vector/app/receivers/VectorDebugReceiver.kt @@ -22,8 +22,8 @@ import android.content.Intent import android.content.IntentFilter import android.content.SharedPreferences import androidx.core.content.edit -import im.vector.app.core.di.DefaultSharedPreferences import im.vector.app.core.debug.DebugReceiver +import im.vector.app.core.di.DefaultSharedPreferences import im.vector.app.core.utils.lsFiles import timber.log.Timber import javax.inject.Inject diff --git a/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidFcmHelper.kt b/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidFcmHelper.kt index 8d41ce1e00..5b83769116 100755 --- a/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidFcmHelper.kt +++ b/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidFcmHelper.kt @@ -36,29 +36,14 @@ class FdroidFcmHelper @Inject constructor( override fun isFirebaseAvailable(): Boolean = false - /** - * Retrieves the FCM registration token. - * - * @return the FCM token or null if not received from FCM - */ override fun getFcmToken(): String? { return null } - /** - * Store FCM token to the SharedPrefs - * - * @param token the token to store - */ override fun storeFcmToken(token: String?) { // No op } - /** - * onNewToken may not be called on application upgrade, so ensure my shared pref is set - * - * @param activity the first launch Activity - */ override fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager, registerPusher: Boolean) { // No op } diff --git a/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidNotificationTroubleshootTestManagerFactory.kt b/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidNotificationTroubleshootTestManagerFactory.kt index 86843f0e6f..d99afa59f7 100644 --- a/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidNotificationTroubleshootTestManagerFactory.kt +++ b/vector/src/fdroid/java/im/vector/app/push/fcm/FdroidNotificationTroubleshootTestManagerFactory.kt @@ -53,7 +53,7 @@ class FdroidNotificationTroubleshootTestManagerFactory @Inject constructor( private val testBatteryOptimization: TestBatteryOptimization, private val testNotification: TestNotification, private val vectorFeatures: VectorFeatures, -): NotificationTroubleshootTestManagerFactory { +) : NotificationTroubleshootTestManagerFactory { override fun create(fragment: Fragment): NotificationTroubleshootTestManager { val mgr = NotificationTroubleshootTestManager(fragment) diff --git a/vector/src/gplay/java/im/vector/app/di/FlavorModule.kt b/vector/src/gplay/java/im/vector/app/di/FlavorModule.kt index c97d1bff04..393ea1e62a 100644 --- a/vector/src/gplay/java/im/vector/app/di/FlavorModule.kt +++ b/vector/src/gplay/java/im/vector/app/di/FlavorModule.kt @@ -49,4 +49,3 @@ abstract class FlavorModule { @Binds abstract fun bindsFlavorLegals(legals: GoogleFlavorLegals): FlavourLegals } - diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/GoogleFcmHelper.kt b/vector/src/gplay/java/im/vector/app/push/fcm/GoogleFcmHelper.kt index 636f4f3189..d64847c124 100755 --- a/vector/src/gplay/java/im/vector/app/push/fcm/GoogleFcmHelper.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/GoogleFcmHelper.kt @@ -45,32 +45,17 @@ class GoogleFcmHelper @Inject constructor( override fun isFirebaseAvailable(): Boolean = true - /** - * Retrieves the FCM registration token. - * - * @return the FCM token or null if not received from FCM - */ override fun getFcmToken(): String? { return sharedPrefs.getString(PREFS_KEY_FCM_TOKEN, null) } - /** - * Store FCM token to the SharedPrefs - * TODO Store in realm - * - * @param token the token to store - */ override fun storeFcmToken(token: String?) { + // TODO Store in realm sharedPrefs.edit { putString(PREFS_KEY_FCM_TOKEN, token) } } - /** - * onNewToken may not be called on application upgrade, so ensure my shared pref is set - * - * @param activity the first launch Activity - */ override fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager, registerPusher: Boolean) { // if (TextUtils.isEmpty(getFcmToken(activity))) { // 'app should always check the device for a compatible Google Play services APK before accessing Google Play services features' @@ -106,12 +91,10 @@ class GoogleFcmHelper @Inject constructor( return resultCode == ConnectionResult.SUCCESS } - @Suppress("UNUSED_PARAMETER") override fun onEnterForeground(activeSessionHolder: ActiveSessionHolder) { // No op } - @Suppress("UNUSED_PARAMETER") override fun onEnterBackground(activeSessionHolder: ActiveSessionHolder) { // No op } diff --git a/vector/src/main/java/im/vector/app/core/pushers/FcmHelper.kt b/vector/src/main/java/im/vector/app/core/pushers/FcmHelper.kt index 601722a036..7b2c5e3959 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/FcmHelper.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/FcmHelper.kt @@ -25,22 +25,23 @@ interface FcmHelper { /** * Retrieves the FCM registration token. * - * @return the FCM token or null if not received from FCM + * @return the FCM token or null if not received from FCM. */ fun getFcmToken(): String? /** - * Store FCM token to the SharedPrefs - * TODO Store in realm + * Store FCM token to the SharedPrefs. * - * @param token the token to store + * @param token the token to store. */ fun storeFcmToken(token: String?) /** - * onNewToken may not be called on application upgrade, so ensure my shared pref is set + * onNewToken may not be called on application upgrade, so ensure my shared pref is set. * - * @param activity the first launch Activity + * @param activity the first launch Activity. + * @param pushersManager the instance to register the pusher on. + * @param registerPusher whether the pusher should be registered. */ fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager, registerPusher: Boolean) diff --git a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt index 872f102a0d..e724084501 100644 --- a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt +++ b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt @@ -34,6 +34,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder import im.vector.app.R import im.vector.app.SpaceStateHandler import im.vector.app.config.OnboardingVariant +import im.vector.app.core.debug.DebugNavigator import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.error.fatalError import im.vector.app.features.VectorFeatures @@ -51,7 +52,6 @@ import im.vector.app.features.crypto.recover.BootstrapBottomSheet import im.vector.app.features.crypto.recover.SetupMode import im.vector.app.features.crypto.verification.SupportedVerificationMethodsProvider import im.vector.app.features.crypto.verification.VerificationBottomSheet -import im.vector.app.core.debug.DebugNavigator import im.vector.app.features.devtools.RoomDevToolActivity import im.vector.app.features.home.room.detail.RoomDetailActivity import im.vector.app.features.home.room.detail.arguments.TimelineArgs @@ -616,4 +616,3 @@ class DefaultNavigator @Inject constructor( context.startActivity(this) } } -