Skip to content

Commit

Permalink
Bugfix FXIOS-9937 - Fix incorrect delete webchannel message (#21840)
Browse files Browse the repository at this point in the history
The patch matches what we have in desktop and Android (see bug links),
and in addition also observes the `accountLoggedOut` message to dismiss
the `ManageFxAccountSetting` screen which would otherwise incorrectly
show the user as still signed in.

Fixes #21814
  • Loading branch information
jonalmeida authored Sep 26, 2024
1 parent 819c7cc commit 8031d3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Sync
import Account

class ManageFxAccountSetting: Setting {
private var notification: NSObjectProtocol?

let profile: Profile

override var accessoryType: UITableViewCell.AccessoryType { return .disclosureIndicator }
Expand All @@ -27,6 +29,14 @@ class ManageFxAccountSetting: Setting {
]
)
)

notification = NotificationCenter.default.addObserver(
forName: .accountLoggedOut,
object: nil,
queue: .main
) { [weak settings] _ in
settings?.dismiss(animated: true, completion: nil)
}
}

override func onClick(_ navigationController: UINavigationController?) {
Expand All @@ -37,6 +47,12 @@ class ManageFxAccountSetting: Setting {
deepLinkParams: fxaParams)
navigationController?.pushViewController(viewController, animated: true)
}

deinit {
if let notification = notification {
NotificationCenter.default.removeObserver(notification)
}
}
}

class DisconnectSetting: Setting {
Expand Down
2 changes: 1 addition & 1 deletion firefox-ios/RustFxA/FxAWebViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private enum RemoteCommand: String {
case login = "fxaccounts:login"
case changePassword = "fxaccounts:change_password"
case signOut = "fxaccounts:logout"
case deleteAccount = "fxaccounts:delete_account"
case deleteAccount = "fxaccounts:delete"
case profileChanged = "profile:change"
}

Expand Down

0 comments on commit 8031d3f

Please sign in to comment.