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.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt9
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt4
4 files changed, 14 insertions, 3 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 a20e755f..b053b9dd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -97,7 +97,8 @@ object Prefs : KPref() {
var notificationAllAccounts: Boolean by kpref("notification_all_accounts", true)
- var notificationsInstantMessages: Boolean by kpref("notification_im", true)
+ //todo remove from experimental once stabilized
+ var notificationsInstantMessages: Boolean by kpref("notification_im", Showcase.experimentalDefault)
var notificationVibrate: Boolean by kpref("notification_vibrate", true)
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 40e16f20..cc3ea52e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -116,9 +116,14 @@ fun frostAnswers(action: Answers.() -> Unit) {
Answers.getInstance().action()
}
-fun frostAnswersCustom(name: String, action: CustomEvent.() -> Unit = {}) {
+fun frostAnswersCustom(name: String, vararg events: Pair<String, Any>) {
frostAnswers {
- logCustom(CustomEvent("Frost $name").apply { action() })
+ logCustom(CustomEvent("Frost $name").apply {
+ events.forEach { (key, value) ->
+ if (value is Number) putCustomAttribute(key, value)
+ else putCustomAttribute(key, value.toString())
+ }
+ })
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
index ea66030f..3918a993 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt
@@ -41,6 +41,7 @@ class WebContext(val unformattedUrl: String, val text: String?) {
}
enum class WebContextType(val textId: Int, val onClick: (c: Context, wc: WebContext) -> Unit) {
+ OPEN_LINK(R.string.open_link, { c, wc -> c.launchWebOverlay(wc.unformattedUrl) }),
COPY_LINK(R.string.copy_link, { c, wc -> c.copyToClipboard(wc.url) }),
COPY_TEXT(R.string.copy_text, { c, wc -> if (wc.text != null) c.copyToClipboard(wc.text) else c.toast(R.string.no_text) }),
SHARE_LINK(R.string.share_link, { c, wc -> c.shareText(wc.url) }),
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt
index b3992ff4..bad7f8fd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt
@@ -15,6 +15,10 @@ import com.pitchedapps.frost.utils.frostAnswers
*/
private const val FROST_PRO = "frost_pro"
+/**
+ * Implemented pro checker with a hook for debug builds
+ * Use this when checking if the pro feature is enabled
+ */
val IS_FROST_PRO: Boolean
get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.pro