Skip to content

Commit

Permalink
Merge branch 'release/7.148.0' into bunn/aichat/browsing-menu
Browse files Browse the repository at this point in the history
# Conflicts:
#	Core/PixelEvent.swift
  • Loading branch information
Bunn committed Dec 3, 2024
2 parents f394ff5 + a5dab98 commit d45b0da
Show file tree
Hide file tree
Showing 59 changed files with 1,484 additions and 960 deletions.
72 changes: 72 additions & 0 deletions .maestro/release_tests/local-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# local-storage.yaml
appId: com.duckduckgo.mobile.ios
tags:
- release

---

# Set up
- runFlow:
file: ../shared/setup.yaml

# Load Site
- assertVisible:
id: "searchEntry"
- tapOn:
id: "searchEntry"
- inputText: "https://privacy-test-pages.site/features/local-storage.html"
- pressKey: Enter

# Add a cookie
- assertVisible: "Storage Counter: undefined"
- assertVisible: "Cookie Counter:"
- assertNotVisible: "Cookie Counter: 1"
- assertNotVisible: "Storage Counter: 1"
- assertVisible: "Manual Increment"
- tapOn: "Manual Increment"
- tapOn: "Manual Increment"
- assertVisible: "Cookie Counter: 2"
- assertVisible: "Storage Counter: 2"

# Fireproofing
- tapOn: "Browsing menu"
- tapOn: "Fireproof This Site"
- tapOn: "Fireproof"

# Fire button
- tapOn: "Close Tabs and Clear Data"
- tapOn: "Close Tabs and Clear Data"

- assertNotVisible: "https://privacy-test-pages.site/features/local-storage.html"

# Load Site
- assertVisible:
id: "searchEntry"
- tapOn:
id: "searchEntry"

- inputText: "https://privacy-test-pages.site/features/local-storage.html"
- pressKey: Enter
- assertVisible: "Storage Counter: 2"
- assertVisible: "Cookie Counter: 2"

# Remove Fireproofing
- tapOn: "Browsing menu"
- tapOn: "Remove Fireproofing"

# Fire button
- tapOn: "Close Tabs and Clear Data"
- tapOn: "Close Tabs and Clear Data"

- assertNotVisible: "https://privacy-test-pages.site/features/local-storage.html"

# Load Site
- assertVisible:
id: "searchEntry"
- tapOn:
id: "searchEntry"

- inputText: "https://privacy-test-pages.site/features/local-storage.html"
- pressKey: Enter
- assertVisible: "Storage Counter: undefined"
- assertVisible: "Cookie Counter:"
2 changes: 1 addition & 1 deletion .maestro/setup_ui_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ target_os="iOS-18-1"
check_maestro() {

local command_name="maestro"
local known_version="1.39.1"
local known_version="1.39.2"

if command -v $command_name > /dev/null 2>&1; then
local version_output=$($command_name -v 2>&1 | tail -n 1)
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 7.147.0
MARKETING_VERSION = 7.148.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 = "\"7ad37aaf57f883471cf65c00a4317a45\""
public static let embeddedDataSHA = "bf1e81c46e53f75c7c90d343886183b99793675f223f5016af998dfe1cdedbae"
public static let embeddedDataETag = "\"a913df909743eadb5bd381c7fddf4902\""
public static let embeddedDataSHA = "d1fb789ab4def06b6cf359d5e9971c840668ab5307f5690bc1483bb2266a2558"
}

public var embeddedDataEtag: String {
Expand Down
157 changes: 0 additions & 157 deletions Core/CookieStorage.swift

This file was deleted.

57 changes: 57 additions & 0 deletions Core/DataStoreIDManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// DataStoreIDManager.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 WebKit
import Persistence

/// Supports an existing ID set in previous versions of the app, but moving forward does not allocate an ID. We have gone back to using the default
/// peristence for the webview storage so that we can fireproof types that don't have an API for accessing their data. (e.g. localStorage)
public protocol DataStoreIDManaging {

var currentID: UUID? { get }

func invalidateCurrentID()
}

public class DataStoreIDManager: DataStoreIDManaging {

enum Constants: String {
case currentWebContainerID = "com.duckduckgo.ios.webcontainer.id"
}

public static let shared = DataStoreIDManager()

private let store: KeyValueStoring
init(store: KeyValueStoring = UserDefaults.app) {
self.store = store
}

public var currentID: UUID? {
guard let uuidString = store.object(forKey: Constants.currentWebContainerID.rawValue) as? String else {
return nil
}
return UUID(uuidString: uuidString)
}

public func invalidateCurrentID() {
store.removeObject(forKey: Constants.currentWebContainerID.rawValue)
}

}
5 changes: 5 additions & 0 deletions Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public enum FeatureFlag: String {

case isPrivacyProLaunchedROW
case isPrivacyProLaunchedROWOverride

/// https://app.asana.com/0/0/1208767141940869/f
case freeTrials
}

extension FeatureFlag: FeatureFlagDescribing {
Expand Down Expand Up @@ -143,6 +146,8 @@ extension FeatureFlag: FeatureFlagDescribing {
return .remoteReleasable(.subfeature(PrivacyProSubfeature.isLaunchedROW))
case .isPrivacyProLaunchedROWOverride:
return .remoteReleasable(.subfeature(PrivacyProSubfeature.isLaunchedROWOverride))
case .freeTrials:
return .remoteDevelopment(.subfeature(PrivacyProSubfeature.freeTrials))
}
}
}
Expand Down
19 changes: 13 additions & 6 deletions Core/Fireproofing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

import Foundation
import Subscription

public protocol Fireproofing {

Expand All @@ -35,7 +36,9 @@ public protocol Fireproofing {
// This class is not final because we override allowed domains in WebCacheManagerTests
public class UserDefaultsFireproofing: Fireproofing {

public static let shared: Fireproofing = UserDefaultsFireproofing()
/// This is only here because there are some places that don't support injection at this time. DO NOT USE IT.
/// If you find you really need to use it, ping Apple Devs channel first.
public static let xshared: Fireproofing = UserDefaultsFireproofing()

public struct Notifications {
public static let loginDetectionStateChanged = Foundation.Notification.Name("com.duckduckgo.ios.PreserveLogins.loginDetectionStateChanged")
Expand All @@ -51,15 +54,19 @@ public class UserDefaultsFireproofing: Fireproofing {
}
}

private var allowedDomainsIncludingDuckDuckGo: [String] {
allowedDomains + [
URL.ddg.host ?? "",
SubscriptionCookieManager.cookieDomain
]
}

public func addToAllowed(domain: String) {
allowedDomains += [domain]
}

public func isAllowed(cookieDomain: String) -> Bool {

return allowedDomains.contains(where: { $0 == cookieDomain
|| ".\($0)" == cookieDomain
|| (cookieDomain.hasPrefix(".") && $0.hasSuffix(cookieDomain)) })
return allowedDomainsIncludingDuckDuckGo.contains(where: { HTTPCookie.cookieDomain(cookieDomain, matchesTestDomain: $0) })
}

public func remove(domain: String) {
Expand All @@ -71,7 +78,7 @@ public class UserDefaultsFireproofing: Fireproofing {
}

public func isAllowed(fireproofDomain domain: String) -> Bool {
return allowedDomains.contains(domain)
return allowedDomainsIncludingDuckDuckGo.contains(domain)
}

}
Loading

0 comments on commit d45b0da

Please sign in to comment.