Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Fix for #7980 - MigrationStore's COMPLETE action now redirects to Mig…
Browse files Browse the repository at this point in the history
…rationProgressActivity

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.
  • Loading branch information
Sparky93 authored and pocmo committed Feb 11, 2020
1 parent 7055676 commit 1ed185d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1ed185d

Please sign in to comment.