Skip to content

Commit

Permalink
Merge branch 'main' into sam/remove-apptp
Browse files Browse the repository at this point in the history
# By Christopher Brind (2) and others
# Via GitHub
* main:
  Use trait collection to control theme changes (#2672)
  Expand maestro tests (#2691)
  scroll to selected item after opening new tab, etc (#2689)
  Update autoconsent to v10.5.0 (#2671)
  Fix history debug view controller causing crash on tap (#2681)

# Conflicts:
#	DuckDuckGo/HomeCollectionView.swift
#	DuckDuckGo/HomeViewController.swift
  • Loading branch information
samsymons committed Apr 7, 2024
2 parents bc555ab + 1504f88 commit 4f762da
Show file tree
Hide file tree
Showing 117 changed files with 868 additions and 980 deletions.
65 changes: 65 additions & 0 deletions .maestro/browser_features/opening_tabs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# tabs.yaml
appId: com.duckduckgo.mobile.ios
tags:
- release

---

# Set up
- clearState
- launchApp
- runFlow:
when:
visible:
text: "Let’s Do It!"
index: 0
file: ../shared/onboarding.yaml

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

# Manage onboarding
- runFlow:
when:
visible:
text: "Got It"
index: 0
file: ../shared/onboarding_browsing.yaml

- assertVisible: ".*Privacy Test Pages.*"
- tapOn: "Links Open in New Window"

# Validate there's one tab
- runFlow:
file: ../shared/check_number_of_tabs.yaml
env:
TITLE: "1 Private Tab"

- tapOn: "Opens in new window"
- runFlow:
file: ../shared/check_number_of_tabs.yaml
env:
TITLE: "2 Private Tabs"

- tapOn: "Close"
- assertVisible: "A link that opens in a new window"
- tapOn: "Opens in new window"
- runFlow:
file: ../shared/check_number_of_tabs.yaml
env:
TITLE: "2 Private Tabs"

- tapOn: "Browse Back"
- assertVisible: "A link that opens in a new window"

# Workaround - for some reason Tab Switcher button is not found by maestro at this point.
- tapOn: "Refresh Page"
- runFlow:
file: ../shared/check_number_of_tabs.yaml
env:
TITLE: "1 Private Tab"
2 changes: 1 addition & 1 deletion .maestro/data_clearing_tests/01_fire_proofing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
appId: com.duckduckgo.mobile.ios
tags:
- dataclearing
- privacy

---

Expand Down
7 changes: 7 additions & 0 deletions .maestro/shared/check_number_of_tabs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
appId: com.duckduckgo.mobile.ios
---

- assertVisible: "Tab Switcher"
- tapOn: "Tab Switcher"
- assertVisible: ${TITLE}
- tapOn: "Done"
11 changes: 0 additions & 11 deletions Core/UIViewControllerExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,10 @@ extension UIViewController {
return []
}

func overrideUserInterfaceStyle() {
if ThemeManager.shared.currentTheme.currentImageSet == .dark {
overrideUserInterfaceStyle = .dark
} else {
overrideUserInterfaceStyle = .light
}
}

public func presentShareSheet(withItems activityItems: [Any], fromButtonItem buttonItem: UIBarButtonItem, completion: UIActivityViewController.CompletionWithItemsHandler? = nil) {
let activities = buildActivities()
let shareController = UIActivityViewController(activityItems: activityItems, applicationActivities: activities)
shareController.completionWithItemsHandler = completion
shareController.overrideUserInterfaceStyle()
present(controller: shareController, fromButtonItem: buttonItem)
}

Expand All @@ -56,8 +47,6 @@ extension UIViewController {
shareController.completionWithItemsHandler = completion
if let overrideInterfaceStyle {
shareController.overrideUserInterfaceStyle = overrideInterfaceStyle
} else {
shareController.overrideUserInterfaceStyle()
}
shareController.excludedActivityTypes = [.markupAsPDF]
present(controller: shareController, fromView: sourceView, atPoint: point)
Expand Down
16 changes: 4 additions & 12 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
4BE67B072B96B9B0007335F7 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 4BE67B062B96B9B0007335F7 /* Common */; };
6AC6DAB328804F97002723C0 /* BarsAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AC6DAB228804F97002723C0 /* BarsAnimator.swift */; };
6AC98419288055C1005FA9CA /* BarsAnimatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AC98418288055C1005FA9CA /* BarsAnimatorTests.swift */; };
6F655BE22BAB289E00AC3597 /* DefaultTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F655BE12BAB289E00AC3597 /* DefaultTheme.swift */; };
6FDA1FB32B59584400AC962A /* AddressDisplayHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FDA1FB22B59584400AC962A /* AddressDisplayHelper.swift */; };
83004E802193BB8200DA013C /* WKNavigationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83004E7F2193BB8200DA013C /* WKNavigationExtension.swift */; };
83004E862193E5ED00DA013C /* TabViewControllerBrowsingMenuExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83004E852193E5ED00DA013C /* TabViewControllerBrowsingMenuExtension.swift */; };
Expand Down Expand Up @@ -244,7 +245,6 @@
850250B520D80419002199C7 /* AtbAndVariantCleanupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850250B420D80419002199C7 /* AtbAndVariantCleanupTests.swift */; };
850365F323DE087800D0F787 /* UIImageViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850365F223DE087800D0F787 /* UIImageViewExtension.swift */; };
85047B8A1F69692C002A95D8 /* contentblocker.js in Resources */ = {isa = PBXBuildFile; fileRef = 85047B891F69692C002A95D8 /* contentblocker.js */; };
85047C752A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85047C742A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift */; };
85047C772A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85047C762A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift */; };
850559C923C61B5D0055C0D5 /* login-form-detection.js in Resources */ = {isa = PBXBuildFile; fileRef = 850559C823C61B5D0055C0D5 /* login-form-detection.js */; };
850559D023CF647C0055C0D5 /* PreserveLogins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850559CF23CF647C0055C0D5 /* PreserveLogins.swift */; };
Expand Down Expand Up @@ -532,8 +532,6 @@
98EF177D21837E35006750C1 /* new_tab_dark.json in Resources */ = {isa = PBXBuildFile; fileRef = 98EF177C21837E35006750C1 /* new_tab_dark.json */; };
98F0FC2021FF18E700CE77AB /* AutoClearSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F0FC1F21FF18E700CE77AB /* AutoClearSettingsViewController.swift */; };
98F3A1D8217B37010011A0D4 /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F3A1D7217B37010011A0D4 /* Theme.swift */; };
98F3A1DA217B37200011A0D4 /* LightTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F3A1D9217B37200011A0D4 /* LightTheme.swift */; };
98F3A1DC217B373E0011A0D4 /* DarkTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F3A1DB217B373E0011A0D4 /* DarkTheme.swift */; };
98F6EA472863124100720957 /* ContentBlockerRulesLists.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F6EA462863124100720957 /* ContentBlockerRulesLists.swift */; };
98F78B8E22419093007CACF4 /* ThemableNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98F78B8D22419093007CACF4 /* ThemableNavigationController.swift */; };
9F8FE9492BAE50E50071E372 /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 9F8FE9482BAE50E50071E372 /* Lottie */; };
Expand Down Expand Up @@ -1237,6 +1235,7 @@
4BE27566272F878F006B20B0 /* URLRequestExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = URLRequestExtension.swift; path = ../DuckDuckGo/URLRequestExtension.swift; sourceTree = "<group>"; };
6AC6DAB228804F97002723C0 /* BarsAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarsAnimator.swift; sourceTree = "<group>"; };
6AC98418288055C1005FA9CA /* BarsAnimatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarsAnimatorTests.swift; sourceTree = "<group>"; };
6F655BE12BAB289E00AC3597 /* DefaultTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultTheme.swift; sourceTree = "<group>"; };
6FB030C7234331B400A10DB9 /* Configuration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Configuration.xcconfig; path = Configuration/Configuration.xcconfig; sourceTree = "<group>"; };
6FDA1FB22B59584400AC962A /* AddressDisplayHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressDisplayHelper.swift; sourceTree = "<group>"; };
83004E7F2193BB8200DA013C /* WKNavigationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WKNavigationExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1280,7 +1279,6 @@
850250B420D80419002199C7 /* AtbAndVariantCleanupTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtbAndVariantCleanupTests.swift; sourceTree = "<group>"; };
850365F223DE087800D0F787 /* UIImageViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageViewExtension.swift; sourceTree = "<group>"; };
85047B891F69692C002A95D8 /* contentblocker.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = contentblocker.js; sourceTree = "<group>"; };
85047C742A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SyncSettingsViewController+Themable.swift"; sourceTree = "<group>"; };
85047C762A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SyncSettingsViewController+SyncDelegate.swift"; sourceTree = "<group>"; };
850559C823C61B5D0055C0D5 /* login-form-detection.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = "login-form-detection.js"; sourceTree = "<group>"; };
850559CF23CF647C0055C0D5 /* PreserveLogins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreserveLogins.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2105,8 +2103,6 @@
98F02E87251EAC11002A6C60 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
98F0FC1F21FF18E700CE77AB /* AutoClearSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoClearSettingsViewController.swift; sourceTree = "<group>"; };
98F3A1D7217B37010011A0D4 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
98F3A1D9217B37200011A0D4 /* LightTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightTheme.swift; sourceTree = "<group>"; };
98F3A1DB217B373E0011A0D4 /* DarkTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DarkTheme.swift; sourceTree = "<group>"; };
98F6EA462863124100720957 /* ContentBlockerRulesLists.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBlockerRulesLists.swift; sourceTree = "<group>"; };
98F78B8D22419093007CACF4 /* ThemableNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemableNavigationController.swift; sourceTree = "<group>"; };
AA3D854423D9942200788410 /* AppIconSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconSettingsViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3635,7 +3631,6 @@
children = (
85582DFF29D7409700E9AE35 /* SyncSettingsViewController+PDFRendering.swift */,
85F98F91296F32BD00742F4A /* SyncSettingsViewController.swift */,
85047C742A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift */,
85047C762A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift */,
);
name = Controllers;
Expand Down Expand Up @@ -3807,9 +3802,8 @@
98F3A1D7217B37010011A0D4 /* Theme.swift */,
9874F9ED2187AFCE00CAF33D /* Themable.swift */,
98DA6EC92181E41F00E65433 /* ThemeManager.swift */,
98F3A1D9217B37200011A0D4 /* LightTheme.swift */,
98F3A1DB217B373E0011A0D4 /* DarkTheme.swift */,
8536A1FC2ACF114B003AC5BA /* Theme+DesignSystem.swift */,
6F655BE12BAB289E00AC3597 /* DefaultTheme.swift */,
);
name = Themes;
sourceTree = "<group>";
Expand Down Expand Up @@ -6062,7 +6056,6 @@
8546A54A2A672959003929BF /* MainViewController+Email.swift in Sources */,
F4F6DFB226E6AEC100ED7E12 /* AddOrEditBookmarkViewController.swift in Sources */,
EE458D0D2AB1DA4600FC651A /* EventMapping+NetworkProtectionError.swift in Sources */,
85047C752A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift in Sources */,
F44D279F27F331BB0037F371 /* AutofillLoginPromptViewController.swift in Sources */,
C1BF0BA529B63D7200482B73 /* AutofillLoginPromptHelper.swift in Sources */,
D664C7C92B289AA200CBFA76 /* AsyncHeadlessWebView.swift in Sources */,
Expand Down Expand Up @@ -6191,7 +6184,6 @@
EEF0F8CC2ABC832300630031 /* NetworkProtectionDebugFeatures.swift in Sources */,
B60DFF072872B64B0061E7C2 /* JSAlertController.swift in Sources */,
981FED6E22025151008488D7 /* BlankSnapshotViewController.swift in Sources */,
98F3A1DC217B373E0011A0D4 /* DarkTheme.swift in Sources */,
D66F683D2BB333C100AE93E2 /* SubscriptionContainerView.swift in Sources */,
851B128822200575004781BC /* Onboarding.swift in Sources */,
3151F0EE2735800800226F58 /* VoiceSearchFeedbackView.swift in Sources */,
Expand Down Expand Up @@ -6314,6 +6306,7 @@
D6E0C1872B7A2D0700D5E1E9 /* DesktopDownloadViewButtonStyle.swift in Sources */,
854A012B2A54412600FCC628 /* ActivityViewController.swift in Sources */,
F1CA3C391F045885005FADB3 /* PrivacyUserDefaults.swift in Sources */,
6F655BE22BAB289E00AC3597 /* DefaultTheme.swift in Sources */,
BD862E072B30F5E30073E2EE /* VPNFeedbackSender.swift in Sources */,
AA4D6A6A23DB87B1007E8790 /* AppIconManager.swift in Sources */,
8563A03C1F9288D600F04442 /* BrowserChromeManager.swift in Sources */,
Expand Down Expand Up @@ -6403,7 +6396,6 @@
8590CB67268A2E520089F6BF /* RootDebugViewController.swift in Sources */,
B623C1C22862CA9E0043013E /* DownloadSession.swift in Sources */,
F16390821E648B7A005B4550 /* HomeViewController.swift in Sources */,
98F3A1DA217B37200011A0D4 /* LightTheme.swift in Sources */,
985892522260B1B200EEB31B /* ProgressView.swift in Sources */,
85BA585A1F3506AE00C6E8CA /* AppSettings.swift in Sources */,
3151F0EA27357FBA00226F58 /* SpeechRecognizer.swift in Sources */,
Expand Down
13 changes: 2 additions & 11 deletions DuckDuckGo/AddOrEditBookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class AddOrEditBookmarkViewController: UIViewController {
updateTitle()
updateSaveButton()

applyTheme(ThemeManager.shared.currentTheme)
decorateNavigationBar()
decorateToolbar()

viewModelCancellable = viewModel.externalUpdates.sink { [weak self] _ in
self?.foldersViewController?.refresh()
Expand Down Expand Up @@ -190,13 +191,3 @@ extension AddOrEditBookmarkViewController: AddOrEditBookmarkViewControllerDelega
}

}

extension AddOrEditBookmarkViewController: Themable {

func decorate(with theme: Theme) {
decorateNavigationBar(with: theme)
decorateToolbar(with: theme)

overrideSystemTheme(with: theme)
}
}
15 changes: 11 additions & 4 deletions DuckDuckGo/AppIconSettingsCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,27 @@ class AppIconSettingsCell: UICollectionViewCell {
super.init(coder: coder)
isAccessibilityElement = true
accessibilityTraits.insert(.button)
decorate()
}

override var isSelected: Bool {
didSet {
layer.borderWidth = isSelected ? 2.0 : 0.0
}
}

}

extension AppIconSettingsCell: Themable {

func decorate(with theme: Theme) {
extension AppIconSettingsCell {
private func decorate() {
let theme = ThemeManager.shared.currentTheme
layer.borderColor = theme.iconCellBorderColor.cgColor
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
decorate()
}
}
}
8 changes: 4 additions & 4 deletions DuckDuckGo/AppIconSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AppIconSettingsViewController: UICollectionViewController {
super.viewDidLoad()

collectionView.dataSource = dataSource
applyTheme(ThemeManager.shared.currentTheme)
decorate()
}

private func initSelection() {
Expand Down Expand Up @@ -66,7 +66,6 @@ class AppIconDataSource: NSObject, UICollectionViewDataSource {
as? AppIconSettingsCell else {
fatalError("Expected IconSettingsCell")
}
cell.decorate(with: ThemeManager.shared.currentTheme)

let appIcon = appIcons[indexPath.row]
cell.appIcon = appIcon
Expand Down Expand Up @@ -95,9 +94,10 @@ class AppIconWorker {

}

extension AppIconSettingsViewController: Themable {
extension AppIconSettingsViewController {

func decorate(with theme: Theme) {
private func decorate() {
let theme = ThemeManager.shared.currentTheme
collectionView.backgroundColor = theme.backgroundColor
collectionView.reloadData()
initSelection()
Expand Down
12 changes: 0 additions & 12 deletions DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/Contents.json

This file was deleted.

15 changes: 0 additions & 15 deletions DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/Contents.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "errorImgLight.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "errorImgDark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
17 changes: 0 additions & 17 deletions DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/Contents.json

This file was deleted.

17 changes: 0 additions & 17 deletions DuckDuckGo/Assets.xcassets/LogoLightText.imageset/Contents.json

This file was deleted.

Loading

0 comments on commit 4f762da

Please sign in to comment.