From 41d35e68a05a6c8cbbb2e006ee947b35f6f83428 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 26 Jul 2022 17:43:38 +0200 Subject: [PATCH] Inject SharedPreferences --- .../src/gplay/java/im/vector/app/nightly/NightlyProxy.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vector/src/gplay/java/im/vector/app/nightly/NightlyProxy.kt b/vector/src/gplay/java/im/vector/app/nightly/NightlyProxy.kt index 8f74c96470..adef016106 100644 --- a/vector/src/gplay/java/im/vector/app/nightly/NightlyProxy.kt +++ b/vector/src/gplay/java/im/vector/app/nightly/NightlyProxy.kt @@ -16,19 +16,20 @@ package im.vector.app.nightly -import android.content.Context +import android.content.SharedPreferences import androidx.core.content.edit import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.appdistribution.FirebaseAppDistributionException import im.vector.app.BuildConfig -import im.vector.app.core.di.DefaultSharedPreferences +import im.vector.app.core.di.DefaultPreferences import im.vector.app.core.time.Clock import timber.log.Timber import javax.inject.Inject class NightlyProxy @Inject constructor( private val clock: Clock, - private val context: Context, + @DefaultPreferences + private val sharedPreferences: SharedPreferences, ) { fun mayDisplayFirebasePopup() { if (!canDisplayPopup()) return @@ -56,7 +57,6 @@ class NightlyProxy @Inject constructor( private fun canDisplayPopup(): Boolean { if (BuildConfig.APPLICATION_ID != "im.vector.app.nightly") return false - val sharedPreferences = DefaultSharedPreferences.getInstance(context) val today = clock.epochMillis() / A_DAY_IN_MILLIS val lastDisplayPopupDay = sharedPreferences.getLong(SHARED_PREF_KEY, 0) return (today > lastDisplayPopupDay)