mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-06-03 23:19:51 +00:00
android: fix FOSS upgraded being written false on app launch
fixes #610
This commit is contained in:
@@ -179,7 +179,7 @@ class AirPodsViewModel(
|
|||||||
if (premium) {
|
if (premium) {
|
||||||
sharedPreferences.edit {
|
sharedPreferences.edit {
|
||||||
remove("premium_expiry_time")
|
remove("premium_expiry_time")
|
||||||
remove("foss_upgraded")
|
if (BuildConfig.PLAY_BUILD) remove("foss_upgraded")
|
||||||
}
|
}
|
||||||
_uiState.update { it.copy(isPremium = true, timeUntilFOSSPremiumExpiry = 0L) }
|
_uiState.update { it.copy(isPremium = true, timeUntilFOSSPremiumExpiry = 0L) }
|
||||||
} else {
|
} else {
|
||||||
@@ -399,6 +399,7 @@ class AirPodsViewModel(
|
|||||||
|
|
||||||
// faulty update on Play caused PLAY_BUILD to be false and resulted in use of FOSS billing in Play. since FOSS is not verified, we need to give 2 weeks to verify the purchase
|
// faulty update on Play caused PLAY_BUILD to be false and resulted in use of FOSS billing in Play. since FOSS is not verified, we need to give 2 weeks to verify the purchase
|
||||||
|
|
||||||
|
if (BuildConfig.PLAY_BUILD) {
|
||||||
val expiryTime = sharedPreferences.getLong("premium_expiry_time", 0L)
|
val expiryTime = sharedPreferences.getLong("premium_expiry_time", 0L)
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
|
|
||||||
@@ -428,7 +429,7 @@ class AirPodsViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First migration from accidental FOSS Play build
|
// First migration from accidental FOSS Play build
|
||||||
fossUpgraded && !_uiState.value.isPremium && BuildConfig.PLAY_BUILD -> {
|
fossUpgraded && !_uiState.value.isPremium -> {
|
||||||
val newExpiry = now + 28L * 24 * 60 * 60 * 1000
|
val newExpiry = now + 28L * 24 * 60 * 60 * 1000
|
||||||
|
|
||||||
sharedPreferences.edit {
|
sharedPreferences.edit {
|
||||||
@@ -444,6 +445,7 @@ class AirPodsViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setOffListeningMode(enabled: Boolean) {
|
fun setOffListeningMode(enabled: Boolean) {
|
||||||
sharedPreferences.edit { putBoolean("off_listening_mode", enabled) }
|
sharedPreferences.edit { putBoolean("off_listening_mode", enabled) }
|
||||||
|
|||||||
Reference in New Issue
Block a user