-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disconnect existing external wallets when connecting a new wallet #10863
Conversation
8f04977
to
bd7dd8d
Compare
const std::string& wallet_type, | ||
const base::flat_map<std::string, std::string>& args, | ||
ExternalWalletAuthorizationCallback callback, | ||
ledger::type::Result result) { | ||
if (!Connected()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check result
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good call. The question then becomes: what do we do when disconnecting fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not sure there's much we can do other than log it for support purposes and move on (unless you're thinking showing the user some sort of UI would be useful, but I feel like that could happen down the line beyond this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a logged error.
bd7dd8d
to
80a4bc5
Compare
@@ -805,6 +805,10 @@ void LedgerImpl::DisconnectWallet(const std::string& wallet_type, | |||
}); | |||
} | |||
|
|||
void LedgerImpl::DisconnectExternalWallets(ResultCallback callback) { | |||
WhenReady([this, callback]() { wallet()->DisconnectAllWallets(callback); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently doesn't work for the following reasons:
DisconnectAllWallets
calls the de-linking endpoints unconditionally, whether the user has an active wallet for a given provider or not.DisconnectAllWallets
calls its callback immediately, without waiting for the de-linking operations to complete.
80a4bc5
to
a60019b
Compare
Resolves brave/brave-browser#19119
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
See https://github.com/brave/internal/issues/823