-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dominik/xcode-16
# By Daniel Bernal (7) and others # Via Daniel Bernal (3) and others * main: (29 commits) Send pixel on sync secure storage failure (#3542) Onboarding Add to Dock Refactor for Intro scenario (#3538) Update C-S-S to 6.29.0 (#3541) Change save password Never for Site button to Not Now (#3471) Release 7.144.0-1 (#3540) UserDefaults misbehavior monitoring (#3510) Send pixel on sync secure storage read failure (#3530) Remove NewTabPage retain cycles (#3532) Update release notes (#3529) Release 7.144.0-0 (#3528) Add Privacy Config feature to control ad attribution reporting (#3506) Validate VPN errors before re-throwing them (#3513) Allowing users to delete suggestions on macOS (#3465) Update build number Update build number Bump rexml from 3.3.8 to 3.3.9 (#3495) Release 7.142.1-1 (#3525) Add a debouncer to NavBars animator (#3519) Release 7.143.0-1 (#3516) Update to subscription cookie (#3512) ... # Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj # DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
- Loading branch information
Showing
117 changed files
with
15,662 additions
and
2,033 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
MARKETING_VERSION = 7.143.0 | ||
MARKETING_VERSION = 7.144.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// BoolFileMarker.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. | ||
// | ||
|
||
public struct BoolFileMarker { | ||
let fileManager = FileManager.default | ||
private let url: URL | ||
|
||
public var isPresent: Bool { | ||
fileManager.fileExists(atPath: url.path) | ||
} | ||
|
||
public func mark() { | ||
if !isPresent { | ||
fileManager.createFile(atPath: url.path, contents: nil, attributes: [.protectionKey: FileProtectionType.none]) | ||
} | ||
} | ||
|
||
public func unmark() { | ||
if isPresent { | ||
try? fileManager.removeItem(at: url) | ||
} | ||
} | ||
|
||
public init?(name: Name) { | ||
guard let applicationSupportDirectory = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else { | ||
return nil | ||
} | ||
|
||
self.url = applicationSupportDirectory.appendingPathComponent(name.rawValue) | ||
} | ||
|
||
public struct Name: RawRepresentable { | ||
public let rawValue: String | ||
|
||
public init(rawValue: String) { | ||
self.rawValue = "\(rawValue).marker" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// BoolFileMarkerTests.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 XCTest | ||
@testable import Core | ||
|
||
final class BoolFileMarkerTests: XCTestCase { | ||
|
||
private let marker = BoolFileMarker(name: .init(rawValue: "test"))! | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
|
||
marker.unmark() | ||
} | ||
|
||
private var testFileURL: URL? { | ||
FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("test.marker") | ||
} | ||
|
||
func testMarkCreatesCorrectFile() throws { | ||
|
||
marker.mark() | ||
|
||
let fileURL = try XCTUnwrap(testFileURL) | ||
|
||
let attributes = try FileManager.default.attributesOfItem(atPath: fileURL.path) | ||
XCTAssertNil(attributes[.protectionKey]) | ||
XCTAssertTrue(FileManager.default.fileExists(atPath: fileURL.path)) | ||
XCTAssertEqual(marker.isPresent, true) | ||
} | ||
|
||
func testUnmarkRemovesFile() throws { | ||
marker.mark() | ||
marker.unmark() | ||
|
||
let fileURL = try XCTUnwrap(testFileURL) | ||
|
||
XCTAssertFalse(marker.isPresent) | ||
XCTAssertFalse(FileManager.default.fileExists(atPath: fileURL.path)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.