1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 21:12:47 +01:00

Create showcase prefs

This commit is contained in:
Allan Wang 2017-07-03 22:15:04 -07:00
parent 74ab377fdb
commit 8ddc3e1512
5 changed files with 31 additions and 7 deletions

View File

@ -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) {

View File

@ -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() }

View File

@ -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)
}

View File

@ -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)
}

View File

@ -48,6 +48,8 @@
<string name="experimental">Experimental</string>
<string name="experimental_desc">Enable early access to potentially unstable features</string>
<string name="experimental_by_default">Experimental by Default</string>
<string name="experimental_by_default_desc">Feeling risky or just want to help with debugging? Checking this will enable future experimental functions be default.</string>
<string name="experimental_disclaimer">Disclaimer</string>
<string name="experimental_disclaimer_info">Experimental features may be unstable and may never make it to production. Use at your own risk, send feedback, and feel free to disable them if they don\'t work well.</string>
<string name="search_bar">Search Bar</string>