Skip to content

Commit

Permalink
Fix mozilla-mobile#4902 - FxA appears connected after uninstalling/re…
Browse files Browse the repository at this point in the history
…installing the app
  • Loading branch information
justindarc committed May 7, 2019
1 parent 021dd2b commit c0b4db7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Providers/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ open class BrowserProfile: Profile {
self.db = BrowserDB(filename: "browser.db", schema: BrowserSchema(), files: files)
self.readingListDB = BrowserDB(filename: "ReadingList.db", schema: ReadingListSchema(), files: files)

if isNewProfile {
log.info("New profile. Removing old Keychain/Prefs data.")
KeychainWrapper.wipeKeychain()
prefs.clearAll()
}

// Migrate bookmarks from old browser.db to new Rust places.db only
// if this user is NOT signed into Sync (only migrates once if needed).
if !self.hasAccount() {
Expand Down Expand Up @@ -278,15 +284,6 @@ open class BrowserProfile: Profile {
notificationCenter.addObserver(self, selector: #selector(onLocationChange), name: .OnLocationChange, object: nil)
notificationCenter.addObserver(self, selector: #selector(onPageMetadataFetched), name: .OnPageMetadataFetched, object: nil)

if isNewProfile {
log.info("New profile. Removing old account metadata.")
_ = keychain.removeAllKeys()
self.removeAccountMetadata()
self.syncManager.onNewProfile()
self.removeExistingAuthenticationInfo()
prefs.clearAll()
}

// Always start by needing invalidation.
// This is the same as self.history.setTopSitesNeedsInvalidation, but without the
// side-effect of instantiating SQLiteHistory (and thus BrowserDB) on the main thread.
Expand Down

0 comments on commit c0b4db7

Please sign in to comment.