aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-03 22:15:04 -0700
committerAllan Wang <me@allanwang.ca>2017-07-04 01:17:26 -0400
commit8ddc3e1512a5add02a7391e92320d3babca85fc8 (patch)
tree3ff051c13f0d688c76c9d7fb2ea31e1a5c4f6590 /app/src/main/kotlin
parent74ab377fdb14b09929d218836186507b60e0b306 (diff)
downloadfrost-8ddc3e1512a5add02a7391e92320d3babca85fc8.tar.gz
frost-8ddc3e1512a5add02a7391e92320d3babca85fc8.tar.bz2
frost-8ddc3e1512a5add02a7391e92320d3babca85fc8.zip
Create showcase prefs
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt16
4 files changed, 29 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
index 8d38f2f9..cba6b878 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt
@@ -13,6 +13,7 @@ import com.mikepenz.materialdrawer.util.DrawerImageLoader
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.CrashReportingTree
import com.pitchedapps.frost.utils.Prefs
+import com.pitchedapps.frost.utils.Showcase
import com.raizlabs.android.dbflow.config.FlowConfig
import com.raizlabs.android.dbflow.config.FlowManager
import io.fabric.sdk.android.Fabric
@@ -35,6 +36,7 @@ class FrostApp : Application() {
override fun onCreate() {
FlowManager.init(FlowConfig.Builder(this).build())
Prefs.initialize(this, "${BuildConfig.APPLICATION_ID}.prefs")
+ Showcase.initialize(this, "${BuildConfig.APPLICATION_ID}.showcase")
// if (LeakCanary.isInAnalyzerProcess(this)) return
// refWatcher = LeakCanary.install(this)
if (BuildConfig.DEBUG) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
index 2bd6ba69..dd7f60b7 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt
@@ -54,8 +54,8 @@ open class WebOverlayActivity : AppCompatActivity() {
frostWeb.web.addTitleListener({ toolbar.title = it })
if (userId != Prefs.userId) FbCookie.switchUser(userId) { frostWeb.web.loadBaseUrl() }
else frostWeb.web.loadBaseUrl()
- if (Prefs.firstWebOverlay) {
- Prefs.firstWebOverlay = false
+ if (Showcase.firstWebOverlay) {
+ Showcase.firstWebOverlay = false
coordinator.frostSnackbar(R.string.web_overlay_swipe_hint) {
duration = Snackbar.LENGTH_INDEFINITE
setAction(R.string.kau_got_it) { _ -> this.dismiss() }
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 5f0bdc41..7eb6bae9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -83,9 +83,6 @@ object Prefs : KPref() {
var notificationKeywords: StringSet by kpref("notification_keywords", mutableSetOf<String>())
- //check if this is the first time launching the web overlay; show snackbar if true
- var firstWebOverlay: Boolean by kpref("first_web_overlay", true)
-
/**
* Cache like value to determine if user has or had pro
* In most cases, [com.pitchedapps.frost.utils.iab.IS_FROST_PRO] should be looked at instead
@@ -96,9 +93,16 @@ object Prefs : KPref() {
var debugPro: Boolean by kpref("debug_pro", false)
- var searchBar: Boolean by kpref("search_bar", false)
-
var verboseLogging: Boolean by kpref("verbose_logging", false)
var analytics: Boolean by kpref("analytics", true)
+
+ var experimentalDefault:Boolean by kpref("experimental_by_default", false)
+
+ /*
+ * Experimental features must be listed below so the default is initialized
+ */
+
+ var searchBar: Boolean by kpref("search_bar", experimentalDefault)
+
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
new file mode 100644
index 00000000..1429dc1a
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
@@ -0,0 +1,16 @@
+package com.pitchedapps.frost.utils
+
+import ca.allanwang.kau.kpref.KPref
+import ca.allanwang.kau.kpref.kpref
+
+/**
+ * Created by Allan Wang on 2017-07-03.
+ *
+ * Showcase prefs that offer one time helpers to guide new users
+ */
+object Showcase : KPref() {
+
+ //check if this is the first time launching the web overlay; show snackbar if true
+ var firstWebOverlay: Boolean by kpref("first_web_overlay", true)
+}
+