Commit 1ed185d4 authored by Sparky93's avatar Sparky93 Committed by Sebastian Kaspari
Browse files

Fix for #7980 - MigrationStore's COMPLETE action now redirects to MigrationProgressActivity

In order to ensure that the user's migration screen is not being bypassed by mistake, we handle the
migration's store COMPLETED state the same way we handle the MIGRATING state.

We can do this because we can treat the initial state (NONE) as being either a fresh start of the
app, either the user's intention of starting the home activity.

Before this change, if the app was being open from the shortcut after the migration was complete,
the user would have been encountered the home activity instead of the migration one.
parent 70556765
...@@ -22,6 +22,7 @@ import mozilla.components.support.migration.Migration.History ...@@ -22,6 +22,7 @@ import mozilla.components.support.migration.Migration.History
import mozilla.components.support.migration.Migration.Logins import mozilla.components.support.migration.Migration.Logins
import mozilla.components.support.migration.Migration.Settings import mozilla.components.support.migration.Migration.Settings
import mozilla.components.support.migration.MigrationResults import mozilla.components.support.migration.MigrationResults
import mozilla.components.support.migration.state.MigrationAction
import mozilla.components.support.migration.state.MigrationProgress import mozilla.components.support.migration.state.MigrationProgress
import mozilla.components.support.migration.state.MigrationStore import mozilla.components.support.migration.state.MigrationStore
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
...@@ -62,6 +63,7 @@ class MigrationProgressActivity : AbstractMigrationProgressActivity() { ...@@ -62,6 +63,7 @@ class MigrationProgressActivity : AbstractMigrationProgressActivity() {
// If we received a user-initiated intent, throw this back to the intent receiver. // If we received a user-initiated intent, throw this back to the intent receiver.
if (intent.hasExtra(HomeActivity.OPEN_TO_BROWSER)) { if (intent.hasExtra(HomeActivity.OPEN_TO_BROWSER)) {
store.dispatch(MigrationAction.Clear)
intent.setClassName(applicationContext, IntentReceiverActivity::class.java.name) intent.setClassName(applicationContext, IntentReceiverActivity::class.java.name)
startActivity(intent) startActivity(intent)
} }
......
...@@ -24,8 +24,8 @@ class MigrationDecisionActivity : Activity() { ...@@ -24,8 +24,8 @@ class MigrationDecisionActivity : Activity() {
val intent = if (intent != null) intent else Intent() val intent = if (intent != null) intent else Intent()
val activity = when (store.state.progress) { val activity = when (store.state.progress) {
MigrationProgress.COMPLETED, MigrationProgress.NONE -> HomeActivity::class.java MigrationProgress.NONE -> HomeActivity::class.java
MigrationProgress.MIGRATING -> MigrationProgressActivity::class.java MigrationProgress.MIGRATING, MigrationProgress.COMPLETED -> MigrationProgressActivity::class.java
} }
intent.setClass(applicationContext, activity) intent.setClass(applicationContext, activity)
......
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