Fix show support button

This commit is contained in:
Lucas Lima 2020-08-25 20:39:46 -03:00
parent 5737ed6bbc
commit be913922b8
No known key found for this signature in database
GPG key ID: 049CCC5A365B00D2
5 changed files with 10 additions and 7 deletions

View file

@ -10,7 +10,7 @@ class IapHandler(
private val context: Context,
private val preferencesManager: IPreferencesRepository,
) : UnlockAppListener {
override fun onLockStatusChanged(isFreeUnlock: Boolean, status: Boolean) {
override fun onLockStatusChanged(status: Boolean, isFreeUnlock: Boolean?) {
preferencesManager.setPremiumFeatures(status, isFreeUnlock)
}

View file

@ -49,7 +49,7 @@ class MockPreferencesRepository : IPreferencesRepository {
override fun disableRequestRating() { }
override fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean) { }
override fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean?) { }
override fun isPremiumEnabled(): Boolean = false

View file

@ -35,7 +35,7 @@ interface IPreferencesRepository {
fun isRequestRatingEnabled(): Boolean
fun disableRequestRating()
fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean)
fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean?)
fun isPremiumEnabled(): Boolean
fun showSupport(): Boolean
@ -193,10 +193,13 @@ class PreferencesRepository(
}
}
override fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean) {
override fun setPremiumFeatures(status: Boolean, keepShowingSupportButton: Boolean?) {
if (!preferencesManager.getBoolean(PREFERENCE_PREMIUM_FEATURES, false)) {
preferencesManager.putBoolean(PREFERENCE_PREMIUM_FEATURES, status)
preferencesManager.putBoolean(PREFERENCE_SHOW_SUPPORT, keepShowingSupportButton)
keepShowingSupportButton?.let {
preferencesManager.putBoolean(PREFERENCE_SHOW_SUPPORT, it)
}
}
}

View file

@ -9,7 +9,7 @@ interface IBillingManager {
}
interface UnlockAppListener {
fun onLockStatusChanged(isFreeUnlock: Boolean, status: Boolean)
fun onLockStatusChanged(status: Boolean, isFreeUnlock: Boolean? = null)
fun showFailToConnectFeedback()
}

View file

@ -55,7 +55,7 @@ class BillingManager(
handlePurchases(it.toList())
}
} else {
unlockAppListener?.onLockStatusChanged(isFreeUnlock = false, status = false)
unlockAppListener?.onLockStatusChanged(status = false)
}
}