Skip to content

Commit

Permalink
Bug 1536840 - Deleting FxA account on-device leaves app in state that…
Browse files Browse the repository at this point in the history
… appears connected (#4630)
  • Loading branch information
justindarc committed Mar 20, 2019
1 parent c874695 commit baf102c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Client/Frontend/Settings/FxAContentViewController.swift
Expand Up @@ -29,6 +29,7 @@ class FxAContentViewController: SettingsContentViewController, WKScriptMessageHa
case changePassword = "change_password"
case sessionStatus = "session_status"
case signOut = "sign_out"
case deleteAccount = "delete_account"
}

weak var delegate: FxAContentViewControllerDelegate?
Expand Down Expand Up @@ -122,6 +123,13 @@ class FxAContentViewController: SettingsContentViewController, WKScriptMessageHa
injectData("message", content: ["status": "error"])
}

// The user has deleted their Firefox Account. Disconnect them!
fileprivate func onDeleteAccount(_ data: JSON) {
FxALoginHelper.sharedInstance.applicationDidDisconnect(UIApplication.shared)
LeanPlumClient.shared.set(attributes: [LPAttributeKey.signedInSync: profile.hasAccount()])
dismiss(animated: true)
}

// The user has signed in to a Firefox Account. We're done!
fileprivate func onLogin(_ data: JSON) {
injectData("message", content: ["status": "login"])
Expand Down Expand Up @@ -180,6 +188,8 @@ class FxAContentViewController: SettingsContentViewController, WKScriptMessageHa
onSessionStatus(data)
case .signOut:
onSignOut(data)
case .deleteAccount:
onDeleteAccount(data)
}
}
}
Expand Down

0 comments on commit baf102c

Please sign in to comment.