Skip to content

Commit

Permalink
Merge branch 'release/7.89.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
amddg44 committed Sep 12, 2023
2 parents cf70add + d7f6c65 commit 525afda
Show file tree
Hide file tree
Showing 28 changed files with 1,342 additions and 470 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ jobs:
with:
report_paths: unittests.xml

- name: Update Asana with failed unit tests
if: always() # always run even if the previous step fails
env:
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
# Extract failed tests from the junit report
# Only keep failures unique by classname and name (column 1 and 2 of the yq output)
yq < unittests.xml -p xml -o json -r \
$'[.testsuites.testsuite[].testcase] | flatten | map(select(.failure) | .+@classname + " " + .+@name + " \'" + .failure.+@message + "\' ${{ env.WORKFLOW_URL }}") | .[]' \
| sort -u -k 1,2 \
| xargs -L 1 ./scripts/report-failed-unit-test.sh -s ${{ vars.APPLE_CI_FAILING_TESTS_FAILED_TESTS_SECTION_ID }}
release-build:

name: Make Release Build
Expand Down Expand Up @@ -181,4 +194,4 @@ jobs:
asana-section: ${{ vars.APPLE_CI_FAILING_TESTS_IOS_POST_MERGE_SECTION_ID }}
asana-task-name: 'PR Check is failing on develop'
action: create-asana-task
asana-task-description: PR Checks conducted after merging have failed. See ${{ env.WORKFLOW_URL }}
asana-task-description: PR Checks conducted after merging have failed. See ${{ env.WORKFLOW_URL }}. Follow the steps on https://app.asana.com/0/1202500774821704/1205317064731691 to resolve this issue.
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 7.88.1
MARKETING_VERSION = 7.89.0
4 changes: 2 additions & 2 deletions Core/AppPrivacyConfigurationDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import BrowserServicesKit
final public class AppPrivacyConfigurationDataProvider: EmbeddedDataProvider {

public struct Constants {
public static let embeddedDataETag = "\"b3acf772994c82ed870835c27a94de36\""
public static let embeddedDataSHA = "955ebdcac92bf5589e34e174e9cb8bcbe5170c9bbb5f6d0b4fa32290368a22b2"
public static let embeddedDataETag = "\"357f365c05692d9674849261a9a91f71\""
public static let embeddedDataSHA = "cfa6f910f8d50b88d44a149f0e007bc8fd88b8b3b390ae013618599794d2c077"
}

public var embeddedDataEtag: String {
Expand Down
19 changes: 5 additions & 14 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,6 @@ extension Pixel {
case remoteMessageSecondaryActionClicked
case remoteMessageSheet

// MARK: Lock Screen widgets
case lockScreenWidgetNewSearch
case lockScreenWidgetFavorites
case lockScreenWidgetFireButton
case lockScreenWidgetVoiceSearch
case lockScreenWidgetNewEmail

// MARK: Set as Default
case onboardingSetDefaultOpened
case onboardingSetDefaultSkipped
Expand Down Expand Up @@ -431,6 +424,8 @@ extension Pixel {
case syncBookmarksFailed
case syncCredentialsProviderInitializationFailed
case syncCredentialsFailed
case syncSettingsFailed
case syncSettingsMetadataUpdateFailed

case bookmarksCleanupFailed
case bookmarksCleanupAttemptedWhileSyncWasEnabled
Expand Down Expand Up @@ -739,13 +734,6 @@ extension Pixel.Event {
case .remoteMessageSecondaryActionClicked: return "m_remote_message_secondary_action_clicked"
case .remoteMessageSheet: return "m_remote_message_sheet"

// MARK: Lock Screen Widgets
case .lockScreenWidgetNewSearch: return "m_lockscreen_newsearch"
case .lockScreenWidgetFavorites: return "m_lockscreen_favorites"
case .lockScreenWidgetFireButton: return "m_lockscreen_fire"
case .lockScreenWidgetVoiceSearch: return "m_lockscreen_voicesearch"
case .lockScreenWidgetNewEmail: return "m_lockscreen_newemail"

// MARK: Set as default measuring
case .onboardingSetDefaultOpened: return "m_onboarding_set-default-opened"
case .onboardingSetDefaultSkipped: return "m_onboarding_set-default-skipped"
Expand Down Expand Up @@ -870,6 +858,9 @@ extension Pixel.Event {
case .syncBookmarksFailed: return "m_d_sync_bookmarks_failed"
case .syncCredentialsProviderInitializationFailed: return "m_d_sync_credentials_provider_initialization_failed"
case .syncCredentialsFailed: return "m_d_sync_credentials_failed"
case .syncSettingsFailed: return "m_d_sync_settings_failed"
case .syncSettingsMetadataUpdateFailed: return "m_d_sync_settings_metadata_update_failed"


case .bookmarksCleanupFailed: return "m_d_bookmarks_cleanup_failed"
case .bookmarksCleanupAttemptedWhileSyncWasEnabled: return "m_d_bookmarks_cleanup_attempted_while_sync_was_enabled"
Expand Down
50 changes: 23 additions & 27 deletions Core/SyncBookmarksAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,32 @@ public final class SyncBookmarksAdapter {
guard provider == nil else {
return
}
do {
let provider = try BookmarksProvider(
database: database,
metadataStore: metadataStore,
syncDidUpdateData: { [syncDidCompleteSubject] in
syncDidCompleteSubject.send()
}
)

syncErrorCancellable = provider.syncErrorPublisher
.sink { error in
switch error {
case let syncError as SyncError:
Pixel.fire(pixel: .syncBookmarksFailed, error: syncError)
default:
let nsError = error as NSError
if nsError.domain != NSURLErrorDomain {
let processedErrors = CoreDataErrorsParser.parse(error: error as NSError)
let params = processedErrors.errorPixelParameters
Pixel.fire(pixel: .syncBookmarksFailed, error: error, withAdditionalParameters: params)
}
let provider = BookmarksProvider(
database: database,
metadataStore: metadataStore,
syncDidUpdateData: { [syncDidCompleteSubject] in
syncDidCompleteSubject.send()
}
)

syncErrorCancellable = provider.syncErrorPublisher
.sink { error in
switch error {
case let syncError as SyncError:
Pixel.fire(pixel: .syncBookmarksFailed, error: syncError)
default:
let nsError = error as NSError
if nsError.domain != NSURLErrorDomain {
let processedErrors = CoreDataErrorsParser.parse(error: error as NSError)
let params = processedErrors.errorPixelParameters
Pixel.fire(pixel: .syncBookmarksFailed, error: error, withAdditionalParameters: params)
}
os_log(.error, log: OSLog.syncLog, "Bookmarks Sync error: %{public}s", String(reflecting: error))
}
self.provider = provider
} catch let error as NSError {
let processedErrors = CoreDataErrorsParser.parse(error: error)
let params = processedErrors.errorPixelParameters
Pixel.fire(pixel: .syncBookmarksProviderInitializationFailed, error: error, withAdditionalParameters: params)
}
os_log(.error, log: OSLog.syncLog, "Bookmarks Sync error: %{public}s", String(reflecting: error))
}

self.provider = provider
}

private var syncDidCompleteSubject = PassthroughSubject<Void, Never>()
Expand Down
6 changes: 5 additions & 1 deletion Core/SyncDataProviders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import SyncDataProviders
public class SyncDataProviders: DataProvidersSource {
public let bookmarksAdapter: SyncBookmarksAdapter
public let credentialsAdapter: SyncCredentialsAdapter
public let settingsAdapter: SyncSettingsAdapter

public func makeDataProviders() -> [DataProviding] {
initializeMetadataDatabaseIfNeeded()
Expand All @@ -38,10 +39,12 @@ public class SyncDataProviders: DataProvidersSource {

bookmarksAdapter.setUpProviderIfNeeded(database: bookmarksDatabase, metadataStore: syncMetadata)
credentialsAdapter.setUpProviderIfNeeded(secureVaultFactory: secureVaultFactory, metadataStore: syncMetadata)
settingsAdapter.setUpProviderIfNeeded(metadataDatabase: syncMetadataDatabase, metadataStore: syncMetadata)

let providers: [Any] = [
bookmarksAdapter.provider as Any,
credentialsAdapter.provider as Any
credentialsAdapter.provider as Any,
settingsAdapter.provider as Any
]

return providers.compactMap { $0 as? DataProviding }
Expand Down Expand Up @@ -88,6 +91,7 @@ public class SyncDataProviders: DataProvidersSource {
self.secureVaultErrorReporter = secureVaultErrorReporter
bookmarksAdapter = SyncBookmarksAdapter(database: bookmarksDatabase)
credentialsAdapter = SyncCredentialsAdapter(secureVaultFactory: secureVaultFactory, secureVaultErrorReporter: secureVaultErrorReporter)
settingsAdapter = SyncSettingsAdapter()
}

private func initializeMetadataDatabaseIfNeeded() {
Expand Down
82 changes: 82 additions & 0 deletions Core/SyncSettingsAdapter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// SyncSettingsAdapter.swift
// DuckDuckGo
//
// Copyright © 2023 DuckDuckGo. All rights reserved.
//
// 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.
//

import BrowserServicesKit
import Combine
import Common
import DDGSync
import Persistence
import SyncDataProviders

public final class SyncSettingsAdapter {

public private(set) var provider: SettingsProvider?
public private(set) var emailManager: EmailManager?
public let syncDidCompletePublisher: AnyPublisher<Void, Never>

public init() {
syncDidCompletePublisher = syncDidCompleteSubject.eraseToAnyPublisher()
}

public func updateDatabaseCleanupSchedule(shouldEnable: Bool) {
}

public func setUpProviderIfNeeded(metadataDatabase: CoreDataDatabase, metadataStore: SyncMetadataStore) {
guard provider == nil else {
return
}
let emailManager = EmailManager()

let provider = SettingsProvider(
metadataDatabase: metadataDatabase,
metadataStore: metadataStore,
emailManager: emailManager,
syncDidUpdateData: { [weak self] in
self?.syncDidCompleteSubject.send()
}
)

syncErrorCancellable = provider.syncErrorPublisher
.sink { error in
switch error {
case let syncError as SyncError:
Pixel.fire(pixel: .syncSettingsFailed, error: syncError)
case let settingsMetadataError as SettingsSyncMetadataSaveError:
let underlyingError = settingsMetadataError.underlyingError
let processedErrors = CoreDataErrorsParser.parse(error: underlyingError as NSError)
let params = processedErrors.errorPixelParameters
Pixel.fire(pixel: .syncSettingsMetadataUpdateFailed, error: underlyingError, withAdditionalParameters: params)
default:
let nsError = error as NSError
if nsError.domain != NSURLErrorDomain {
let processedErrors = CoreDataErrorsParser.parse(error: error as NSError)
let params = processedErrors.errorPixelParameters
Pixel.fire(pixel: .syncSettingsFailed, error: error, withAdditionalParameters: params)
}
}
os_log(.error, log: OSLog.syncLog, "Settings Sync error: %{public}s", String(reflecting: error))
}

self.provider = provider
self.emailManager = emailManager
}

private var syncDidCompleteSubject = PassthroughSubject<Void, Never>()
private var syncErrorCancellable: AnyCancellable?
}
Loading

0 comments on commit 525afda

Please sign in to comment.