Fix show support button
This commit is contained in:
parent
5737ed6bbc
commit
be913922b8
5 changed files with 10 additions and 7 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ interface IBillingManager {
|
|||
}
|
||||
|
||||
interface UnlockAppListener {
|
||||
fun onLockStatusChanged(isFreeUnlock: Boolean, status: Boolean)
|
||||
fun onLockStatusChanged(status: Boolean, isFreeUnlock: Boolean? = null)
|
||||
|
||||
fun showFailToConnectFeedback()
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class BillingManager(
|
|||
handlePurchases(it.toList())
|
||||
}
|
||||
} else {
|
||||
unlockAppListener?.onLockStatusChanged(isFreeUnlock = false, status = false)
|
||||
unlockAppListener?.onLockStatusChanged(status = false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue