Verified Commit 18f07e27 authored by Sebastian's avatar Sebastian
Browse files

Rename bundle variable name and value

parent 15000777
Pipeline #11663 passed with stage
in 3 minutes and 41 seconds
......@@ -64,7 +64,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
companion object {
private val LOG = getLogger(MainActivity::class.java)
const val BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED = "LIFECYCLE_BEYOND_NOT_STARTED"
const val BUNDLE_LIFECYCLE_HAS_STARTED = "LIFECYCLE_HAS_STARTED"
}
private val viewModel: MailboxViewModel by viewModels()
......@@ -84,8 +84,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
// Check if the app has been restored with a UI from an old lifecycle while the app has been
// restarted with a new process and lifecycle. In that case, go back to the init fragment.
if (savedInstanceState != null) {
val hadBeenStartedOnSave =
savedInstanceState.getBoolean(BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED)
val hadBeenStartedOnSave = savedInstanceState.getBoolean(BUNDLE_LIFECYCLE_HAS_STARTED)
if (viewModel.lifecycleState.value == NOT_STARTED && hadBeenStartedOnSave) {
nav.navigate(actionGlobalInitFragment())
}
......@@ -144,9 +143,8 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
// in the background and gets restored from the recent app list after wiping and
// stopping has already completed. In this case onSaveInstanceState() has written
// true to the bundle.
val savedBeyondNotStarted =
savedInstanceState.getBoolean(BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED)
if (!hasDb && savedBeyondNotStarted) {
val hadBeenStartedOnSave = savedInstanceState.getBoolean(BUNDLE_LIFECYCLE_HAS_STARTED)
if (!hasDb && hadBeenStartedOnSave) {
finish()
startActivity(Intent(this, WipeCompleteActivity::class.java))
return
......@@ -170,7 +168,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallback<ActivityResult>
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putBoolean(
BUNDLE_LIFECYCLE_BEYOND_NOT_STARTED,
BUNDLE_LIFECYCLE_HAS_STARTED,
viewModel.lifecycleState.value != NOT_STARTED
)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment