1
0
Fork 0

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.
master
Sparky93 2020-02-04 17:32:54 +02:00 committed by Sebastian Kaspari
parent 705567651f
commit 1ed185d4c2
2 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import mozilla.components.support.migration.Migration.History
import mozilla.components.support.migration.Migration.Logins
import mozilla.components.support.migration.Migration.Settings
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.MigrationStore
import org.mozilla.fenix.HomeActivity
@ -62,6 +63,7 @@ class MigrationProgressActivity : AbstractMigrationProgressActivity() {
// If we received a user-initiated intent, throw this back to the intent receiver.
if (intent.hasExtra(HomeActivity.OPEN_TO_BROWSER)) {
store.dispatch(MigrationAction.Clear)
intent.setClassName(applicationContext, IntentReceiverActivity::class.java.name)
startActivity(intent)
}

View File

@ -24,8 +24,8 @@ class MigrationDecisionActivity : Activity() {
val intent = if (intent != null) intent else Intent()
val activity = when (store.state.progress) {
MigrationProgress.COMPLETED, MigrationProgress.NONE -> HomeActivity::class.java
MigrationProgress.MIGRATING -> MigrationProgressActivity::class.java
MigrationProgress.NONE -> HomeActivity::class.java
MigrationProgress.MIGRATING, MigrationProgress.COMPLETED -> MigrationProgressActivity::class.java
}
intent.setClass(applicationContext, activity)