using build meta for application id
This commit is contained in:
parent
bbbea4f316
commit
fc8aa16105
|
@ -20,8 +20,8 @@ import android.content.SharedPreferences
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import com.google.firebase.appdistribution.FirebaseAppDistribution
|
import com.google.firebase.appdistribution.FirebaseAppDistribution
|
||||||
import com.google.firebase.appdistribution.FirebaseAppDistributionException
|
import com.google.firebase.appdistribution.FirebaseAppDistributionException
|
||||||
import im.vector.app.BuildConfig
|
|
||||||
import im.vector.app.core.di.DefaultPreferences
|
import im.vector.app.core.di.DefaultPreferences
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.time.Clock
|
import im.vector.app.core.time.Clock
|
||||||
import im.vector.app.features.home.NightlyProxy
|
import im.vector.app.features.home.NightlyProxy
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
@ -31,7 +31,8 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||||
private val clock: Clock,
|
private val clock: Clock,
|
||||||
@DefaultPreferences
|
@DefaultPreferences
|
||||||
private val sharedPreferences: SharedPreferences,
|
private val sharedPreferences: SharedPreferences,
|
||||||
) : NightlyProxy {
|
private val buildMeta: BuildMeta,
|
||||||
|
): NightlyProxy {
|
||||||
|
|
||||||
override fun onHomeResumed() {
|
override fun onHomeResumed() {
|
||||||
if (!canDisplayPopup()) return
|
if (!canDisplayPopup()) return
|
||||||
|
@ -58,7 +59,7 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun canDisplayPopup(): Boolean {
|
private fun canDisplayPopup(): Boolean {
|
||||||
if (BuildConfig.APPLICATION_ID != "im.vector.app.nightly") return false
|
if (buildMeta.applicationId != "im.vector.app.nightly") return false
|
||||||
val today = clock.epochMillis() / A_DAY_IN_MILLIS
|
val today = clock.epochMillis() / A_DAY_IN_MILLIS
|
||||||
val lastDisplayPopupDay = sharedPreferences.getLong(SHARED_PREF_KEY, 0)
|
val lastDisplayPopupDay = sharedPreferences.getLong(SHARED_PREF_KEY, 0)
|
||||||
return (today > lastDisplayPopupDay)
|
return (today > lastDisplayPopupDay)
|
||||||
|
|
Loading…
Reference in New Issue