Skip to content

Commit

Permalink
Sync: Send pixels for account removal + decoding issues (#3557)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1201493110486074/1208723035104886/f
Tech Design URL:
CC:

**Description**:

Adds sync pixels for catching when the keychain read throws a decoding
error and when the account is deleted for various reasons

**Steps to test this PR**:
1. Make sure you've already activated sync.
2. Deactivate sync (either delete the server data or just turn it off)
3. You should see the `sync_account_removed_reason_user-turned-off`
pixel in the console.

<!--
Before submitting a PR, please ensure you have tested the combinations
you expect the reviewer to test, then delete configurations you *know*
do not need explicit testing.

Using a simulator where a physical device is unavailable is acceptable.
-->

**Definition of Done (Internal Only)**:

* [ ] Does this PR satisfy our [Definition of
Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)?

**Copy Testing**:

* [ ] Use of correct apostrophes in new copy, ie `’` rather than `'`

**Orientation Testing**:

* [ ] Portrait
* [ ] Landscape

**Device Testing**:

* [ ] iPhone SE (1st Gen)
* [ ] iPhone 8
* [ ] iPhone X
* [ ] iPhone 14 Pro
* [ ] iPad

**OS Testing**:

* [ ] iOS 15
* [ ] iOS 16
* [ ] iOS 17

**Theme Testing**:

* [ ] Light theme
* [ ] Dark theme

---
###### Internal references:
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)
  • Loading branch information
graeme authored Nov 11, 2024
1 parent becebe9 commit e6e1ec3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ extension Pixel {
case syncDeleteAccountError
case syncLoginExistingAccountError
case syncSecureStorageReadError
case syncSecureStorageDecodingError
case syncAccountRemoved(reason: String)

case syncGetOtherDevices
case syncGetOtherDevicesCopy
Expand Down Expand Up @@ -1457,6 +1459,8 @@ extension Pixel.Event {
case .syncDeleteAccountError: return "m_d_sync_delete_account_error"
case .syncLoginExistingAccountError: return "m_d_sync_login_existing_account_error"
case .syncSecureStorageReadError: return "m_d_sync_secure_storage_error"
case .syncSecureStorageDecodingError: return "sync_secure_storage_decoding_error"
case .syncAccountRemoved(let reason): return "sync_account_removed_reason_\(reason)"

case .syncGetOtherDevices: return "sync_get_other_devices"
case .syncGetOtherDevicesCopy: return "sync_get_other_devices_copy"
Expand Down
4 changes: 4 additions & 0 deletions Core/SyncErrorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public class SyncErrorHandler: EventMapping<SyncError> {
Pixel.fire(pixel: .syncFailedToSetupEngine, error: error)
case .failedToReadSecureStore:
Pixel.fire(pixel: .syncSecureStorageReadError, error: error)
case .failedToDecodeSecureStoreData(let error):
Pixel.fire(pixel: .syncSecureStorageDecodingError, error: error)
case .accountRemoved(let reason):
Pixel.fire(pixel: .syncAccountRemoved(reason: reason.rawValue), error: error)
default:
// Should this be so generic?
let domainEvent = Pixel.Event.syncSentUnauthenticatedRequest
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10980,7 +10980,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 208.0.0;
version = 208.1.0;
};
};
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "17154907fe86c75942331ed6d037694c666ddd95",
"version" : "208.0.0"
"revision" : "6be781530a2516c703b8e1bcf0c90e6e763d3300",
"version" : "208.1.0"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "1733ee59f06f6e725a98cf6cd8322159f59d664b",
"version" : "6.31.0"
"revision" : "adca39c379b1a124f9990e9d0308c374f32f5018",
"version" : "6.32.0"
}
},
{
Expand Down

0 comments on commit e6e1ec3

Please sign in to comment.