From 7746e63373c905faa6d7e45e45fffc48d3ffff85 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 3 Aug 2017 22:21:51 -0700 Subject: Add IM notifications, FAQ, video uploading, and geolocations (#107) * Test canary * Update activities to use kau base * Update dependencies * Cherry pick faq * Update kau and add faq * Add readme badges * Add im notifications and video uploading * Update theme * Update and fix unit tests * Add geolocation * Prepare alpha test * Remove explicit nonnull request --- app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt | 3 ++- app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 9 +++++++-- .../main/kotlin/com/pitchedapps/frost/utils/WebContextMenu.kt | 1 + app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABBinder.kt | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils') 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) { 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 -- cgit v1.2.3