Skip to content

Commit

Permalink
Send pixel on sync secure storage read failure (#3530)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1201493110486074/1208686320819590/f

**Description**:

On investigating a hard-to-reproduce issue with sync, I noticed there's
a gap in error reporting when the secure storage (keychain) is not
available. This adds a pixel for that case.

**Steps to test this PR**:
Just a pixel in an error case. Hard to test without altering code. But
if you do want to do that:
1. Enable sync
2. Change `BSK.DDGSync.SecureStorage.account()` to throw every time
3. Go to the Settings -> Sync screen
4. You should see the `sync_secure_storage_read_error` Pixel in the
debug console

**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 5, 2024
1 parent b1cb778 commit 66c516a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ extension Pixel {
case syncRemoveDeviceError
case syncDeleteAccountError
case syncLoginExistingAccountError
case syncSecureStorageReadError

case syncGetOtherDevices
case syncGetOtherDevicesCopy
Expand Down Expand Up @@ -1432,6 +1433,7 @@ extension Pixel.Event {
case .syncRemoveDeviceError: return "m_d_sync_remove_device_error"
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 .syncGetOtherDevices: return "sync_get_other_devices"
case .syncGetOtherDevicesCopy: return "sync_get_other_devices_copy"
Expand Down
2 changes: 2 additions & 0 deletions Core/SyncErrorHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public class SyncErrorHandler: EventMapping<SyncError> {
Pixel.fire(pixel: .syncFailedToLoadAccount, error: error)
case .failedToSetupEngine:
Pixel.fire(pixel: .syncFailedToSetupEngine, error: error)
case .failedToReadSecureStore:
Pixel.fire(pixel: .syncSecureStorageReadError, 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 @@ -10970,7 +10970,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 203.1.0;
version = 203.2.0;
};
};
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "19f1e5c945aa92562ad2d087e8d6c99801edf656",
"version" : "203.1.0"
"revision" : "56dbee74e34d37b6e699921a0b9bce2b8f22711d",
"version" : "203.2.0"
}
},
{
Expand Down

0 comments on commit 66c516a

Please sign in to comment.