Skip to content

Commit

Permalink
Merge branch 'release/7.82.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
amddg44 committed Jul 28, 2023
2 parents 7cd7051 + aefb9c1 commit 65c4d3a
Show file tree
Hide file tree
Showing 84 changed files with 1,990 additions and 521 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ disabled_rules:
- orphaned_doc_comment
- todo
- unused_capture_list
- trailing_comma

opt_in_rules:
- closure_end_indentation
Expand Down
54 changes: 54 additions & 0 deletions Core/AppDeepLinkSchemes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// AppDeepLinkSchemes.swift
// DuckDuckGo
//
// Copyright © 2017 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 Foundation

public enum AppDeepLinkSchemes: String, CaseIterable {

case newSearch = "ddgNewSearch"
case voiceSearch = "ddgVoiceSearch"
case fireButton = "ddgFireButton"
case favorites = "ddgFavorites"
case newEmail = "ddgNewEmail"

case quickLink = "ddgQuickLink"

case addFavorite = "ddgAddFavorite"

public var url: URL {
URL(string: rawValue + "://")!
}

public func appending(_ string: String) -> String {
"\(rawValue)://\(string)"
}

public static func fromURL(_ url: URL) -> AppDeepLinkSchemes? {
guard let scheme = url.scheme else { return nil }
return allCases.first(where: { $0.rawValue.lowercased() == scheme.lowercased() })
}

public static func query(fromQuickLink url: URL) -> String {
return url.absoluteString
.replacingOccurrences(of: AppDeepLinkSchemes.quickLink.url.absoluteString,
with: "",
options: .caseInsensitive)
}

}
74 changes: 0 additions & 74 deletions Core/AppDeepLinks.swift

This file was deleted.

3 changes: 2 additions & 1 deletion Core/AppURLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public extension URL {

static let autocomplete = URL(string: "\(base)/ac/")!
static let emailProtection = URL(string: "\(base)/email")!
static let emailProtectionQuickLink = URL(string: "ddgQuickLink://\(base)/email")!
static let emailProtectionQuickLink = URL(string: AppDeepLinkSchemes.quickLink.appending("\(ddg.host!)/email"))!
static let aboutLink = URL(string: AppDeepLinkSchemes.quickLink.appending("\(ddg.host!)/about"))!

static let surrogates = URL(string: "\(staticBase)/surrogates.txt")!
static let privacyConfig = URL(string: "\(staticBase)/trackerblocking/config/v2/ios-config.json")!
Expand Down
6 changes: 5 additions & 1 deletion Core/ContentBlocking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,19 @@ public final class ContentBlocking {
}

private let attributionEvents = EventMapping<AdClickAttributionEvents> { event, _, parameters, _ in
var shouldIncludeAppVersion = true
let domainEvent: Pixel.Event
switch event {
case .adAttributionDetected:
domainEvent = .adClickAttributionDetected
case .adAttributionActive:
domainEvent = .adClickAttributionActive
case .adAttributionPageLoads:
domainEvent = .adClickAttributionPageLoads
shouldIncludeAppVersion = false
}

Pixel.fire(pixel: domainEvent, withAdditionalParameters: parameters ?? [:], includedParameters: [.appVersion])
Pixel.fire(pixel: domainEvent, withAdditionalParameters: parameters ?? [:], includedParameters: shouldIncludeAppVersion ? [.appVersion] : [])
}

private let attributionDebugEvents = EventMapping<AdClickAttributionDebugEvents> { event, _, _, _ in
Expand Down
12 changes: 3 additions & 9 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ extension Pixel {
public enum Event {

case appLaunch
case defaultBrowserLaunch
case refreshPressed

case forgetAllPressedBrowsing
Expand Down Expand Up @@ -142,10 +141,7 @@ extension Pixel {
case daxDialogsAutoconsentShown
case daxDialogsAutoconsentConfirmed
case daxDialogsAutoconsentCancelled

case widgetFavoriteLaunch
case widgetNewSearch


case defaultBrowserButtonPressedSettings

case widgetsOnboardingCTAPressed
Expand Down Expand Up @@ -263,6 +259,7 @@ extension Pixel {

case adClickAttributionDetected
case adClickAttributionActive
case adClickAttributionPageLoads

// MARK: SERP pixels

Expand Down Expand Up @@ -435,7 +432,6 @@ extension Pixel.Event {
public var name: String {
switch self {
case .appLaunch: return "ml"
case .defaultBrowserLaunch: return "m_dl"
case .refreshPressed: return "m_r"

case .forgetAllPressedBrowsing: return "mf_bp"
Expand Down Expand Up @@ -550,9 +546,6 @@ extension Pixel.Event {
case .daxDialogsAutoconsentConfirmed: return "m_dax_dialog_autoconsent_confirmed"
case .daxDialogsAutoconsentCancelled: return "m_dax_dialog_autoconsent_cancelled"

case .widgetFavoriteLaunch: return "m_w_fl"
case .widgetNewSearch: return "m_w_ns"

case .defaultBrowserButtonPressedSettings: return "m_db_s"

case .widgetsOnboardingCTAPressed: return "m_o_w_a"
Expand Down Expand Up @@ -676,6 +669,7 @@ extension Pixel.Event {

case .adClickAttributionDetected: return "m_ad_click_detected"
case .adClickAttributionActive: return "m_ad_click_active"
case .adClickAttributionPageLoads: return "m_pageloads_with_ad_attribution"

// MARK: SERP pixels

Expand Down
7 changes: 6 additions & 1 deletion Core/SyncBookmarksAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ import DDGSync
import Foundation
import Persistence
import SyncDataProviders
import WidgetKit

public final class SyncBookmarksAdapter {

public private(set) var provider: BookmarksProvider?

public let syncDidCompletePublisher: AnyPublisher<Void, Never>
public let widgetRefreshCancellable: AnyCancellable

public init() {
syncDidCompletePublisher = syncDidCompleteSubject.eraseToAnyPublisher()
widgetRefreshCancellable = syncDidCompletePublisher.sink { _ in
WidgetCenter.shared.reloadAllTimelines()
}
}

public func setUpProviderIfNeeded(database: CoreDataDatabase, metadataStore: SyncMetadataStore) {
Expand All @@ -42,7 +47,7 @@ public final class SyncBookmarksAdapter {
let provider = try BookmarksProvider(
database: database,
metadataStore: metadataStore,
reloadBookmarksAfterSync: { [syncDidCompleteSubject] in
syncDidUpdateData: { [syncDidCompleteSubject] in
syncDidCompleteSubject.send()
}
)
Expand Down
Loading

0 comments on commit 65c4d3a

Please sign in to comment.