Skip to content

Commit

Permalink
Merge branch 'sam/vpn-ui-improvements-2-lottie-animation' into sam/vp…
Browse files Browse the repository at this point in the history
…n-ui-improvements-3-combine-notification-settings

* sam/vpn-ui-improvements-2-lottie-animation: (22 commits)
  Point to BSK hotfix (#2558)
  Prevent redeeming invite codes after the VPN test ends (#2559)
  Updates Kingfisher to 7.11.0 (#2545)
  Makes network path metadata description anonymous (#2544)
  Adds pixels to track main VPN funnels (#2543)
  Cleanup after rolling out autoconsent enabled by default (#2537)
  Add #URL macro (#2540)
  Handle expired entitlement in NetP (#2525)
  Remove isSubscriptionEnabled check when attempting to delete NetP token (#2548)
  Add dark mode animation.
  Allow the animation intro to be skipped
  Validate correct environment (#2546)
  Remove CGNAT range (#2524)
  Add preliminary support for subscription keychain sharing (#2538)
  fix opening tabs with transitional (#2542)
  Integrate confirm entitlements endpoint (#2541)
  Makes dbSaveBloomFilterError daily and count (#2526)
  16. Subscription: Display "Activation in progress" message (#2535)
  Autofill support for deleting all passwords  (#2497)
  Bump BrowserServicesKit (#2532)
  ...
  • Loading branch information
samsymons committed Mar 8, 2024
2 parents 17bd882 + 112b37e commit 70ec49d
Show file tree
Hide file tree
Showing 153 changed files with 5,406 additions and 574 deletions.
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 14,OS=16.4"
-skipPackagePluginValidation \
-skipMacroValidation \
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: End-to-End tests
on:
schedule:
- cron: '0 4 * * *' # run at 4 AM UTC
workflow_dispatch:

jobs:
end-to-end-tests:
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
ONLY_ACTIVE_ARCH=NO \
| tee xcodebuild.log
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml
Expand Down Expand Up @@ -89,6 +90,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml
- name: Publish unit tests report
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
DDG_SLOW_COMPILE_CHECK_THRESHOLD=250 \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename unittests.xml
Expand Down Expand Up @@ -188,6 +189,7 @@ jobs:
-derivedDataPath "DerivedData" \
-configuration "Release" \
-skipPackagePluginValidation \
-skipMacroValidation \
| xcbeautify
create-asana-task:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
-destination "platform=iOS Simulator,name=iPhone 15" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
ONLY_ACTIVE_ARCH=NO \
| tee xcodebuild.log
Expand Down
10 changes: 9 additions & 1 deletion .maestro/data_clearing_tests/02_duckduckgo_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ tags:
---

# Set up
- clearKeychain
- clearState
- launchApp
- runFlow:
- runFlow:
when:
visible:
text: "Let’s Do It!"
Expand All @@ -22,6 +23,13 @@ tags:
- inputText: "privacy blogs"
- pressKey: Enter

# Dismiss Dax Dialogs if visible
- runFlow:
when:
visible: "Phew!"
commands:
- tapOn: "Phew!"

# Change settings
- tapOn: "Safe search: moderate ▼"
- tapOn: "Off"
Expand Down
3 changes: 3 additions & 0 deletions Configuration/Configuration-Alpha.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ APP_ID = com.duckduckgo.mobile.ios.alpha

// A prefix for group ids. Must start with "group.".
GROUP_ID_PREFIX = group.com.duckduckgo.alpha

// The keychain access group for subscriptions
SUBSCRIPTION_APP_GROUP = com.duckduckgo.subscriptions.alpha
3 changes: 3 additions & 0 deletions Configuration/DuckDuckGoDeveloper.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ CODE_SIGN_STYLE = Manual

// The manually specified provisioning profile
PROVISIONING_PROFILE_SPECIFIER = Development - App

// The keychain access group for subscriptions
SUBSCRIPTION_APP_GROUP = com.duckduckgo.subscriptions
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 7.110.0
MARKETING_VERSION = 7.111.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Subscription.swift
// AccountManagerExtension.swift
// DuckDuckGo
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
Expand All @@ -17,8 +17,15 @@
// limitations under the License.
//

#if SUBSCRIPTION

import Foundation
import Subscription

struct Subscription: Encodable {
let token: String
public extension AccountManager {
convenience init() {
self.init(subscriptionAppGroup: Bundle.main.appGroup(bundle: .subs))
}
}

#endif
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 = "\"20ceae04600e9d3c46898ac4471fcd70\""
public static let embeddedDataSHA = "987f63a393724a34fe9d190c335f14b58398d2e9e02ccf38b84a7bd57c37b8ab"
public static let embeddedDataETag = "\"a427a69043b2baa27604bc10edb13de1\""
public static let embeddedDataSHA = "1d5c2e4113713fbf02bc617fc689981604ea53be172569a9fd744054b7355c39"
}

public var embeddedDataEtag: String {
Expand Down
5 changes: 3 additions & 2 deletions Core/AppURLs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
// limitations under the License.
//

import Foundation
import BrowserServicesKit
import Foundation
import Macros

public extension URL {

Expand Down Expand Up @@ -48,7 +49,7 @@ public extension URL {
static let exti = URL(string: "\(base)/exti/\(devMode)")!
static let feedback = URL(string: "\(base)/feedback.js?type=app-feedback")!

static let appStore = URL(string: "https://apps.apple.com/app/duckduckgo-privacy-browser/id663592361")!
static let appStore = #URL("https://apps.apple.com/app/duckduckgo-privacy-browser/id663592361")

static let mac = URL(string: "\(base)/mac")!
static let windows = URL(string: "\(base)/windows")!
Expand Down
7 changes: 4 additions & 3 deletions Core/BookmarksImporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
// limitations under the License.
//

import Bookmarks
import Common
import Foundation
import SwiftSoup
import Bookmarks
import Macros
import Persistence
import SwiftSoup

public enum BookmarksImportError: Error {
case invalidHtmlNoDLTag
Expand Down Expand Up @@ -217,7 +218,7 @@ final public class BookmarksImporter {
static let FavoritesFolder = "DuckDuckGo Favorites"
static let BookmarksFolder = "DuckDuckGo Bookmarks"
static let bookmarkURLString = "https://duckduckgo.com"
static let bookmarkURL = URL(string: "https://duckduckgo.com")!
static let bookmarkURL = #URL("https://duckduckgo.com")
static let favoriteAttribute = "duckduckgo:favorite"
static let isFavorite = "true"
static let idAttribute = "id"
Expand Down
40 changes: 40 additions & 0 deletions Core/BundleExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// BundleExtension.swift
// DuckDuckGo
//
// Copyright © 2024 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

extension Bundle {
public func appGroup(bundle: BundleGroup) -> String {
var appGroupName: String

switch bundle {
case .subs:
appGroupName = "SUBSCRIPTION_APP_GROUP"
}

guard let appGroup = object(forInfoDictionaryKey: appGroupName) as? String else {
fatalError("Info.plist is missing \(appGroupName)")
}
return appGroup
}
}

public enum BundleGroup {
case subs
}
40 changes: 40 additions & 0 deletions Core/BundleExtensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// BundleExtensions.swift
// DuckDuckGo
//
// Copyright © 2024 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

extension Bundle {
public func appGroup(bundle: BundleGroup) -> String {
var appGroupName: String

switch bundle {
case .subs:
appGroupName = "SUBSCRIPTION_APP_GROUP"
}

guard let appGroup = object(forInfoDictionaryKey: appGroupName) as? String else {
fatalError("Info.plist is missing \(appGroupName)")
}
return appGroup
}
}

public enum BundleGroup {
case subs
}
3 changes: 2 additions & 1 deletion Core/DataStoreWarmup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

import Combine
import Macros
import WebKit

/// WKWebsiteDataStore is basically non-functional until a web view has been instanciated and a page is successfully loaded.
Expand All @@ -27,7 +28,7 @@ public class DataStoreWarmup {

@MainActor
public func ensureReady() async {
await BlockingNavigationDelegate().loadInBackgroundWebView(url: URL(string: "about:blank")!)
await BlockingNavigationDelegate().loadInBackgroundWebView(url: #URL("about:blank"))
}

}
Expand Down
3 changes: 0 additions & 3 deletions Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public enum FeatureFlag: String {
case networkProtectionWaitlistActive
case subscription
case swipeTabs
case autoconsentOnByDefault
case history
}

Expand Down Expand Up @@ -67,8 +66,6 @@ extension FeatureFlag: FeatureFlagSourceProviding {
return .remoteReleasable(.subfeature(AutofillSubfeature.onByDefault))
case .incontextSignup:
return .remoteReleasable(.feature(.incontextSignup))
case .autoconsentOnByDefault:
return .remoteReleasable(.subfeature(AutoconsentSubfeature.onByDefault))
case .history:
return .remoteReleasable(.feature(.history))
}
Expand Down
15 changes: 14 additions & 1 deletion Core/Pixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,27 @@ extension Pixel {
}
}

/// NSError supports this through `NSUnderlyingError`, but there's no support for this for Swift's `Error`. This protocol does that.
///
/// The reason why this protocol returns a code and a domain instead of just an `Error` or `NSError` is so that the error implementing
/// this protocol has full control over these values, and is able to override them as it best sees fit.
///
protocol ErrorWithUnderlyingError: Error {
var underlyingErrorCode: Int { get }
var underlyingErrorDomain: String { get }
}

extension Dictionary where Key == String, Value == String {
mutating func appendErrorPixelParams(error: Error) {
let nsError = error as NSError

self[PixelParameters.errorCode] = "\(nsError.code)"
self[PixelParameters.errorDomain] = nsError.domain

if let underlyingError = nsError.userInfo["NSUnderlyingError"] as? NSError {
if let underlyingError = error as? ErrorWithUnderlyingError {
self[PixelParameters.underlyingErrorCode] = "\(underlyingError.underlyingErrorCode)"
self[PixelParameters.underlyingErrorDomain] = underlyingError.underlyingErrorDomain
} else if let underlyingError = nsError.userInfo["NSUnderlyingError"] as? NSError {
self[PixelParameters.underlyingErrorCode] = "\(underlyingError.code)"
self[PixelParameters.underlyingErrorDomain] = underlyingError.domain
} else if let sqlErrorCode = nsError.userInfo["NSSQLiteErrorDomain"] as? NSNumber {
Expand Down
Loading

0 comments on commit 70ec49d

Please sign in to comment.