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/Utils.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt36
2 files changed, 13 insertions, 33 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index e5e1a706..aeddd20c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -16,6 +16,7 @@ import android.widget.TextView
import ca.allanwang.kau.mediapicker.createMediaFile
import ca.allanwang.kau.mediapicker.createPrivateMediaFile
import ca.allanwang.kau.utils.*
+import ca.allanwang.kau.xml.showChangelog
import com.afollestad.materialdialogs.MaterialDialog
import com.bumptech.glide.RequestBuilder
import com.bumptech.glide.load.resource.bitmap.CircleCrop
@@ -197,3 +198,12 @@ fun Context.resolveActivityForUri(uri: Uri): Boolean {
inline val String?.isFacebookUrl
get() = this != null && this.contains(FACEBOOK_COM)
+fun Context.frostChangelog() = showChangelog(R.xml.frost_changelog, Prefs.textColor) {
+ theme()
+ if (System.currentTimeMillis() - Prefs.installDate > 2592000000) { //show after 1 month
+ neutralText(R.string.kau_rate)
+ onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) }
+ }
+}
+
+
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
index e997731b..8ddb46d2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
@@ -78,44 +78,14 @@ fun Activity.playStorePurchaseUnsupported() {
}
}
-fun Activity.playStoreProNotAvailable() {
- L.d("Pro query; store not available")
- materialDialogThemed {
- title(R.string.uh_oh)
- content(R.string.play_store_not_found_pro_query)
- positiveText(R.string.kau_ok)
- neutralText(R.string.kau_play_store)
- onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) }
- }
-}
-
-fun Activity.playStoreGenericError(text: String? = "Store generic error") {
- if (text != null) playStoreLog("IAB: $text")
- materialDialogThemed {
- title(R.string.uh_oh)
- content(R.string.play_store_billing_error)
- positiveText(R.string.kau_ok)
- }
-}
-
-fun Activity.playStoreAlreadyPurchased(key: String) {
- L.d("Play store already purchased $key")
- materialDialogThemed {
- title(R.string.play_already_purchased)
- content(String.format(string(R.string.play_already_purchased_content), key))
- positiveText(R.string.reload)
- dismissListener {
- this@playStoreAlreadyPurchased.playRestart()
- }
- }
-}
-
fun Activity.playStorePurchasedSuccessfully(key: String) {
L.d("Play store purchased $key successfully")
materialDialogThemed {
title(R.string.play_thank_you)
content(R.string.play_purchased_pro)
positiveText(R.string.kau_ok)
+ neutralText(R.string.kau_rate)
+ onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) }
}
}
@@ -123,7 +93,7 @@ fun Activity.purchaseRestored() {
L.d("Purchase restored")
materialDialogThemed {
title(R.string.play_thank_you)
- content(R.string.play_purchased_pro)
+ content(R.string.purchases_restored_with_pro)
positiveText(R.string.kau_ok)
}
} \ No newline at end of file