Skip to content
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

Add user-journey completion check for importing passwords via desktop sync #4698

Open
wants to merge 1 commit into
base: feature/craig/import_passwords_via_sync_pixels
Choose a base branch
from

Conversation

CDRussell
Copy link
Member

@CDRussell CDRussell commented Jun 26, 2024

Task/Issue URL: https://app.asana.com/0/1203822806345703/1207149249611733/f

Description

Steps to test this PR

Suggest logcat filter: message~:"user-journey" message~:"Pixel sent: .*autofill"

Testing the "immediate success" flow

  • Fresh install
  • Visit Passwords screen, then tap the Import Passwords button
  • Verify you see Starting user-journey success clock for import passwords screen in the logs
  • Verify you see m_autofill_logins_import_user_journey_started in the logs
  • Tap Sync with Desktop button
  • Enable sync, and sync with a desktop device
  • Go back to the "Import Passwords" screen. verify logs contain m_autofill_logins_import_success

Testing the timed out failure flow

  • Fresh install
  • Visit Passwords screen, then tap the Import Passwords button
  • Set the system date to >= 3 days into the future
  • Return to the app. Verify the logs contain m_autofill_logins_import_failure

Testing the delayed success flow

  • Fresh install
  • Visit Passwords screen, then tap the Import Passwords button
  • Hit back, and return to the browser activity
  • Go to Settings -> Sync & Backup and setup syncing with a desktop device
  • Background the app and restore it.
  • Verify log contains m_autofill_logins_import_success

Restarting the clock

  • Fresh install
  • Visit Passwords screen, then tap the Import Passwords button
  • Verify the logs contain Starting user-journey success clock for import passwords screen
  • Hit back to return to passwords screen
  • Tap Import Passwords button again
  • Verify logs contain Restarting user-journey success clock for import passwords screen
  • Verify logs contain m_autofill_logins_import_user_journey_restarted
  • Background the app and restore it. Verify logs indicate 48h clock was restarted when you re-entered the import passwords screen, by looking at the time remaining

Copy link
Member Author

CDRussell commented Jun 26, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @CDRussell and the rest of your teammates on Graphite Graphite

@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch 3 times, most recently from 5fb09d4 to 5bc5361 Compare June 26, 2024 16:25
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from 9e5a998 to ea4e47d Compare June 26, 2024 16:45
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch 2 times, most recently from fa70e6d to c62b59a Compare June 26, 2024 17:09
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from ea4e47d to a4db5fc Compare June 27, 2024 09:30
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch from c62b59a to 0030112 Compare June 27, 2024 09:30
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from a4db5fc to 365dec6 Compare June 27, 2024 09:53
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch 2 times, most recently from 2950ac3 to 963f332 Compare June 28, 2024 11:39
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from 365dec6 to 9df93ce Compare June 28, 2024 11:48
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch 4 times, most recently from 29ab853 to 6c69933 Compare June 28, 2024 14:58
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from 9df93ce to 33646f3 Compare June 28, 2024 14:59
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch from 6c69933 to 10e75a1 Compare June 28, 2024 14:59
@CDRussell CDRussell marked this pull request as ready for review June 28, 2024 15:31
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just sharing a proposal for reorganizing the logic a bit, to keep the business logic together and viewmodel simpler.


// use appCoroutineScope as the call to get account state might not be quick; we want the call to succeed even if the user leaves the screen
appCoroutineScope.launch(dispatchers.io()) {
if (aUserJourneyIsOngoing()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be better to move all logic related to user journey checks into it's own class?

I see few benefits:

  • ViewModel will be simplified of all logic about sync journey checks, which can be extracted. We can move all that business logic and just keep UI logic here.
  • Dependencies can also be simplified: ViewModel has journey detecting logic which relies on ImportPasswordsViaDesktopSyncDataStore and UserJourneyEndRecorder and DeviceSyncState. UserJourneyEndRecoder on a different class (with dependency to ImportPasswordsViaDesktopSyncDataStore).

I think the flow is easier if we just do: viewModel -> SyncImportUserJourney -> Business logic related to tracking journey

Copy link
Member Author

@CDRussell CDRussell Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that is a good suggestion. I am going to do that as a follow-up as I don't think it's a blocker, tracking as Autofill: extract more of the business logic around importing passwords via desktop to its own class

import javax.inject.Qualifier

@ContributesTo(AppScope::class)
@Module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Do we need to create modules if we rely on DS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly sure if needed, tbh; I was keeping it consistent with the other DS usage we have.

@cmonfortep
Copy link
Contributor

"Background the app and restore it. Verify logs indicate 48h clock was restarted when you re-entered the import passwords screen, by looking at the time remaining"

This is the only step that didn't work for me.

@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch from 10e75a1 to 27adddb Compare July 2, 2024 22:29
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_pixels branch from 33646f3 to f57b2a3 Compare July 2, 2024 22:30
@CDRussell CDRussell force-pushed the feature/craig/import_passwords_via_sync_user_journey_completion_failure branch from 27adddb to ec13e5f Compare July 2, 2024 22:30
@CDRussell
Copy link
Member Author

"Background the app and restore it. Verify logs indicate 48h clock was restarted when you re-entered the import passwords screen, by looking at the time remaining"

This is the only step that didn't work for me.

I'm guessing I know why, and the instructions could have been clearer. Simply returning to the screen won't reset the clock. You have to come in with the Activity being created (basically, through the Import Passwords button/menu again) but doing this won't print the time remaining.

So you have to use the import passwords button again and flip it background/foreground to see the timer back up at 48h. but anyway, was just an extra check and i've ensured it's all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants