Closed Bug 1857021 Opened 2 years ago Closed 1 year ago

Support for "logout" and "delete_account" messages is missing from fx-webchannel

Categories

(Firefox for Android :: Accounts and Sync, defect, P1)

All
Android
defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: mavduevskiy, Assigned: jonalmeida)

References

(Depends on 1 open bug, Blocks 4 open bugs)

Details

Attachments

(4 files, 2 obsolete files)

Problem

When a user is deleting the account at "accounts.firefox.com", the app enters reath state

Solution

Listen to the webchannel message confirming account removal, and change the app state accordingly. UX should be similar to what we have on desktop.

Blocks: 1856767
Assignee: nobody → mavduevskiy
Blocks: 1864975
Severity: -- → S3
Summary: [FxA UX] support "account_deleted" message from fx-webchannel → Support "account_deleted" message from fx-webchannel

I'm going to take this since we are landing an FXA patch that would be nice to have both our platform across both of our platforms.

Assignee: mavduevskiy → jonalmeida942
Status: NEW → ASSIGNED
Attachment #9363768 - Attachment is obsolete: true
Type: enhancement → defect
Priority: -- → P1
Summary: Support "account_deleted" message from fx-webchannel → Support "account_deleted" message is missing from fx-webchannel
Summary: Support "account_deleted" message is missing from fx-webchannel → Support for "account_deleted" message is missing from fx-webchannel
Blocks: 1906954
Depends on: 1907643
Depends on: 1908518
Summary: Support for "account_deleted" message is missing from fx-webchannel → Support for "logout" and "delete_account" messages is missing from fx-webchannel

We log out from the FxaAccountManager here for the fxaccounts:logout
and fxaccounts:delete_account messages to stay in line with desktop
and [iOS][1] who the same thing today.

[1[: https://github.com/mozilla-mobile/firefox-ios/blob/3d0481675753805b68ca41a166d9384126f45b02/firefox-ios/RustFxA/FxAWebViewModel.swift#L262-L264

This is something we want to use to make sure that the Custom Tab
intent that we received is from our own application so that we don't
mistakenly try and close an actual Custom Tab in a third party app
that has the web channel code running there.

Depends on D217156

To connect the feature to the UI, we wrap it in an integration class
so that its isolated as we start to handle more commands.

We also early-return when we know that the shared UI is opened from
within the app instead of from a third party app.

Depends on D217158

When adding some of these tests, we add a MainCoroutineRule which
now makes anything that was wrapped in the a Dispatchers.Main
coroutine. Since we weren't doing this before, a bunch of tests
started to fail that were not exercising the real codepaths.

Another example where we need to stop using mocks everywhere unless
it is necessary.

Depends on D217159

Pushed by jonalmeida942@gmail.com: https://hg.mozilla.org/integration/autoland/rev/50fe4f973e73 Part 1: Add support for LOGOUT and DELETE_ACCOUNT web channel messages r=chenba,android-reviewers https://hg.mozilla.org/integration/autoland/rev/e84bc1a197fc Part 2: Add Activity.isIntentInternal() for reusability r=android-reviewers,amejiamarmol https://hg.mozilla.org/integration/autoland/rev/fa0ced592e7d Part 3: Make the FxaWebChannelFeature dismiss the activity on logout r=android-reviewers,amejiamarmol https://hg.mozilla.org/integration/autoland/rev/82c5d07c2f16 Part 4: Add unit tests to FxaWebChannelFeature r=android-reviewers,amejiamarmol
Regressions: 1911357
Attached video Screen_recording_20240923_014823.mp4 (obsolete) —

Hi Jonathon, I was planning to use this function isInternalIntent() you added for a little something but it wasn’t serving my purpose unfortunately.
If you go to Settings -> Sync and save your data -> Use email instead.
This returns an internal custom tab (as I understand it, means any custom tab that our app launched?). But this function returns false and the reason for that is safeIntent.getStringExtra(EXTRA_ACTIVITY_REFERRER_PACKAGE) returns null .
Could you please take a look whenever you have time?
Let me know if this is a bug or is expected?
(Attaching recording for reference)

Flags: needinfo?(jonalmeida942)

(In reply to [:skhan] from comment #9)

Created attachment 9426585 [details]
Screen_recording_20240923_014823.mp4

Hi Jonathon, I was planning to use this function isInternalIntent() you added for a little something but it wasn’t serving my purpose unfortunately.
If you go to Settings -> Sync and save your data -> Use email instead.
This returns an internal custom tab (as I understand it, means any custom tab that our app launched?). But this function returns false and the reason for that is safeIntent.getStringExtra(EXTRA_ACTIVITY_REFERRER_PACKAGE) returns null .
Could you please take a look whenever you have time?
Let me know if this is a bug or is expected?
(Attaching recording for reference)

I spoke with skhan offline. This question was related to bug 1912642.

The TLDR is that the extension method is documented to only work for intents coming from IntentReceiverActivity, so any intent that comes indirectly from there, cannot be guaranteed to have the same EXTRA_ACTIVITY_REFERRER_PACKAGE property.

Flags: needinfo?(jonalmeida942)

Comment on attachment 9426585 [details]
Screen_recording_20240923_014823.mp4

Marking as obsolete, so we don't confuse this attachment with this bug.

Attachment #9426585 - Attachment is obsolete: true
Blocks: 1857028
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: