From f47861498fb4e65893464353ee69de82b4b8b13d Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Thu, 23 May 2024 22:19:31 -0700 Subject: [PATCH 1/3] BSK bump for iOS RMF updates (#2798) Task/Issue URL: https://app.asana.com/0/1193060753475688/1207234800675206/f Tech Design URL: CC: Description: This PR updates macOS for the BSK RMF changes. These changes are not used by any component of the macOS app. --- DuckDuckGo.xcodeproj/project.pbxproj | 2 +- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- LocalPackages/DataBrokerProtection/Package.swift | 2 +- LocalPackages/NetworkProtectionMac/Package.swift | 2 +- LocalPackages/SubscriptionUI/Package.swift | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 6143c3a653..ba8f275f98 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -13021,7 +13021,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 146.2.0; + version = 147.0.0; }; }; 9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = { diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6dd57e77a0..bd2dc2a20d 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "e1e436422bc167933baa0f90838958f2ac7119f3", - "version" : "146.2.0" + "revision" : "610a58a77fefe82f8541d4a7f998ef2a4609a068", + "version" : "147.0.0" } }, { diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index 1fa39e2681..f55ac724a6 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "146.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "147.0.0"), .package(path: "../SwiftUIExtensions"), .package(path: "../XPCHelper"), ], diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 041e3d6cd1..e9ad0dbc90 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -31,7 +31,7 @@ let package = Package( .library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "146.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "147.0.0"), .package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"), .package(path: "../XPCHelper"), .package(path: "../SwiftUIExtensions"), diff --git a/LocalPackages/SubscriptionUI/Package.swift b/LocalPackages/SubscriptionUI/Package.swift index 57655ffe08..3dcac72550 100644 --- a/LocalPackages/SubscriptionUI/Package.swift +++ b/LocalPackages/SubscriptionUI/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["SubscriptionUI"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "146.2.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "147.0.0"), .package(path: "../SwiftUIExtensions") ], targets: [ From 89627db1fe109339c7b5507d53d9c02260893c7c Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Fri, 24 May 2024 14:07:16 +0200 Subject: [PATCH 2/3] Privacy Pro macOS quick follow ups (#2813) Task/Issue URL: https://app.asana.com/0/1204099484721401/1207013882115696/f Description: Small copy fixes --- .../SubscriptionUI/Sources/SubscriptionUI/UserText.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift index 5e470bf2f8..6321b3cc4f 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift @@ -76,7 +76,7 @@ enum UserText { // MARK: Preferences when subscription activation is pending static let preferencesSubscriptionPendingHeader = NSLocalizedString("subscription.preferences.subscription.pending.header", value: "Your subscription is being activated", comment: "Header for the subscription preferences pane when the subscription activation is pending") - static let preferencesSubscriptionPendingCaption = NSLocalizedString("subscription.preferences.subscription.pending.caption", value: "This is taking longer than usual, please check back later.", comment: "Caption for the subscription preferences pane when the subscription activation is pending") + static let preferencesSubscriptionPendingCaption = NSLocalizedString("subscription.preferences.subscription.pending.caption", value: "This is taking longer than usual. Please check back later.", comment: "Caption for the subscription preferences pane when the subscription activation is pending") // MARK: Preferences when subscription is expired static let preferencesSubscriptionExpiredCaption = NSLocalizedString("subscription.preferences.subscription.expired.caption", value: "Subscribe again to continue using Privacy Pro.", comment: "Caption for the subscription preferences pane when the subscription activation is pending") @@ -87,7 +87,7 @@ enum UserText { // MARK: - Change plan or billing dialogs static let changeSubscriptionDialogTitle = NSLocalizedString("subscription.dialog.change.title", value: "Change Plan or Billing", comment: "Change plan or billing dialog title") static let changeSubscriptionGoogleDialogDescription = NSLocalizedString("subscription.dialog.change.google.description", value: "Your subscription was purchased through the Google Play Store. To change your plan or billing settings, please open Google Play Store subscription settings on a device signed in to the same Google Account used to purchase your subscription.", comment: "Change plan or billing dialog subtitle description for subscription purchased via Google") - static let changeSubscriptionAppleDialogDescription = NSLocalizedString("subscription.dialog.change.apple.description", value: "Your subscription was purchased through the Apple App Store. To change your plan or billing settings, please go to Settings > Apple ID > Subscriptions on a device signed in to the same Apple ID used to purchase your subscription.", comment: "Change plan or billing dialog subtitle description for subscription purchased via Apple") + static let changeSubscriptionAppleDialogDescription = NSLocalizedString("subscription.dialog.change.apple.description", value: "Your subscription was purchased through the Apple App Store. To change your plan or billing settings, please go to System Settings > Apple ID > Media and Purchases > Subscriptions > Manage on a device signed in to the same Apple ID used to purchase your subscription.", comment: "Change plan or billing dialog subtitle description for subscription purchased via Apple") static let changeSubscriptionDialogDone = NSLocalizedString("subscription.dialog.change.done.button", value: "Done", comment: "Button to close the change subscription dialog") // MARK: - Remove from this device dialog @@ -124,7 +124,7 @@ enum UserText { } } - static let shareModalHasEmailDescription = NSLocalizedString("subscription.share.modal.has.email.description", value: "Use this email to activate your subscription on other devices. Open the DuckDuckGo app on another device and find Privacy Pro in browser settings.", comment: "Share subscription modal description for email address channel") + static let shareModalHasEmailDescription = NSLocalizedString("subscription.share.modal.has.email.description", value: "Use this email to activate your subscription from browser settings in the DuckDuckGo app on other devices", comment: "Share subscription modal description for email address channel") static let shareModalNoEmailDescription = NSLocalizedString("subscription.share.modal.no.email.description", value: "Add an email address to access your subscription in DuckDuckGo on other devices. We’ll only use this address to verify your subscription.", comment: "Share subscription modal description for email address channel") static let restorePurchasesDescription = NSLocalizedString("subscription.share.modal.restore.purchases.description", value: "Your subscription is automatically available in DuckDuckGo on any device signed in to your Apple ID.", comment: "Share subscription modal description for restoring Apple ID purchases") From 36da9593f30040463c955244069d2670ed454bfe Mon Sep 17 00:00:00 2001 From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com> Date: Fri, 24 May 2024 14:08:33 +0200 Subject: [PATCH 3/3] Scroll address bar to caret when using arrows (#2799) Task/Issue URL: https://app.asana.com/0/1177771139624306/1207043866291151/f **Description**: When using arrows in the address bar it will scroll to the caret position --- .../View/AddressBarTextEditor.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/DuckDuckGo/NavigationBar/View/AddressBarTextEditor.swift b/DuckDuckGo/NavigationBar/View/AddressBarTextEditor.swift index bf5c1c6c7f..c235f193d1 100644 --- a/DuckDuckGo/NavigationBar/View/AddressBarTextEditor.swift +++ b/DuckDuckGo/NavigationBar/View/AddressBarTextEditor.swift @@ -292,12 +292,14 @@ final class AddressBarTextEditor: NSTextView { guard let index = nextWordSelectionIndex(backwards: false) else { return } self.selectedRange = NSRange(location: index, length: 0) + scrollToCaret() } override func moveWordLeft(_ sender: Any?) { guard let index = nextWordSelectionIndex(backwards: true) else { return } self.selectedRange = NSRange(location: index, length: 0) + scrollToCaret() } override func moveWordRightAndModifySelection(_ sender: Any?) { @@ -311,6 +313,7 @@ final class AddressBarTextEditor: NSTextView { let range = NSRange(location: selectedRange.location, length: index - selectedRange.location) self.setSelectedRange(range, affinity: .downstream, stillSelecting: false) + self.scrollToSelectionEnd() } override func moveWordLeftAndModifySelection(_ sender: Any?) { @@ -324,6 +327,7 @@ final class AddressBarTextEditor: NSTextView { let range = NSRange(location: index, length: selectedRange.upperBound - index) self.setSelectedRange(range, affinity: .upstream, stillSelecting: false) + self.scrollToSelectionStart() } override func deleteForward(_ sender: Any?) { @@ -422,6 +426,22 @@ final class AddressBarTextEditor: NSTextView { breakUndoCoalescing() } + private func scrollToCaret() { + guard let layoutManager = layoutManager, let textContainer = textContainer else { return } + let caretRect = layoutManager.boundingRect(forGlyphRange: selectedRange(), in: textContainer) + scrollToVisible(caretRect) + } + + private func scrollToSelectionStart() { + let startRange = NSRange(location: selectedRange().location, length: 0) + self.scrollRangeToVisible(startRange) + } + + private func scrollToSelectionEnd() { + let endRange = NSRange(location: selectedRange.location + selectedRange.length, length: 0) + self.scrollRangeToVisible(endRange) + } + } final class AddressBarTextFieldCell: NSTextFieldCell {