diff --git a/Core/UIViewControllerExtension.swift b/Core/UIViewControllerExtension.swift index 4e787b286b..0c680622cf 100644 --- a/Core/UIViewControllerExtension.swift +++ b/Core/UIViewControllerExtension.swift @@ -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) } @@ -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) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 4f16f1dc8c..6e4aff14a0 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -317,6 +317,7 @@ 4BFB911B29B7D9530014D4B7 /* AppTrackingProtectionStoringModelPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB911A29B7D9530014D4B7 /* AppTrackingProtectionStoringModelPerformanceTests.swift */; }; 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 */; }; @@ -344,7 +345,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 */; }; @@ -632,8 +632,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 */; }; @@ -1434,6 +1432,7 @@ 4BFB911A29B7D9530014D4B7 /* AppTrackingProtectionStoringModelPerformanceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTrackingProtectionStoringModelPerformanceTests.swift; sourceTree = ""; }; 6AC6DAB228804F97002723C0 /* BarsAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarsAnimator.swift; sourceTree = ""; }; 6AC98418288055C1005FA9CA /* BarsAnimatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarsAnimatorTests.swift; sourceTree = ""; }; + 6F655BE12BAB289E00AC3597 /* DefaultTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultTheme.swift; sourceTree = ""; }; 6FB030C7234331B400A10DB9 /* Configuration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Configuration.xcconfig; path = Configuration/Configuration.xcconfig; sourceTree = ""; }; 6FDA1FB22B59584400AC962A /* AddressDisplayHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressDisplayHelper.swift; sourceTree = ""; }; 83004E7F2193BB8200DA013C /* WKNavigationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WKNavigationExtension.swift; sourceTree = ""; }; @@ -1477,7 +1476,6 @@ 850250B420D80419002199C7 /* AtbAndVariantCleanupTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtbAndVariantCleanupTests.swift; sourceTree = ""; }; 850365F223DE087800D0F787 /* UIImageViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageViewExtension.swift; sourceTree = ""; }; 85047B891F69692C002A95D8 /* contentblocker.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = contentblocker.js; sourceTree = ""; }; - 85047C742A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SyncSettingsViewController+Themable.swift"; sourceTree = ""; }; 85047C762A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SyncSettingsViewController+SyncDelegate.swift"; sourceTree = ""; }; 850559C823C61B5D0055C0D5 /* login-form-detection.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = "login-form-detection.js"; sourceTree = ""; }; 850559CF23CF647C0055C0D5 /* PreserveLogins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreserveLogins.swift; sourceTree = ""; }; @@ -2302,8 +2300,6 @@ 98F02E87251EAC11002A6C60 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/InfoPlist.strings; sourceTree = ""; }; 98F0FC1F21FF18E700CE77AB /* AutoClearSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoClearSettingsViewController.swift; sourceTree = ""; }; 98F3A1D7217B37010011A0D4 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = ""; }; - 98F3A1D9217B37200011A0D4 /* LightTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightTheme.swift; sourceTree = ""; }; - 98F3A1DB217B373E0011A0D4 /* DarkTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DarkTheme.swift; sourceTree = ""; }; 98F6EA462863124100720957 /* ContentBlockerRulesLists.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBlockerRulesLists.swift; sourceTree = ""; }; 98F78B8D22419093007CACF4 /* ThemableNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemableNavigationController.swift; sourceTree = ""; }; AA3D854423D9942200788410 /* AppIconSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconSettingsViewController.swift; sourceTree = ""; }; @@ -4141,7 +4137,6 @@ children = ( 85582DFF29D7409700E9AE35 /* SyncSettingsViewController+PDFRendering.swift */, 85F98F91296F32BD00742F4A /* SyncSettingsViewController.swift */, - 85047C742A0D3C2900D2FF3F /* SyncSettingsViewController+Themable.swift */, 85047C762A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift */, ); name = Controllers; @@ -4313,9 +4308,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 = ""; @@ -6631,7 +6625,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 */, @@ -6765,7 +6758,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 */, @@ -6899,6 +6891,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 */, @@ -6998,7 +6991,6 @@ B623C1C22862CA9E0043013E /* DownloadSession.swift in Sources */, 0290471E29E708750008FE3C /* AppTPManageTrackersView.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 */, diff --git a/DuckDuckGo/AddOrEditBookmarkViewController.swift b/DuckDuckGo/AddOrEditBookmarkViewController.swift index 188764d2ba..827efd99cf 100644 --- a/DuckDuckGo/AddOrEditBookmarkViewController.swift +++ b/DuckDuckGo/AddOrEditBookmarkViewController.swift @@ -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() @@ -190,13 +191,3 @@ extension AddOrEditBookmarkViewController: AddOrEditBookmarkViewControllerDelega } } - -extension AddOrEditBookmarkViewController: Themable { - - func decorate(with theme: Theme) { - decorateNavigationBar(with: theme) - decorateToolbar(with: theme) - - overrideSystemTheme(with: theme) - } -} diff --git a/DuckDuckGo/AppIconSettingsCell.swift b/DuckDuckGo/AppIconSettingsCell.swift index fc7c137b21..0afd421d12 100644 --- a/DuckDuckGo/AppIconSettingsCell.swift +++ b/DuckDuckGo/AppIconSettingsCell.swift @@ -35,6 +35,7 @@ class AppIconSettingsCell: UICollectionViewCell { super.init(coder: coder) isAccessibilityElement = true accessibilityTraits.insert(.button) + decorate() } override var isSelected: Bool { @@ -42,13 +43,19 @@ class AppIconSettingsCell: UICollectionViewCell { 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() + } + } } diff --git a/DuckDuckGo/AppIconSettingsViewController.swift b/DuckDuckGo/AppIconSettingsViewController.swift index e80e9c69f6..8effb6bbdb 100644 --- a/DuckDuckGo/AppIconSettingsViewController.swift +++ b/DuckDuckGo/AppIconSettingsViewController.swift @@ -29,7 +29,7 @@ class AppIconSettingsViewController: UICollectionViewController { super.viewDidLoad() collectionView.dataSource = dataSource - applyTheme(ThemeManager.shared.currentTheme) + decorate() } private func initSelection() { @@ -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 @@ -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() diff --git a/DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/Contents.json deleted file mode 100644 index 73f512d9a6..0000000000 --- a/DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "errorImgDark.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/Contents.json deleted file mode 100644 index 7c77a84b81..0000000000 --- a/DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "errorImgLight.pdf" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "template-rendering-intent" : "original" - } -} \ No newline at end of file diff --git a/DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/Contents.json new file mode 100644 index 0000000000..3e999bf806 --- /dev/null +++ b/DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/Contents.json @@ -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 + } +} diff --git a/DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/errorImgDark.pdf b/DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/errorImgDark.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/ErrorInfoDark.imageset/errorImgDark.pdf rename to DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/errorImgDark.pdf diff --git a/DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/errorImgLight.pdf b/DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/errorImgLight.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/ErrorInfoLight.imageset/errorImgLight.pdf rename to DuckDuckGo/Assets.xcassets/ErrorInfoUniversal.imageset/errorImgLight.pdf diff --git a/DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/Contents.json deleted file mode 100644 index c29cf298bd..0000000000 --- a/DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/Contents.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "light_portrait_logo.pdf" - }, - { - "idiom" : "universal", - "filename" : "updatedLogoGrayText2.pdf", - "height-class" : "compact" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DuckDuckGo/Assets.xcassets/LogoLightText.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/LogoLightText.imageset/Contents.json deleted file mode 100644 index d4d281e3a0..0000000000 --- a/DuckDuckGo/Assets.xcassets/LogoLightText.imageset/Contents.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "images" : [ - { - "filename" : "dark_portrait_logo.pdf", - "idiom" : "universal" - }, - { - "filename" : "updatedLogoWhiteText2.pdf", - "height-class" : "compact", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/DuckDuckGo/Assets.xcassets/LogoText.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/LogoText.imageset/Contents.json new file mode 100644 index 0000000000..e2be879966 --- /dev/null +++ b/DuckDuckGo/Assets.xcassets/LogoText.imageset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "filename" : "light_portrait_logo.pdf", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "dark_portrait_logo.pdf", + "idiom" : "universal" + }, + { + "filename" : "updatedLogoGrayText2.pdf", + "height-class" : "compact", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "updatedLogoWhiteText2.pdf", + "height-class" : "compact", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DuckDuckGo/Assets.xcassets/LogoLightText.imageset/dark_portrait_logo.pdf b/DuckDuckGo/Assets.xcassets/LogoText.imageset/dark_portrait_logo.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/LogoLightText.imageset/dark_portrait_logo.pdf rename to DuckDuckGo/Assets.xcassets/LogoText.imageset/dark_portrait_logo.pdf diff --git a/DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/light_portrait_logo.pdf b/DuckDuckGo/Assets.xcassets/LogoText.imageset/light_portrait_logo.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/light_portrait_logo.pdf rename to DuckDuckGo/Assets.xcassets/LogoText.imageset/light_portrait_logo.pdf diff --git a/DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/updatedLogoGrayText2.pdf b/DuckDuckGo/Assets.xcassets/LogoText.imageset/updatedLogoGrayText2.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/LogoDarkText.imageset/updatedLogoGrayText2.pdf rename to DuckDuckGo/Assets.xcassets/LogoText.imageset/updatedLogoGrayText2.pdf diff --git a/DuckDuckGo/Assets.xcassets/LogoLightText.imageset/updatedLogoWhiteText2.pdf b/DuckDuckGo/Assets.xcassets/LogoText.imageset/updatedLogoWhiteText2.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/LogoLightText.imageset/updatedLogoWhiteText2.pdf rename to DuckDuckGo/Assets.xcassets/LogoText.imageset/updatedLogoWhiteText2.pdf diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Dark.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Dark.imageset/Contents.json deleted file mode 100644 index 66cc1cf77d..0000000000 --- a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Dark.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "tabsToggleGrid-Dark.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true - } -} diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Light.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/Contents.json similarity index 53% rename from DuckDuckGo/Assets.xcassets/tabsToggleGrid-Light.imageset/Contents.json rename to DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/Contents.json index 795786a1b3..89e3de9717 100644 --- a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Light.imageset/Contents.json +++ b/DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/Contents.json @@ -3,6 +3,16 @@ { "filename" : "tabsToggleGrid-Light.pdf", "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "tabsToggleGrid-Dark.pdf", + "idiom" : "universal" } ], "info" : { diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Dark.imageset/tabsToggleGrid-Dark.pdf b/DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/tabsToggleGrid-Dark.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/tabsToggleGrid-Dark.imageset/tabsToggleGrid-Dark.pdf rename to DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/tabsToggleGrid-Dark.pdf diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleGrid-Light.imageset/tabsToggleGrid-Light.pdf b/DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/tabsToggleGrid-Light.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/tabsToggleGrid-Light.imageset/tabsToggleGrid-Light.pdf rename to DuckDuckGo/Assets.xcassets/tabsToggleGrid.imageset/tabsToggleGrid-Light.pdf diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleList-Dark.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/tabsToggleList-Dark.imageset/Contents.json deleted file mode 100644 index cd4cb82e92..0000000000 --- a/DuckDuckGo/Assets.xcassets/tabsToggleList-Dark.imageset/Contents.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "images" : [ - { - "filename" : "tabsToggleList-Dark.pdf", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "preserves-vector-representation" : true - } -} diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleList-Light.imageset/Contents.json b/DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/Contents.json similarity index 53% rename from DuckDuckGo/Assets.xcassets/tabsToggleList-Light.imageset/Contents.json rename to DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/Contents.json index 1009e215b0..fb6ad68ad2 100644 --- a/DuckDuckGo/Assets.xcassets/tabsToggleList-Light.imageset/Contents.json +++ b/DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/Contents.json @@ -3,6 +3,16 @@ { "filename" : "tabsToggleList-Light.pdf", "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "tabsToggleList-Dark.pdf", + "idiom" : "universal" } ], "info" : { diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleList-Dark.imageset/tabsToggleList-Dark.pdf b/DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/tabsToggleList-Dark.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/tabsToggleList-Dark.imageset/tabsToggleList-Dark.pdf rename to DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/tabsToggleList-Dark.pdf diff --git a/DuckDuckGo/Assets.xcassets/tabsToggleList-Light.imageset/tabsToggleList-Light.pdf b/DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/tabsToggleList-Light.pdf similarity index 100% rename from DuckDuckGo/Assets.xcassets/tabsToggleList-Light.imageset/tabsToggleList-Light.pdf rename to DuckDuckGo/Assets.xcassets/tabsToggleList.imageset/tabsToggleList-Light.pdf diff --git a/DuckDuckGo/AuthenticationViewController.swift b/DuckDuckGo/AuthenticationViewController.swift index 0538cb3ccb..d983a309b3 100644 --- a/DuckDuckGo/AuthenticationViewController.swift +++ b/DuckDuckGo/AuthenticationViewController.swift @@ -43,7 +43,7 @@ class AuthenticationViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() hideUnlockInstructions() - applyTheme(ThemeManager.shared.currentTheme) + decorate() } override var supportedInterfaceOrientations: UIInterfaceOrientationMask { @@ -98,16 +98,10 @@ class AuthenticationViewController: UIViewController { } } -extension AuthenticationViewController: Themable { +extension AuthenticationViewController { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme view.backgroundColor = theme.backgroundColor - - switch theme.currentImageSet { - case .light: - logo?.image = UIImage(named: "LogoDarkText") - case .dark: - logo?.image = UIImage(named: "LogoLightText") - } } } diff --git a/DuckDuckGo/AutoClearSettingsViewController.swift b/DuckDuckGo/AutoClearSettingsViewController.swift index 77fb3173ce..5b5ec0c874 100644 --- a/DuckDuckGo/AutoClearSettingsViewController.swift +++ b/DuckDuckGo/AutoClearSettingsViewController.swift @@ -42,8 +42,8 @@ class AutoClearSettingsViewController: UITableViewController { clearDataSettings = loadClearDataSettings() configureClearDataToggle() tableView.reloadData() - - applyTheme(ThemeManager.shared.currentTheme) + + decorate() } private func loadClearDataSettings() -> AutoClearSettingsModel? { @@ -154,9 +154,10 @@ class AutoClearSettingsViewController: UITableViewController { } } -extension AutoClearSettingsViewController: Themable { +extension AutoClearSettingsViewController { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme for label in labels { label.textColor = theme.tableCellTextColor diff --git a/DuckDuckGo/AutocompleteViewController.swift b/DuckDuckGo/AutocompleteViewController.swift index 8f57da2bb2..a2fc59be5f 100644 --- a/DuckDuckGo/AutocompleteViewController.swift +++ b/DuckDuckGo/AutocompleteViewController.swift @@ -96,7 +96,7 @@ class AutocompleteViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() configureTableView() - applyTheme(ThemeManager.shared.currentTheme) + decorate() queryDebounceCancellable = $query .debounce(for: .milliseconds(Constants.debounceDelay), scheduler: RunLoop.main) @@ -137,11 +137,6 @@ class AutocompleteViewController: UIViewController { navigationController?.hidesBarsOnSwipe = hidesBarsOnSwipeDefault } - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - tableView.reloadData() - } - func updateQuery(query: String) { selectedItem = -1 cancelInFlightRequests() @@ -302,10 +297,10 @@ extension AutocompleteViewController: UIGestureRecognizerDelegate { } } -extension AutocompleteViewController: Themable { - func decorate(with theme: Theme) { +extension AutocompleteViewController { + private func decorate() { + let theme = ThemeManager.shared.currentTheme tableView.separatorColor = theme.tableCellSeparatorColor - tableView.reloadData() } } diff --git a/DuckDuckGo/AutoconsentSettingsViewController.swift b/DuckDuckGo/AutoconsentSettingsViewController.swift index 172be442e2..f25b7eaff8 100644 --- a/DuckDuckGo/AutoconsentSettingsViewController.swift +++ b/DuckDuckGo/AutoconsentSettingsViewController.swift @@ -35,8 +35,8 @@ final class AutoconsentSettingsViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - applyTheme(ThemeManager.shared.currentTheme) - + decorate() + autoconsentToggle.isOn = appSettings.autoconsentEnabled let fontSize = FontSettings.fontSizeForHeaderView @@ -61,11 +61,6 @@ final class AutoconsentSettingsViewController: UITableViewController { } } - override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - let theme = ThemeManager.shared.currentTheme - cell.decorate(with: theme) - } - @IBAction private func onAutoconsentValueChanged(_ sender: Any) { appSettings.autoconsentEnabled = autoconsentToggle.isOn Pixel.fire(pixel: autoconsentToggle.isOn ? .settingsAutoconsentOn : .settingsAutoconsentOff) @@ -73,9 +68,10 @@ final class AutoconsentSettingsViewController: UITableViewController { } -extension AutoconsentSettingsViewController: Themable { +extension AutoconsentSettingsViewController { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme infoText.textColor = theme.tableHeaderTextColor diff --git a/DuckDuckGo/AutofillEmptySearchView.swift b/DuckDuckGo/AutofillEmptySearchView.swift index 3fad1ce258..65b01d80c6 100644 --- a/DuckDuckGo/AutofillEmptySearchView.swift +++ b/DuckDuckGo/AutofillEmptySearchView.swift @@ -64,6 +64,7 @@ class AutofillEmptySearchView: UIView { super.init(frame: frame) installSubviews() installConstraints() + decorate() } required init?(coder: NSCoder) { @@ -86,9 +87,10 @@ class AutofillEmptySearchView: UIView { } } -extension AutofillEmptySearchView: Themable { +extension AutofillEmptySearchView { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme title.textColor = theme.autofillEmptySearchViewTextColor subtitle.textColor = theme.autofillEmptySearchViewTextColor } diff --git a/DuckDuckGo/AutofillItemsEmptyView.swift b/DuckDuckGo/AutofillItemsEmptyView.swift index 6ef8c058cb..d081a67f0f 100644 --- a/DuckDuckGo/AutofillItemsEmptyView.swift +++ b/DuckDuckGo/AutofillItemsEmptyView.swift @@ -33,6 +33,7 @@ class AutofillItemsEmptyView: UIView { super.init(frame: frame) installSubviews() installConstraints() + decorate() } required init?(coder: NSCoder) { @@ -115,9 +116,10 @@ class AutofillItemsEmptyView: UIView { } } -extension AutofillItemsEmptyView: Themable { +extension AutofillItemsEmptyView { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme title.textColor = theme.autofillDefaultTitleTextColor } } diff --git a/DuckDuckGo/AutofillLoginDetailsViewController.swift b/DuckDuckGo/AutofillLoginDetailsViewController.swift index 803e5d1cce..2fde29ee32 100644 --- a/DuckDuckGo/AutofillLoginDetailsViewController.swift +++ b/DuckDuckGo/AutofillLoginDetailsViewController.swift @@ -103,7 +103,7 @@ class AutofillLoginDetailsViewController: UIViewController { installSubviews() setupCancellables() setupTableViewAppearance() - applyTheme(ThemeManager.shared.currentTheme) + decorate() installConstraints() configureNotifications() setupNavigationBar() @@ -332,13 +332,12 @@ extension AutofillLoginDetailsViewController: AutofillLoginDetailsViewModelDeleg // MARK: Themable -extension AutofillLoginDetailsViewController: Themable { +extension AutofillLoginDetailsViewController { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme lockedView.backgroundColor = theme.backgroundColor - noAuthAvailableView.decorate(with: theme) - view.backgroundColor = theme.backgroundColor navigationController?.navigationBar.barTintColor = theme.barBackgroundColor diff --git a/DuckDuckGo/AutofillLoginSettingsListViewController.swift b/DuckDuckGo/AutofillLoginSettingsListViewController.swift index 7b90ad5868..84465c646b 100644 --- a/DuckDuckGo/AutofillLoginSettingsListViewController.swift +++ b/DuckDuckGo/AutofillLoginSettingsListViewController.swift @@ -166,7 +166,7 @@ final class AutofillLoginSettingsListViewController: UIViewController { setupCancellables() installSubviews() installConstraints() - applyTheme(ThemeManager.shared.currentTheme) + decorate() updateViewState() configureNotification() registerForKeyboardNotifications() @@ -867,12 +867,10 @@ extension AutofillLoginSettingsListViewController: EnableAutofillSettingsTableVi // MARK: Themable -extension AutofillLoginSettingsListViewController: Themable { +extension AutofillLoginSettingsListViewController { - func decorate(with theme: Theme) { - emptyView.decorate(with: theme) - emptySearchView.decorate(with: theme) - noAuthAvailableView.decorate(with: theme) + private func decorate() { + let theme = ThemeManager.shared.currentTheme view.backgroundColor = theme.backgroundColor tableView.backgroundColor = theme.backgroundColor diff --git a/DuckDuckGo/AutofillNoAuthAvailableView.swift b/DuckDuckGo/AutofillNoAuthAvailableView.swift index 1db32fd310..8729d39c81 100644 --- a/DuckDuckGo/AutofillNoAuthAvailableView.swift +++ b/DuckDuckGo/AutofillNoAuthAvailableView.swift @@ -25,6 +25,7 @@ class AutofillNoAuthAvailableView: UIView { super.init(frame: frame) installSubviews() installConstraints() + decorate() } required init?(coder: NSCoder) { @@ -174,9 +175,10 @@ class AutofillNoAuthAvailableView: UIView { } } -extension AutofillNoAuthAvailableView: Themable { +extension AutofillNoAuthAvailableView { - func decorate(with theme: Theme) { + private func decorate() { + let theme = ThemeManager.shared.currentTheme title.textColor = theme.autofillDefaultTitleTextColor subtitle.textColor = theme.autofillDefaultSubtitleTextColor } diff --git a/DuckDuckGo/Base.lproj/Authentication.storyboard b/DuckDuckGo/Base.lproj/Authentication.storyboard index 5bba576fcf..bae34d3455 100644 --- a/DuckDuckGo/Base.lproj/Authentication.storyboard +++ b/DuckDuckGo/Base.lproj/Authentication.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -21,20 +19,20 @@ - - + + - + @@ -83,6 +81,6 @@ - + diff --git a/DuckDuckGo/Base.lproj/Bookmarks.storyboard b/DuckDuckGo/Base.lproj/Bookmarks.storyboard index cf28e50f78..84b847ab71 100644 --- a/DuckDuckGo/Base.lproj/Bookmarks.storyboard +++ b/DuckDuckGo/Base.lproj/Bookmarks.storyboard @@ -1,9 +1,9 @@ - + - + @@ -63,10 +63,10 @@ - + - + @@ -361,10 +361,10 @@ - + - + diff --git a/DuckDuckGo/Base.lproj/Feedback.storyboard b/DuckDuckGo/Base.lproj/Feedback.storyboard index ac8172e1c5..504755ce55 100644 --- a/DuckDuckGo/Base.lproj/Feedback.storyboard +++ b/DuckDuckGo/Base.lproj/Feedback.storyboard @@ -1,17 +1,17 @@ - + - + - + - + @@ -147,7 +147,7 @@ - + @@ -422,8 +422,8 @@ - - + + diff --git a/DuckDuckGo/Base.lproj/Tab.storyboard b/DuckDuckGo/Base.lproj/Tab.storyboard index 203637fe2c..4f3852b007 100644 --- a/DuckDuckGo/Base.lproj/Tab.storyboard +++ b/DuckDuckGo/Base.lproj/Tab.storyboard @@ -1,11 +1,10 @@ - - + + - + - @@ -48,29 +47,29 @@ - + @@ -174,15 +173,6 @@ - - - - - - - - - - + diff --git a/DuckDuckGo/Base.lproj/TabSwitcher.storyboard b/DuckDuckGo/Base.lproj/TabSwitcher.storyboard index 61934fab72..ede7c1d7f7 100644 --- a/DuckDuckGo/Base.lproj/TabSwitcher.storyboard +++ b/DuckDuckGo/Base.lproj/TabSwitcher.storyboard @@ -1,9 +1,9 @@ - + - + @@ -19,7 +19,7 @@ - + @@ -102,7 +102,7 @@