-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pixels for importing google passwords metrics (#5284)
Task/Issue URL: https://app.asana.com/0/608920331025315/1208787586139232/f ### Description Adds metrics around the import password flow. To support this in a flexible way, it also allows for the url mappings to be defined remotely for which stage of the flow a user dropped out at if they didn't go all the way through; if we ever need to, can override the default url mappings. Logcat filter: `message~:"Pixel sent: autofill_import_google_passwords"` ### Steps to test this PR **Setup** - [x] Fresh install **Cancelling the user journey** - [x] Visit `Passwords` screen, and verify `autofill_import_google_passwords_import_button_shown` in logs for the import password button being shown - [x] Tap on `Import Passwords From Google` button; verify`autofill_import_google_passwords_import_button_tapped` in logs - [x] Verify `autofill_import_google_passwords_preimport_prompt_displayed` in logs - [x] Dismiss the import dialog; verify`autofill_import_google_passwords_result_user_cancelled` in logs - [x] Tap on `Import Passwords From Google` button again. - [x] This time, tap on the `Open Google Passwords` button; verify`autofill_import_google_passwords_preimport_prompt_confirmed` in logs - [x] Tap the ✖️ button to quit the import flow; verify`autofill_import_google_passwords_result_user_cancelled` in logs, with `stage=webflow-pre-login` - [x] Dismiss the dialog that is still showing, and verify there is not a further cancellation pixel in logs for when the dialog closes, as this is already covered by the ✖️ button cancellation - [x] Launch the import flow again. This time tap on the `Sign in` button. Then ✖️ to exit the flow; verify `autofill_import_google_passwords_result_user_cancelled` with `stage=webflow-authenticate` - [x] Launch the import flow again. This time, actually sign in, then ✖️ to exit the flow; verify `autofill_import_google_passwords_result_user_cancelled` with `stage=webflow-post-login-landing` - [x] Launch the import flow again, and you'll be on the screen with the export button. tap ✖️ to exit the flow; verify `autofill_import_google_passwords_result_user_cancelled` with `stage=webflow-export` - [x] Launch the import flow again. Tap the export button, and agree on the dialog. Then when prompted to authenticate, tap ✖️ to exit the flow; verify `autofill_import_google_passwords_result_user_cancelled` with `stage=webflow-authenticate` **Succeeding** - [x] Launch the import flow and fully complete it. Verify `autofill_import_google_passwords_result_success`, with the correct _bucket_ for `saved_credentials` and `skipped_credentials` based on bucket rules [defined here](https://app.asana.com/0/72649045549333/1207437778421216/f) - [x] Repeat that, and you should get duplicates this time. Verify again, ensuring that `skipped_credentials` bucket is accurate. **Overflow menu** - [x] Now that you have saved passwords, `Import Passwords From Google` will appear in the overflow menu. Tap on that. Verify `autofill_import_google_passwords_overflow_menu_tapped` and `autofill_import_google_passwords_preimport_prompt_displayed` in logs **Encrypted passphrase scenario** - [x] Apply [patch](https://app.asana.com/0/488551667048375/1208796814221367/f) - [x] Launch import flow and you'll see the error screen. Tap ✖️ to exit flow. Verify `autofill_import_google_passwords_result_user_cancelled` with `stage=webflow-passphrase-encryption` **CSV parsing scenario** - [x] Discard local changes - [x] Apply [patch](https://app.asana.com/0/488551667048375/1208796814221368/f) - [x] Launch import flow and carry on until you've exported. The patch will simulate an error. Verify `autofill_import_google_passwords_result_parsing` in logs. **URL mapping via remote config** - [x] Discard local changes - [x] Apply [patch](https://app.asana.com/0/488551667048375/1208799215631036/f) to override the URL mappings - [x] Fresh install. Launch password import flow and then ✖️ to exit. Verify in logs with filter `urlMappings` that the mappings from the patched jsonblob are used and override the local defaults. **Selectively disabling JS injection** - [x] Discard local changes - [x] Apply [patch](https://app.asana.com/0/488551667048375/1208799215631037/f) which simulates disabling remote config for JS injection specifically. - [x] Fresh install - [x] Launch password import flow; verify you don't see any UI hints on which button to press - [x] Complete the flow; verify it still works as expected
- Loading branch information
Showing
19 changed files
with
397 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...om/duckduckgo/autofill/impl/importing/gpm/webflow/ImportGooglePasswordUrlToStageMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2024 DuckDuckGo | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.duckduckgo.autofill.impl.importing.gpm.webflow | ||
|
||
import com.duckduckgo.autofill.impl.importing.gpm.feature.AutofillImportPasswordConfigStore | ||
import com.duckduckgo.di.scopes.FragmentScope | ||
import com.squareup.anvil.annotations.ContributesBinding | ||
import javax.inject.Inject | ||
import timber.log.Timber | ||
|
||
interface ImportGooglePasswordUrlToStageMapper { | ||
suspend fun getStage(url: String?): String | ||
} | ||
|
||
@ContributesBinding(FragmentScope::class) | ||
class ImportGooglePasswordUrlToStageMapperImpl @Inject constructor( | ||
private val importPasswordConfigStore: AutofillImportPasswordConfigStore, | ||
) : ImportGooglePasswordUrlToStageMapper { | ||
|
||
override suspend fun getStage(url: String?): String { | ||
val config = importPasswordConfigStore.getConfig() | ||
val stage = config.urlMappings.firstOrNull { url?.startsWith(it.url) == true }?.key ?: UNKNOWN | ||
return stage.also { Timber.d("Mapped as stage $it for $url") } | ||
} | ||
|
||
companion object { | ||
const val UNKNOWN = "webflow-unknown" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.