Skip to content

Commit

Permalink
Merge branch 'main' into sam/privacy-pro-surveys
Browse files Browse the repository at this point in the history
* main:
  Update BSK due to iOS changes. (#2776)
  Scroll address bar to caret when using arrows (#2799)
  Privacy Pro macOS quick follow ups (#2813)
  BSK bump for iOS RMF updates (#2798)
  • Loading branch information
samsymons committed May 24, 2024
2 parents efa97cc + 6a23246 commit ca701e8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12997,7 +12997,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 146.2.0;
version = 148.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "e1e436422bc167933baa0f90838958f2ac7119f3",
"version" : "146.2.0"
"revision" : "7c235d29fc446436734612e81dd486b7c52aa577",
"version" : "148.0.0"
}
},
{
Expand Down
20 changes: 20 additions & 0 deletions DuckDuckGo/NavigationBar/View/AddressBarTextEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?) {
Expand All @@ -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?) {
Expand All @@ -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?) {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "148.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper"),
],
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "148.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.1"),
.package(path: "../XPCHelper"),
.package(path: "../SwiftUIExtensions"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "148.0.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit ca701e8

Please sign in to comment.