Skip to content

Commit

Permalink
Show onboard message on first launch
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Mar 28, 2020
1 parent e5be9e2 commit 6fe8131
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/src/main/java/space/celestia/mobilecelestia/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class MainActivity : AppCompatActivity(),
// apply setting
readSettings()

// show onboard
showWelcomeIfNeeded()

// open url/script if present
readyForUriInput = true
runScriptOrOpenURLIfNeededOnMainThread()
Expand All @@ -142,6 +145,13 @@ class MainActivity : AppCompatActivity(),
AppStatusReporter.shared().updateStatus("Loading Celestia failed...")
}

private fun showWelcomeIfNeeded() {
if (preferenceManager[PreferenceManager.PredefinedKey.OnboardMessage] != "true") {
preferenceManager[PreferenceManager.PredefinedKey.OnboardMessage] = "true"
showHelp()
}
}

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class PreferenceManager(context: Context, private val name: String) {
}

enum class PredefinedKey : Key {
DataVersion;
DataVersion,
OnboardMessage;

override val valueString: String
get() = toString()
Expand Down

0 comments on commit 6fe8131

Please sign in to comment.