-
Notifications
You must be signed in to change notification settings - Fork 426
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 sam/increase-deployment-target-to-ios-15
* main: Fire a pixel when removing the VPN configuration (#3014) Release 7.127.0-0 (#3020) point to BSK branch (#3016) [DuckPlayer] - 3. URL management & FE comms (#3007) Bump BSK version (#3011) New Tab Page layout and base elements (#3008) Remove Privacy Pro from device once expired account is deleted (#3009) Improvements to subscription settings (#2959) Toggle reports limiter (#3005) Duck Player info Modal (#3006) Silence tunnel startup noise with no access token available (#2993) In case Pending Deletion flag is nil, populate it with 'false' value (#2997) VPN uninstall not stopping agent in App Store build (#2999) Update VPN metadata to include entitlement (#3002)
- Loading branch information
Showing
69 changed files
with
1,981 additions
and
542 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.126.0 | ||
MARKETING_VERSION = 7.127.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,83 @@ | ||
// | ||
// BookmarksStateRepair.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 | ||
import CoreData | ||
import Bookmarks | ||
import Persistence | ||
|
||
public class BookmarksStateRepair { | ||
|
||
enum Constants { | ||
static let pendingDeletionRepaired = "stateRepair_pendingDeletionRepaired" | ||
} | ||
|
||
public enum RepairStatus: Equatable { | ||
case alreadyPerformed | ||
case noBrokenData | ||
case dataRepaired | ||
case repairError(Error) | ||
|
||
public static func == (lhs: BookmarksStateRepair.RepairStatus, rhs: BookmarksStateRepair.RepairStatus) -> Bool { | ||
switch (lhs, rhs) { | ||
case (.alreadyPerformed, .alreadyPerformed), (.noBrokenData, .noBrokenData), (.dataRepaired, .dataRepaired), (.repairError, .repairError): | ||
return true | ||
default: | ||
return false | ||
} | ||
} | ||
} | ||
|
||
let keyValueStore: KeyValueStoring | ||
|
||
public init(keyValueStore: KeyValueStoring) { | ||
self.keyValueStore = keyValueStore | ||
} | ||
|
||
public func validateAndRepairPendingDeletionState(in context: NSManagedObjectContext) -> RepairStatus { | ||
|
||
guard keyValueStore.object(forKey: Constants.pendingDeletionRepaired) == nil else { | ||
return .alreadyPerformed | ||
} | ||
|
||
do { | ||
let fr = BookmarkEntity.fetchRequest() | ||
fr.predicate = NSPredicate(format: "%K == nil", #keyPath(BookmarkEntity.isPendingDeletion)) | ||
|
||
let result = try context.fetch(fr) | ||
|
||
if !result.isEmpty { | ||
for obj in result { | ||
obj.setValue(false, forKey: #keyPath(BookmarkEntity.isPendingDeletion)) | ||
} | ||
|
||
try context.save() | ||
|
||
keyValueStore.set(true, forKey: Constants.pendingDeletionRepaired) | ||
return .dataRepaired | ||
} else { | ||
keyValueStore.set(true, forKey: Constants.pendingDeletionRepaired) | ||
return .noBrokenData | ||
} | ||
} catch { | ||
return .repairError(error) | ||
} | ||
} | ||
|
||
} |
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.