Skip to content

Commit

Permalink
Merge branch 'main' into dominik/sync-feature-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Dec 20, 2023
2 parents f959dbb + 0d613be commit f505c52
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .maestro/shared/add_login_from_settings.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
appId: com.duckduckgo.mobile.ios
---

- tapOn: Logins
- tapOn: Passwords
- tapOn: Add 24
- tapOn: Title
- inputText: My Personal Website
Expand All @@ -10,6 +10,6 @@ appId: com.duckduckgo.mobile.ios
- tapOn: example.com
- inputText: mypersonalwebsite.com
- tapOn: Save
- tapOn: Logins
- tapOn: Passwords
- tapOn: Settings
- tapOn: Done
7 changes: 3 additions & 4 deletions .maestro/shared/remove_local_logins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ appId: com.duckduckgo.mobile.ios
---

- tapOn: Settings
- tapOn: Logins
- assertVisible: Unlock device to access saved Logins
- tapOn: Passwords
- tapOn: Passcode field
- inputText: "0000"
- pressKey: Enter
- tapOn: My Personal Website
- tapOn: Delete Login
- tapOn: Delete Login
- tapOn: Delete Password
- tapOn: Delete Password
- tapOn: Settings
- tapOn: Done
13 changes: 6 additions & 7 deletions .maestro/shared/sync_verify_logins.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
appId: com.duckduckgo.mobile.ios
---

- tapOn: Logins
- assertVisible: Unlock device to access saved Logins
- tapOn: Passwords
- tapOn: Passcode field
- inputText: "0000"
- pressKey: Enter
- assertVisible: Dax Login
- tapOn: Dax Login
- assertVisible: daxthetest
- assertVisible: duckduckgo.com
- tapOn: Logins
- tapOn: Passwords
- assertVisible: Github
- tapOn: Github
- assertVisible: githubusername
- assertVisible: github.com
- tapOn: Logins
- tapOn: Passwords
- assertVisible: StackOverflow
- tapOn: StackOverflow
- assertVisible: stacker
- assertVisible: stackoverflow.com
- tapOn: Logins
- tapOn: Passwords
- assertVisible: My Personal Website
- tapOn: My Personal Website
- assertVisible: [email protected]
- assertVisible: mypersonalwebsite.com
- tapOn: Logins
- tapOn: Settings
- tapOn: Passwords
- tapOn: Settings
39 changes: 39 additions & 0 deletions .maestro/sync_tests/05_delete_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
appId: com.duckduckgo.mobile.ios
tags:
- sync

---

# Clear and launch
- clearState
- launchApp

# Run onboarding Flow
- runFlow:
when:
visible:
text: "Let’s Do It!"
index: 0
file: ../shared/onboarding.yaml

# Set Internal User
- tapOn: Settings
- runFlow:
file: ../shared/set_internal_user_from_settings.yaml

# Create account
- runFlow:
file: ../shared/sync_create.yaml

# Remove account
- runFlow:
file: ../shared/sync_delete.yaml

# Try to login and check for error
- assertVisible: Begin Syncing
- tapOn: Sync with Another Device
- assertVisible: Scan QR Code
- tapOn: Manually Enter Code
- tapOn: Paste
- assertVisible: Sync Error
- tapOn: OK
15 changes: 0 additions & 15 deletions .maestro/sync_tests/add_login_from_settings.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions Core/BookmarksModelsErrorHandling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public class BookmarksModelsErrorHandling: EventMapping<BookmarksModelError> {

case .missingParent(let object):
domainEvent = .missingParent(object)
case .orphanedBookmarksPresent:
if let syncService, syncService.authState == .inactive {
domainEvent = .orphanedBookmarksPresent
}
}

if let domainEvent {
Expand Down
6 changes: 5 additions & 1 deletion Core/DailyPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ public final class DailyPixel {
/// Does not append any suffix unlike the alternative function below
public static func fire(pixel: Pixel.Event,
withAdditionalParameters params: [String: String] = [:],
includedParameters: [Pixel.QueryParameters] = [.atb, .appVersion],
onComplete: @escaping (Swift.Error?) -> Void = { _ in }) {

if !pixel.hasBeenFiredToday(dailyPixelStorage: storage) {
Pixel.fire(pixel: pixel, withAdditionalParameters: params, onComplete: onComplete)
Pixel.fire(pixel: pixel,
withAdditionalParameters: params,
includedParameters: includedParameters,
onComplete: onComplete)
updatePixelLastFireDate(pixel: pixel)
} else {
onComplete(Error.alreadyFired)
Expand Down
2 changes: 0 additions & 2 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ extension Pixel {
case indexOutOfRange(BookmarksModelError.ModelType)
case saveFailed(BookmarksModelError.ModelType)
case missingParent(BookmarksModelError.ObjectType)
case orphanedBookmarksPresent

case bookmarksCouldNotLoadDatabase
case bookmarksCouldNotPrepareDatabase
Expand Down Expand Up @@ -1036,7 +1035,6 @@ extension Pixel.Event {
case .indexOutOfRange(let modelType): return "m_d_bookmarks_index_out_of_range_\(modelType.rawValue)"
case .saveFailed(let modelType): return "m_d_bookmarks_view_model_save_failed_\(modelType.rawValue)"
case .missingParent(let objectType): return "m_d_bookmark_model_missing_parent_\(objectType.rawValue)"
case .orphanedBookmarksPresent: return "m_d_bookmarks_orphans_present"

case .bookmarksCouldNotLoadDatabase: return "m_d_bookmarks_could_not_load_database"
case .bookmarksCouldNotPrepareDatabase: return "m_d_bookmarks_could_not_prepare_database"
Expand Down
4 changes: 2 additions & 2 deletions Core/SyncMetricsEventsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class SyncMetricsEventsHandler: EventMapping<MetricsEvent> {
super.init { event, _, _, _ in
switch event {
case .overrideEmailProtectionSettings:
Pixel.fire(pixel: .syncDuckAddressOverride)
Pixel.fire(pixel: .syncDuckAddressOverride, includedParameters: [.appVersion])
case .localTimestampResolutionTriggered(let feature):
Pixel.fire(pixel: .syncLocalTimestampResolutionTriggered(feature))
Pixel.fire(pixel: .syncLocalTimestampResolutionTriggered(feature), includedParameters: [.appVersion])
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9220,8 +9220,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
branch = "dominik/sync-feature-flags";
kind = branch;
kind = exactVersion;
version = 97.0.0;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"branch" : "dominik/sync-feature-flags",
"revision" : "1c8fa640dd55a9a4d4d4acc433c96cb226448eea"
"revision" : "d671accf1bf7097c4e7f5cd55cd1c6dfa005cf92",
"version" : "97.0.0"
}
},
{
Expand Down
10 changes: 7 additions & 3 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

isSyncInProgressCancellable = syncService.isSyncInProgressPublisher
.filter { $0 }
.prefix(1)
.sink { _ in
DailyPixel.fire(pixel: .syncDaily)
.sink { [weak syncService] _ in
DailyPixel.fire(pixel: .syncDaily, includedParameters: [.appVersion])
syncService?.syncDailyStats.sendStatsIfNeeded(handler: { params in
Pixel.fire(pixel: .syncSuccessRateDaily,
withAdditionalParameters: params,
includedParameters: [.appVersion])
})
}

#if APP_TRACKING_PROTECTION
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extension SyncSettingsViewController: SyncManagementViewModelDelegate {
self.dismissPresentedViewController()
self.showPreparingSync()
try await syncService.createAccount(deviceName: deviceName, deviceType: deviceType)
Pixel.fire(pixel: .syncSignupDirect)
Pixel.fire(pixel: .syncSignupDirect, includedParameters: [.appVersion])
self.rootView.model.syncEnabled(recoveryCode: recoveryCode)
self.refreshDevices()
navigationController?.topViewController?.dismiss(animated: true, completion: showRecoveryPDF)
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/SyncSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ extension SyncSettingsViewController: ScanOrPasteCodeViewModelDelegate {
func loginAndShowDeviceConnected(recoveryKey: SyncCode.RecoveryKey) async throws {
let registeredDevices = try await syncService.login(recoveryKey, deviceName: deviceName, deviceType: deviceType)
mapDevices(registeredDevices)
Pixel.fire(pixel: .syncLogin)
Pixel.fire(pixel: .syncLogin, includedParameters: [.appVersion])
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.dismissVCAndShowRecoveryPDF()
}
Expand Down Expand Up @@ -295,7 +295,7 @@ extension SyncSettingsViewController: ScanOrPasteCodeViewModelDelegate {
showPreparingSync()
if syncService.account == nil {
try await syncService.createAccount(deviceName: deviceName, deviceType: deviceType)
Pixel.fire(pixel: .syncSignupConnect)
Pixel.fire(pixel: .syncSignupConnect, includedParameters: [.appVersion])
self.dismissVCAndShowRecoveryPDF()
shouldShowSyncEnabled = false
rootView.model.syncEnabled(recoveryCode: recoveryCode)
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DuckUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
targets: ["DuckUI"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "95.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "97.0.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SyncUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
],
dependencies: [
.package(path: "../DuckUI"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "95.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "97.0.0"),
.package(url: "https://github.com/duckduckgo/DesignResourcesKit", exact: "2.0.0")
],
targets: [
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/Waitlist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
targets: ["Waitlist", "WaitlistMocks"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "95.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "97.0.0"),
.package(url: "https://github.com/duckduckgo/DesignResourcesKit", exact: "2.0.0")
],
targets: [
Expand Down

0 comments on commit f505c52

Please sign in to comment.