aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt19
2 files changed, 15 insertions, 16 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index f8c7af56..63e57554 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -65,16 +65,10 @@ object Prefs : KPref() {
get() = if (headerColor.isColorVisibleOn(bgColor, 100)) headerColor else textColor
/**
- * Ensures that the color is visible against both the foreground and background
+ * Ensures that the color is visible against the background
*/
- val accentBackgroundColor: Int
- get() {
- if (headerColor.isColorVisibleOn(textColor, 100)) {
- if (headerColor.isColorVisibleOn(bgColor, 100)) return headerColor
- else return headerColor.colorToForeground(0.2f)
- }
- return bgColor.colorToForeground(0.2f)
- }
+ val iconBackgroundColor: Int
+ get() = if (headerColor.isColorVisibleOn(bgColor)) headerColor else headerColor.colorToForeground(0.2f)
val themeInjector: InjectorContract
get() = t.injector
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
index 964e771c..669b2c9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
@@ -158,13 +158,18 @@ private fun SettingsActivity.finishRestore(snackbar: Snackbar, hasPro: Boolean)
*/
fun Activity.validatePro() {
L.d("Play Store Validate pro")
- getInventory(Prefs.pro, false, { if (Prefs.pro) playStoreNoLongerPro() }) {
- inv, helper ->
- val proSku = inv.hasPurchase(FROST_PRO)
- L.d("Play Store Validation finished: ${Prefs.pro} should be $proSku")
- if (!proSku && Prefs.pro) playStoreNoLongerPro()
- else if (proSku && !Prefs.pro) playStoreFoundPro()
- helper.disposeWhenFinished()
+ try {
+ getInventory(Prefs.pro, false, { if (Prefs.pro) playStoreNoLongerPro() }) {
+ inv, helper ->
+ val proSku = inv.hasPurchase(FROST_PRO)
+ L.d("Play Store Validation finished: ${Prefs.pro} should be $proSku")
+ if (!proSku && Prefs.pro) playStoreNoLongerPro()
+ else if (proSku && !Prefs.pro) playStoreFoundPro()
+ IAB.dispose(helper)
+ }
+ } catch (e: Exception) {
+ L.e(e, "Play store validation exception")
+ IAB.dispose()
}
}