From 02783fcab8bc66ff8935c26793787152f2425cbf Mon Sep 17 00:00:00 2001 From: Christopher Brind Date: Tue, 3 Oct 2023 01:26:13 +0100 Subject: [PATCH] remove main view controller storyboard (#2058) Task/Issue URL: https://app.asana.com/0/0/1205584556126567/f Tech Design URL: CC: Description: Note: This PR is based on #2045. --- Core/UIViewControllerExtension.swift | 2 +- DuckDuckGo.xcodeproj/project.pbxproj | 64 +---- DuckDuckGo/AppDelegate.swift | 20 +- DuckDuckGo/BrowserChromeManager.swift | 2 +- DuckDuckGo/HomeViewController.swift | 2 +- DuckDuckGo/MainView.swift | 335 ++++++++++++++++++++++++ DuckDuckGo/MainViewController.swift | 254 ++++++++---------- DuckDuckGo/UIView+Constraints.swift | 6 +- DuckDuckGo/bg.lproj/Main.strings | 21 -- DuckDuckGo/cs.lproj/Main.strings | 21 -- DuckDuckGo/da.lproj/Main.strings | 21 -- DuckDuckGo/de.lproj/Main.strings | 21 -- DuckDuckGo/el.lproj/Main.strings | 21 -- DuckDuckGo/es.lproj/Main.strings | 21 -- DuckDuckGo/et.lproj/Main.strings | 21 -- DuckDuckGo/fi.lproj/Main.strings | 21 -- DuckDuckGo/fr.lproj/Main.strings | 21 -- DuckDuckGo/hr.lproj/Main.strings | 21 -- DuckDuckGo/hu.lproj/Main.strings | 21 -- DuckDuckGo/it.lproj/Main.strings | 21 -- DuckDuckGo/lt.lproj/Main.strings | 21 -- DuckDuckGo/lv.lproj/Main.strings | 21 -- DuckDuckGo/nb.lproj/Main.strings | 21 -- DuckDuckGo/nl.lproj/Main.strings | 21 -- DuckDuckGo/pl.lproj/Main.strings | 21 -- DuckDuckGo/pt.lproj/Main.strings | 21 -- DuckDuckGo/ro.lproj/Main.strings | 21 -- DuckDuckGo/ru.lproj/Main.strings | 21 -- DuckDuckGo/sk.lproj/Main.strings | 21 -- DuckDuckGo/sl.lproj/Main.strings | 21 -- DuckDuckGo/sv.lproj/Main.strings | 21 -- DuckDuckGo/tr.lproj/Main.strings | 21 -- DuckDuckGoTests/BarsAnimatorTests.swift | 2 +- 33 files changed, 467 insertions(+), 724 deletions(-) create mode 100644 DuckDuckGo/MainView.swift delete mode 100644 DuckDuckGo/bg.lproj/Main.strings delete mode 100644 DuckDuckGo/cs.lproj/Main.strings delete mode 100644 DuckDuckGo/da.lproj/Main.strings delete mode 100644 DuckDuckGo/de.lproj/Main.strings delete mode 100644 DuckDuckGo/el.lproj/Main.strings delete mode 100644 DuckDuckGo/es.lproj/Main.strings delete mode 100644 DuckDuckGo/et.lproj/Main.strings delete mode 100644 DuckDuckGo/fi.lproj/Main.strings delete mode 100644 DuckDuckGo/fr.lproj/Main.strings delete mode 100644 DuckDuckGo/hr.lproj/Main.strings delete mode 100644 DuckDuckGo/hu.lproj/Main.strings delete mode 100644 DuckDuckGo/it.lproj/Main.strings delete mode 100644 DuckDuckGo/lt.lproj/Main.strings delete mode 100644 DuckDuckGo/lv.lproj/Main.strings delete mode 100644 DuckDuckGo/nb.lproj/Main.strings delete mode 100644 DuckDuckGo/nl.lproj/Main.strings delete mode 100644 DuckDuckGo/pl.lproj/Main.strings delete mode 100644 DuckDuckGo/pt.lproj/Main.strings delete mode 100644 DuckDuckGo/ro.lproj/Main.strings delete mode 100644 DuckDuckGo/ru.lproj/Main.strings delete mode 100644 DuckDuckGo/sk.lproj/Main.strings delete mode 100644 DuckDuckGo/sl.lproj/Main.strings delete mode 100644 DuckDuckGo/sv.lproj/Main.strings delete mode 100644 DuckDuckGo/tr.lproj/Main.strings diff --git a/Core/UIViewControllerExtension.swift b/Core/UIViewControllerExtension.swift index da622a8980..f37bca411b 100644 --- a/Core/UIViewControllerExtension.swift +++ b/Core/UIViewControllerExtension.swift @@ -27,7 +27,7 @@ extension UIViewController { } var isPad: Bool { - return traitCollection.horizontalSizeClass == .regular + return UIDevice.current.userInterfaceIdiom == .pad } @objc func buildActivities() -> [UIActivity] { diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index afbb089cfb..0025da68e4 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -319,7 +319,6 @@ 83E2D2B4253CC16B005605F5 /* httpsMobileV2BloomSpec.json in Resources */ = {isa = PBXBuildFile; fileRef = 83E2D2B1253CC16B005605F5 /* httpsMobileV2BloomSpec.json */; }; 83EDCC411F86B89C005CDFCD /* StatisticsLoaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83EDCC3F1F86B895005CDFCD /* StatisticsLoaderTests.swift */; }; 84E341961E2F7EFB00BDBA6F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E341951E2F7EFB00BDBA6F /* AppDelegate.swift */; }; - 84E3419B1E2F7EFB00BDBA6F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84E341991E2F7EFB00BDBA6F /* Main.storyboard */; }; 84E341A01E2F7EFB00BDBA6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 84E3419E1E2F7EFB00BDBA6F /* LaunchScreen.storyboard */; }; 85010502292FB1000033978F /* FireproofFaviconUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85010501292FB1000033978F /* FireproofFaviconUpdater.swift */; }; 85010504292FFB080033978F /* FireproofFaviconUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85010503292FFB080033978F /* FireproofFaviconUpdaterTests.swift */; }; @@ -466,6 +465,7 @@ 85D598872927F84C00FA3B1B /* Crashes in Frameworks */ = {isa = PBXBuildFile; productRef = 85D598862927F84C00FA3B1B /* Crashes */; }; 85DB12EB2A1FE2A4000A4A72 /* LockScreenWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DB12EA2A1FE2A4000A4A72 /* LockScreenWidgets.swift */; }; 85DB12ED2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DB12EC2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift */; }; + 85DDE0402AC6FF65006ABCA2 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DDE03F2AC6FF65006ABCA2 /* MainView.swift */; }; 85DF714624F7FE6100C89288 /* Core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F143C2E41E4A4CD400CFDE3A /* Core.framework */; }; 85DFEDED24C7CCA500973FE7 /* AppWidthObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DFEDEC24C7CCA500973FE7 /* AppWidthObserver.swift */; }; 85DFEDEF24C7EA3B00973FE7 /* SmallOmniBarState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DFEDEE24C7EA3B00973FE7 /* SmallOmniBarState.swift */; }; @@ -1327,7 +1327,6 @@ 83EDCC3F1F86B895005CDFCD /* StatisticsLoaderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatisticsLoaderTests.swift; sourceTree = ""; }; 84E341921E2F7EFB00BDBA6F /* DuckDuckGo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DuckDuckGo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 84E341951E2F7EFB00BDBA6F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 84E3419A1E2F7EFB00BDBA6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 84E3419F1E2F7EFB00BDBA6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 84E341A11E2F7EFB00BDBA6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 84E341A61E2F7EFB00BDBA6F /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1471,6 +1470,7 @@ 85D33FCF25C97B6E002B91A6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 85DB12EA2A1FE2A4000A4A72 /* LockScreenWidgets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockScreenWidgets.swift; sourceTree = ""; }; 85DB12EC2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+AppDeepLinks.swift"; sourceTree = ""; }; + 85DDE03F2AC6FF65006ABCA2 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; 85DFEDEC24C7CCA500973FE7 /* AppWidthObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppWidthObserver.swift; sourceTree = ""; }; 85DFEDEE24C7EA3B00973FE7 /* SmallOmniBarState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmallOmniBarState.swift; sourceTree = ""; }; 85DFEDF024C7EEA400973FE7 /* LargeOmniBarState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeOmniBarState.swift; sourceTree = ""; }; @@ -1521,7 +1521,6 @@ 981685442521EEEF00FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Bookmarks.strings; sourceTree = ""; }; 981685452521EEF000FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Feedback.strings; sourceTree = ""; }; 981685462521EEF000FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Home.strings; sourceTree = ""; }; - 981685472521EEF000FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Main.strings; sourceTree = ""; }; 981685482521EEF100FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/OmniBar.strings; sourceTree = ""; }; 981685492521EEF100FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Authentication.strings; sourceTree = ""; }; 9816854A2521EEF100FA91A1 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1626,7 +1625,6 @@ 9866DB8C251CA8F300612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DB8D251CA8F300612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Feedback.strings; sourceTree = ""; }; 9866DB8E251CA8F400612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Home.strings; sourceTree = ""; }; - 9866DB8F251CA8F400612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Main.strings; sourceTree = ""; }; 9866DB90251CA8F400612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/OmniBar.strings; sourceTree = ""; }; 9866DB91251CA8F400612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/Authentication.strings; sourceTree = ""; }; 9866DB92251CA8F400612E3A /* bg */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = bg; path = bg.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1645,7 +1643,6 @@ 9866DBA3251CA91700612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DBA4251CA91700612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Feedback.strings; sourceTree = ""; }; 9866DBA5251CA91800612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Home.strings; sourceTree = ""; }; - 9866DBA6251CA91800612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Main.strings; sourceTree = ""; }; 9866DBA7251CA91800612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/OmniBar.strings; sourceTree = ""; }; 9866DBA8251CA91800612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Authentication.strings; sourceTree = ""; }; 9866DBA9251CA91800612E3A /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1664,7 +1661,6 @@ 9866DBBA251CA92A00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DBBB251CA92A00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Feedback.strings; sourceTree = ""; }; 9866DBBC251CA92A00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Home.strings; sourceTree = ""; }; - 9866DBBD251CA92A00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Main.strings; sourceTree = ""; }; 9866DBBE251CA92B00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/OmniBar.strings; sourceTree = ""; }; 9866DBBF251CA92B00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Authentication.strings; sourceTree = ""; }; 9866DBC0251CA92B00612E3A /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1683,7 +1679,6 @@ 9866DBD1251CA93800612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DBD2251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Feedback.strings; sourceTree = ""; }; 9866DBD3251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Home.strings; sourceTree = ""; }; - 9866DBD4251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Main.strings; sourceTree = ""; }; 9866DBD5251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/OmniBar.strings; sourceTree = ""; }; 9866DBD6251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Authentication.strings; sourceTree = ""; }; 9866DBD7251CA93900612E3A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1702,7 +1697,6 @@ 9866DBE8251CA94E00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DBE9251CA94E00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Feedback.strings; sourceTree = ""; }; 9866DBEA251CA94F00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Home.strings; sourceTree = ""; }; - 9866DBEB251CA94F00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Main.strings; sourceTree = ""; }; 9866DBEC251CA94F00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/OmniBar.strings; sourceTree = ""; }; 9866DBED251CA94F00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Authentication.strings; sourceTree = ""; }; 9866DBEE251CA94F00612E3A /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1721,7 +1715,6 @@ 9866DBFF251CA96200612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC00251CA96200612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Feedback.strings; sourceTree = ""; }; 9866DC01251CA96200612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Home.strings; sourceTree = ""; }; - 9866DC02251CA96200612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Main.strings; sourceTree = ""; }; 9866DC03251CA96300612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC04251CA96300612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/Authentication.strings; sourceTree = ""; }; 9866DC05251CA96300612E3A /* et */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = et; path = et.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1740,7 +1733,6 @@ 9866DC16251CA99A00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC17251CA99B00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Feedback.strings; sourceTree = ""; }; 9866DC18251CA99B00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Home.strings; sourceTree = ""; }; - 9866DC19251CA99B00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; 9866DC1A251CA99B00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC1B251CA99B00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Authentication.strings; sourceTree = ""; }; 9866DC1C251CA99C00612E3A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1759,7 +1751,6 @@ 9866DC2D251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC2E251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Feedback.strings; sourceTree = ""; }; 9866DC2F251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Home.strings; sourceTree = ""; }; - 9866DC30251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Main.strings; sourceTree = ""; }; 9866DC31251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC32251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Authentication.strings; sourceTree = ""; }; 9866DC33251CA9B000612E3A /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1778,7 +1769,6 @@ 9866DC44251CA9BF00612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC45251CA9BF00612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Feedback.strings; sourceTree = ""; }; 9866DC46251CA9C000612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Home.strings; sourceTree = ""; }; - 9866DC47251CA9C000612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Main.strings; sourceTree = ""; }; 9866DC48251CA9C000612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC49251CA9C000612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Authentication.strings; sourceTree = ""; }; 9866DC4A251CA9C000612E3A /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1797,7 +1787,6 @@ 9866DC5B251CA9CE00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC5C251CA9CE00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Feedback.strings; sourceTree = ""; }; 9866DC5D251CA9CE00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Home.strings; sourceTree = ""; }; - 9866DC5E251CA9CE00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Main.strings; sourceTree = ""; }; 9866DC5F251CA9CF00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC60251CA9CF00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Authentication.strings; sourceTree = ""; }; 9866DC61251CA9CF00612E3A /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1816,7 +1805,6 @@ 9866DC72251CA9E200612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC73251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/Feedback.strings; sourceTree = ""; }; 9866DC74251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/Home.strings; sourceTree = ""; }; - 9866DC75251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/Main.strings; sourceTree = ""; }; 9866DC76251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC77251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/Authentication.strings; sourceTree = ""; }; 9866DC78251CA9E300612E3A /* lv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lv; path = lv.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1835,7 +1823,6 @@ 9866DC89251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DC8A251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Feedback.strings; sourceTree = ""; }; 9866DC8B251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Home.strings; sourceTree = ""; }; - 9866DC8C251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Main.strings; sourceTree = ""; }; 9866DC8D251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/OmniBar.strings; sourceTree = ""; }; 9866DC8E251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Authentication.strings; sourceTree = ""; }; 9866DC8F251CA9F500612E3A /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1854,7 +1841,6 @@ 9866DCA0251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DCA1251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Feedback.strings; sourceTree = ""; }; 9866DCA2251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Home.strings; sourceTree = ""; }; - 9866DCA3251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Main.strings; sourceTree = ""; }; 9866DCA4251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/OmniBar.strings; sourceTree = ""; }; 9866DCA5251CAA0500612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Authentication.strings; sourceTree = ""; }; 9866DCA6251CAA0600612E3A /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1873,7 +1859,6 @@ 9866DCB7251CAA2600612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DCB8251CAA2600612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Feedback.strings; sourceTree = ""; }; 9866DCB9251CAA2600612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Home.strings; sourceTree = ""; }; - 9866DCBA251CAA2600612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Main.strings; sourceTree = ""; }; 9866DCBB251CAA2600612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/OmniBar.strings; sourceTree = ""; }; 9866DCBC251CAA2700612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/Authentication.strings; sourceTree = ""; }; 9866DCBD251CAA2700612E3A /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1892,7 +1877,6 @@ 9866DCCE251CAA3300612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DCCF251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Feedback.strings; sourceTree = ""; }; 9866DCD0251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Home.strings; sourceTree = ""; }; - 9866DCD1251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Main.strings; sourceTree = ""; }; 9866DCD2251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/OmniBar.strings; sourceTree = ""; }; 9866DCD3251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/Authentication.strings; sourceTree = ""; }; 9866DCD4251CAA3400612E3A /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1911,7 +1895,6 @@ 9866DCE5251CAA4800612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Bookmarks.strings; sourceTree = ""; }; 9866DCE6251CAA4800612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Feedback.strings; sourceTree = ""; }; 9866DCE7251CAA4800612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Home.strings; sourceTree = ""; }; - 9866DCE8251CAA4900612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Main.strings; sourceTree = ""; }; 9866DCE9251CAA4900612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/OmniBar.strings; sourceTree = ""; }; 9866DCEA251CAA4900612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Authentication.strings; sourceTree = ""; }; 9866DCEB251CAA4900612E3A /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/PrivacyDashboard.strings; sourceTree = ""; }; @@ -1961,13 +1944,6 @@ 9866DD66251CB10600612E3A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Home.strings; sourceTree = ""; }; 9866DD68251CB10700612E3A /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Home.strings; sourceTree = ""; }; 9866DD6A251CB10800612E3A /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Home.strings; sourceTree = ""; }; - 9866DD74251CB11A00612E3A /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Main.strings; sourceTree = ""; }; - 9866DD76251CB11B00612E3A /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Main.strings; sourceTree = ""; }; - 9866DD7A251CB11E00612E3A /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Main.strings; sourceTree = ""; }; - 9866DD7C251CB11F00612E3A /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Main.strings; sourceTree = ""; }; - 9866DD7E251CB12000612E3A /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Main.strings; sourceTree = ""; }; - 9866DD80251CB12100612E3A /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Main.strings; sourceTree = ""; }; - 9866DD82251CB12200612E3A /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Main.strings; sourceTree = ""; }; 9866DD84251CB12700612E3A /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Authentication.strings; sourceTree = ""; }; 9866DD86251CB12800612E3A /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Authentication.strings; sourceTree = ""; }; 9866DD8A251CB12B00612E3A /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Authentication.strings; sourceTree = ""; }; @@ -5001,7 +4977,7 @@ 988F3DD2237DE8D900AEE34C /* ForgetDataAlert.swift */, 8C4838B4221C8F7F008A6739 /* GestureToolbarButton.swift */, 8577A1C4255D2C0D00D43FCD /* HitTestingToolbar.swift */, - 84E341991E2F7EFB00BDBA6F /* Main.storyboard */, + 85DDE03F2AC6FF65006ABCA2 /* MainView.swift */, F17669D61E43401C003D3222 /* MainViewController.swift */, 981CA7E92617797500E119D5 /* MainViewController+AddFavoriteFlow.swift */, 1E4F4A59297193DE00625985 /* MainViewController+CookiesManaged.swift */, @@ -5707,7 +5683,6 @@ 85A313972028E78A00327D00 /* release_notes.txt in Resources */, 9865DFFD22A84CF300D27829 /* FavoriteHomeCell.xib in Resources */, 1EE411FE2858B9300003FE64 /* dark-shield.json in Resources */, - 84E3419B1E2F7EFB00BDBA6F /* Main.storyboard in Resources */, 1E16260B296845120004127F /* cookie-banner-illustration-animated.json in Resources */, AA4D6AD323DE4D27007E8790 /* AppIconPurple29x29@2x.png in Resources */, AA4D6AA123DE4CC4007E8790 /* AppIconBlue60x60@3x.png in Resources */, @@ -6254,6 +6229,7 @@ 1EDE39D22705D4A200C99C72 /* FileSizeDebugViewController.swift in Sources */, 85047C772A0D5D3D00D2FF3F /* SyncSettingsViewController+SyncDelegate.swift in Sources */, 4B6484EA27FD1E350050A7A1 /* MacBrowserWaitlistView.swift in Sources */, + 85DDE0402AC6FF65006ABCA2 /* MainView.swift in Sources */, 980891A72237D5D800313A70 /* FeedbackPresenter.swift in Sources */, 989B337522D7EF2100437824 /* EmptyCollectionReusableView.swift in Sources */, 8524CC94246C5C8900E59D45 /* DaxDialogViewController.swift in Sources */, @@ -6874,38 +6850,6 @@ name = MainInterface.storyboard; sourceTree = ""; }; - 84E341991E2F7EFB00BDBA6F /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 84E3419A1E2F7EFB00BDBA6F /* Base */, - 9866DB8F251CA8F400612E3A /* bg */, - 9866DBA6251CA91800612E3A /* hr */, - 9866DBBD251CA92A00612E3A /* cs */, - 9866DBD4251CA93900612E3A /* da */, - 9866DBEB251CA94F00612E3A /* nl */, - 9866DC02251CA96200612E3A /* et */, - 9866DC19251CA99B00612E3A /* de */, - 9866DC30251CA9B000612E3A /* el */, - 9866DC47251CA9C000612E3A /* hu */, - 9866DC5E251CA9CE00612E3A /* it */, - 9866DC75251CA9E300612E3A /* lv */, - 9866DC8C251CA9F500612E3A /* lt */, - 9866DCA3251CAA0500612E3A /* pl */, - 9866DCBA251CAA2600612E3A /* ro */, - 9866DCD1251CAA3400612E3A /* sk */, - 9866DCE8251CAA4900612E3A /* sl */, - 9866DD74251CB11A00612E3A /* fi */, - 9866DD76251CB11B00612E3A /* fr */, - 9866DD7A251CB11E00612E3A /* pt */, - 9866DD7C251CB11F00612E3A /* ru */, - 9866DD7E251CB12000612E3A /* es */, - 9866DD80251CB12100612E3A /* sv */, - 9866DD82251CB12200612E3A /* tr */, - 981685472521EEF000FA91A1 /* nb */, - ); - name = Main.storyboard; - sourceTree = ""; - }; 84E3419E1E2F7EFB00BDBA6F /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index 72298d240e..3aa43b1fd5 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -209,19 +209,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { syncService.initializeIfNeeded() self.syncService = syncService - let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main) - - guard let main = storyboard.instantiateInitialViewController(creator: { coder in - MainViewController(coder: coder, - bookmarksDatabase: self.bookmarksDatabase, - bookmarksDatabaseCleaner: self.syncDataProviders.bookmarksAdapter.databaseCleaner, - appTrackingProtectionDatabase: self.appTrackingProtectionDatabase, - syncService: self.syncService, - syncDataProviders: self.syncDataProviders) - }) else { - fatalError("Could not load MainViewController") - } - + let main = MainViewController(bookmarksDatabase: bookmarksDatabase, + bookmarksDatabaseCleaner: syncDataProviders.bookmarksAdapter.databaseCleaner, + appTrackingProtectionDatabase: appTrackingProtectionDatabase, + syncService: syncService, + syncDataProviders: syncDataProviders) + main.loadViewIfNeeded() + window = UIWindow(frame: UIScreen.main.bounds) window?.rootViewController = main window?.makeKeyAndVisible() diff --git a/DuckDuckGo/BrowserChromeManager.swift b/DuckDuckGo/BrowserChromeManager.swift index d14af209d9..183f4b87d0 100644 --- a/DuckDuckGo/BrowserChromeManager.swift +++ b/DuckDuckGo/BrowserChromeManager.swift @@ -32,7 +32,7 @@ protocol BrowserChromeDelegate: AnyObject { var barsMaxHeight: CGFloat { get } var omniBar: OmniBar! { get } - var tabsBar: UIView! { get } + var tabBarContainer: UIView { get } } class BrowserChromeManager: NSObject, UIScrollViewDelegate { diff --git a/DuckDuckGo/HomeViewController.swift b/DuckDuckGo/HomeViewController.swift index f1d31543bb..f938dca3c1 100644 --- a/DuckDuckGo/HomeViewController.swift +++ b/DuckDuckGo/HomeViewController.swift @@ -51,7 +51,7 @@ class HomeViewController: UIViewController { delegate?.home(self, searchTransitionUpdated: percent) chromeDelegate?.omniBar.alpha = percent - chromeDelegate?.tabsBar.alpha = percent + chromeDelegate?.tabBarContainer.alpha = percent } } diff --git a/DuckDuckGo/MainView.swift b/DuckDuckGo/MainView.swift new file mode 100644 index 0000000000..c22ef7a3f8 --- /dev/null +++ b/DuckDuckGo/MainView.swift @@ -0,0 +1,335 @@ +// +// MainView.swift +// DuckDuckGo +// +// Copyright © 2023 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 UIKit + +class MainViewFactory { + + private let coordinator: MainViewCoordinator + + var superview: UIView { + coordinator.superview + } + + private init(_ superview: UIView) { + coordinator = MainViewCoordinator(superview: superview) + } + + static func createViewHierarchy(_ superview: UIView) -> MainViewCoordinator { + let factory = MainViewFactory(superview) + + factory.createViews() + factory.disableAutoresizingOnViewAndImmediateSubviews(superview) + factory.constrainViews() + + return factory.coordinator + } + + private func disableAutoresizingOnViewAndImmediateSubviews(_ view: UIView) { + view.translatesAutoresizingMaskIntoConstraints = false + view.subviews.forEach { + $0.translatesAutoresizingMaskIntoConstraints = false + } + } + +} + +/// Create functions. The lightweight subclases of UIView make it easier to debug to the UI. +extension MainViewFactory { + + private func createViews() { + createLogoBackground() + createContentContainer() + createSuggestionTrayContainer() + createNotificationBarContainer() + createStatusBackground() + createTabBarContainer() + createNavigationBarContainer() + createProgressView() + createToolbar() + } + + private func createProgressView() { + coordinator.progress = ProgressView() + superview.addSubview(coordinator.progress) + } + + class NavigationBarContainer: UIView { } + private func createNavigationBarContainer() { + coordinator.navigationBarContainer = NavigationBarContainer() + superview.addSubview(coordinator.navigationBarContainer) + } + + class NotificationBarContainer: UIView { } + private func createNotificationBarContainer() { + coordinator.notificationBarContainer = NotificationBarContainer() + superview.addSubview(coordinator.notificationBarContainer) + } + + class ContentContainer: UIView { } + private func createContentContainer() { + coordinator.contentContainer = ContentContainer() + superview.addSubview(coordinator.contentContainer) + } + + class StatusBackgroundView: UIView { } + private func createStatusBackground() { + coordinator.statusBackground = StatusBackgroundView() + superview.addSubview(coordinator.statusBackground) + } + + class TabBarContainer: UIView { } + private func createTabBarContainer() { + coordinator.tabBarContainer = TabBarContainer() + superview.addSubview(coordinator.tabBarContainer) + } + + class SuggestionTrayContainer: UIView { } + private func createSuggestionTrayContainer() { + coordinator.suggestionTrayContainer = SuggestionTrayContainer() + coordinator.suggestionTrayContainer.isHidden = true + coordinator.suggestionTrayContainer.backgroundColor = .clear + superview.addSubview(coordinator.suggestionTrayContainer) + } + + private func createToolbar() { + + coordinator.toolbar = HitTestingToolbar() + coordinator.toolbarBackButton = UIBarButtonItem(title: UserText.keyCommandBrowserBack, image: UIImage(named: "BrowsePrevious")) + coordinator.toolbarForwardButton = UIBarButtonItem(title: UserText.keyCommandBrowserForward, image: UIImage(named: "BrowseNext")) + coordinator.toolbarFireButton = UIBarButtonItem(title: UserText.actionForgetAll, image: UIImage(named: "Fire")) + coordinator.toolbarTabSwitcherButton = UIBarButtonItem(title: UserText.tabSwitcherAccessibilityLabel, image: UIImage(named: "Add-24")) + coordinator.lastToolbarButton = UIBarButtonItem(title: UserText.actionOpenBookmarks, image: UIImage(named: "Book-24")) + superview.addSubview(coordinator.toolbar) + + coordinator.toolbar.setItems([ + coordinator.toolbarBackButton!, + .flexibleSpace(), + coordinator.toolbarForwardButton!, + .flexibleSpace(), + coordinator.toolbarFireButton!, + .flexibleSpace(), + coordinator.toolbarTabSwitcherButton!, + .flexibleSpace(), + coordinator.lastToolbarButton!, + ], animated: true) + } + + class LogoBackgroundView: UIView { } + private func createLogoBackground() { + coordinator.logoContainer = LogoBackgroundView() + coordinator.logo = UIImageView(image: UIImage(named: "Logo")) + coordinator.logoText = UIImageView(image: UIImage(named: "TextDuckDuckGo")) + + coordinator.logoContainer.backgroundColor = .clear + coordinator.logoContainer.addSubview(coordinator.logo) + coordinator.logoContainer.addSubview(coordinator.logoText) + superview.addSubview(coordinator.logoContainer) + + disableAutoresizingOnViewAndImmediateSubviews(coordinator.logoContainer) + } + +} + +/// Add constraint functions +extension MainViewFactory { + + private func constrainViews() { + constrainLogoBackground() + constrainContentContainer() + constrainSuggestionTrayContainer() + constrainNotificationBarContainer() + constrainStatusBackground() + constrainTabBarContainer() + constrainNavigationBarContainer() + constrainProgress() + constrainToolbar() + } + + private func constrainProgress() { + let progress = coordinator.progress! + let navigationBarContainer = coordinator.navigationBarContainer! + NSLayoutConstraint.activate([ + progress.constrainView(navigationBarContainer, by: .trailing), + progress.constrainView(navigationBarContainer, by: .leading), + progress.constrainAttribute(.height, to: 3), + progress.constrainView(navigationBarContainer, by: .top, to: .bottom), + ]) + } + + private func constrainNavigationBarContainer() { + let navigationBarContainer = coordinator.navigationBarContainer! + + coordinator.constraints.navigationBarContainerTop = navigationBarContainer.constrainView(superview.safeAreaLayoutGuide, by: .top) + + NSLayoutConstraint.activate([ + navigationBarContainer.constrainView(superview, by: .centerX), + navigationBarContainer.constrainView(superview, by: .width), + coordinator.constraints.navigationBarContainerTop, + navigationBarContainer.constrainAttribute(.height, to: 52), + ]) + } + + private func constrainTabBarContainer() { + let tabBarContainer = coordinator.tabBarContainer! + + coordinator.constraints.tabBarContainerTop = tabBarContainer.constrainView(superview.safeAreaLayoutGuide, by: .top) + + NSLayoutConstraint.activate([ + tabBarContainer.constrainView(superview, by: .leading), + tabBarContainer.constrainView(superview, by: .trailing), + tabBarContainer.constrainAttribute(.height, to: 40), + coordinator.constraints.tabBarContainerTop, + ]) + } + + private func constrainStatusBackground() { + let statusBackground = coordinator.statusBackground! + let navigationBarContainer = coordinator.navigationBarContainer! + NSLayoutConstraint.activate([ + statusBackground.constrainView(superview, by: .width), + statusBackground.constrainView(superview, by: .centerX), + statusBackground.constrainView(superview, by: .top), + statusBackground.constrainView(navigationBarContainer, by: .bottom), + ]) + } + + private func constrainNotificationBarContainer() { + let notificationBarContainer = coordinator.notificationBarContainer! + let contentContainer = coordinator.contentContainer! + let navigationBarContainer = coordinator.navigationBarContainer! + + coordinator.constraints.notificationContainerTop = notificationBarContainer.constrainView(navigationBarContainer, by: .top, to: .bottom) + coordinator.constraints.notificationContainerHeight = notificationBarContainer.constrainAttribute(.height, to: 0) + + NSLayoutConstraint.activate([ + notificationBarContainer.constrainView(superview, by: .width), + notificationBarContainer.constrainView(superview, by: .centerX), + coordinator.constraints.notificationContainerHeight, + notificationBarContainer.constrainView(contentContainer, by: .bottom, to: .top), + coordinator.constraints.notificationContainerTop, + ]) + } + + private func constrainContentContainer() { + let contentContainer = coordinator.contentContainer! + let toolbar = coordinator.toolbar! + let notificationBarContainer = coordinator.notificationBarContainer! + + coordinator.constraints.contentContainerTop = contentContainer.constrainView(notificationBarContainer, by: .top, to: .bottom) + + NSLayoutConstraint.activate([ + contentContainer.constrainView(superview, by: .leading), + contentContainer.constrainView(superview, by: .trailing), + contentContainer.constrainView(toolbar, by: .bottom, to: .top), + coordinator.constraints.contentContainerTop, + ]) + } + + private func constrainToolbar() { + let toolbar = coordinator.toolbar! + coordinator.constraints.toolbarBottom = toolbar.constrainView(superview.safeAreaLayoutGuide, by: .bottom) + NSLayoutConstraint.activate([ + toolbar.constrainView(superview, by: .width), + toolbar.constrainView(superview, by: .centerX), + toolbar.constrainAttribute(.height, to: 49), + coordinator.constraints.toolbarBottom, + ]) + } + + private func constrainSuggestionTrayContainer() { + let suggestionTrayContainer = coordinator.suggestionTrayContainer! + let contentContainer = coordinator.contentContainer! + NSLayoutConstraint.activate([ + suggestionTrayContainer.constrainView(contentContainer, by: .width), + suggestionTrayContainer.constrainView(contentContainer, by: .height), + suggestionTrayContainer.constrainView(contentContainer, by: .centerX), + suggestionTrayContainer.constrainView(contentContainer, by: .centerY), + ]) + } + + private func constrainLogoBackground() { + let logoContainer = coordinator.logoContainer! + let logo = coordinator.logo! + let text = coordinator.logoText! + NSLayoutConstraint.activate([ + logoContainer.constrainView(superview, by: .width), + logoContainer.constrainView(superview, by: .height), + logoContainer.constrainView(superview, by: .centerX), + logoContainer.constrainView(superview, by: .centerY), + logo.constrainView(logoContainer, by: .centerX), + logo.constrainView(logoContainer, by: .centerY, constant: -72), + logo.constrainAttribute(.width, to: 96), + logo.constrainAttribute(.height, to: 96), + text.constrainView(logo, by: .top, to: .bottom, constant: 12), + text.constrainView(logo, by: .centerX), + ]) + } + +} + +class MainViewCoordinator { + + let superview: UIView + + var logoContainer: UIView! + var logo: UIImageView! + var logoText: UIImageView! + var toolbar: UIToolbar! + var suggestionTrayContainer: UIView! + var contentContainer: UIView! + var notificationBarContainer: UIView! + var statusBackground: UIView! + var tabBarContainer: UIView! + var navigationBarContainer: UIView! + var progress: ProgressView! + var toolbarBackButton: UIBarButtonItem! + var toolbarForwardButton: UIBarButtonItem! + var toolbarFireButton: UIBarButtonItem! + var toolbarTabSwitcherButton: UIBarButtonItem! + var lastToolbarButton: UIBarButtonItem! + + let constraints = Constraints() + + fileprivate init(superview: UIView) { + self.superview = superview + } + + func decorateWithTheme(_ theme: Theme) { + superview.backgroundColor = theme.mainViewBackgroundColor + logoText.tintColor = theme.ddgTextTintColor + } + + func hideSuggestionTray() { + suggestionTrayContainer.isHidden = true + suggestionTrayContainer.backgroundColor = .clear + } + + class Constraints { + + var navigationBarContainerTop: NSLayoutConstraint! + var toolbarBottom: NSLayoutConstraint! + var contentContainerTop: NSLayoutConstraint! + var tabBarContainerTop: NSLayoutConstraint! + var notificationContainerTop: NSLayoutConstraint! + var notificationContainerHeight: NSLayoutConstraint! + + } + +} diff --git a/DuckDuckGo/MainViewController.swift b/DuckDuckGo/MainViewController.swift index f1fc1936da..ceda17d760 100644 --- a/DuckDuckGo/MainViewController.swift +++ b/DuckDuckGo/MainViewController.swift @@ -31,8 +31,8 @@ import Persistence import PrivacyDashboard import Networking -// swiftlint:disable type_body_length // swiftlint:disable file_length +// swiftlint:disable type_body_length class MainViewController: UIViewController { // swiftlint:enable type_body_length @@ -45,34 +45,6 @@ class MainViewController: UIViewController { return isIPad ? [.left, .right] : [] } - - @IBOutlet weak var progressView: ProgressView! - - @IBOutlet weak var suggestionTrayContainer: UIView! - @IBOutlet weak var customNavigationBar: UIView! - @IBOutlet weak var containerView: UIView! - @IBOutlet weak var fireButton: UIBarButtonItem! - @IBOutlet weak var lastToolbarButton: UIBarButtonItem! - @IBOutlet weak var backButton: UIBarButtonItem! - @IBOutlet weak var forwardButton: UIBarButtonItem! - @IBOutlet weak var tabsButton: UIBarButtonItem! - @IBOutlet weak var toolbar: UIToolbar! - @IBOutlet weak var navBarTop: NSLayoutConstraint! - @IBOutlet weak var toolbarBottom: NSLayoutConstraint! - @IBOutlet weak var containerViewTop: NSLayoutConstraint! - - @IBOutlet weak var tabsBar: UIView! - @IBOutlet weak var tabsBarTop: NSLayoutConstraint! - - @IBOutlet weak var notificationContainer: UIView! - @IBOutlet weak var notificationContainerTop: NSLayoutConstraint! - @IBOutlet weak var notificationContainerHeight: NSLayoutConstraint! - - @IBOutlet weak var statusBarBackground: UIView! - - @IBOutlet weak var logoContainer: UIView! - @IBOutlet weak var logo: UIImageView! - @IBOutlet weak var logoText: UIImageView! weak var findInPageView: FindInPageView! weak var findInPageHeightLayoutConstraint: NSLayoutConstraint! @@ -85,12 +57,12 @@ class MainViewController: UIViewController { var allowContentUnderflow = false { didSet { - containerViewTop.constant = allowContentUnderflow ? contentUnderflow : 0 + viewCoordinator.constraints.contentContainerTop.constant = allowContentUnderflow ? contentUnderflow : 0 } } var contentUnderflow: CGFloat { - return 3 + (allowContentUnderflow ? -customNavigationBar.frame.size.height : 0) + return 3 + (allowContentUnderflow ? -viewCoordinator.navigationBarContainer.frame.size.height : 0) } lazy var emailManager: EmailManager = { @@ -147,12 +119,18 @@ class MainViewController: UIViewController { // Skip SERP flow (focusing on autocomplete logic) and prepare for new navigation when selecting search bar private var skipSERPFlow = true - required init?(coder: NSCoder, - bookmarksDatabase: CoreDataDatabase, - bookmarksDatabaseCleaner: BookmarkDatabaseCleaner, - appTrackingProtectionDatabase: CoreDataDatabase, - syncService: DDGSyncing, - syncDataProviders: SyncDataProviders + required init?(coder: NSCoder) { + fatalError("Use init?(code:") + } + + var viewCoordinator: MainViewCoordinator! + + init( + bookmarksDatabase: CoreDataDatabase, + bookmarksDatabaseCleaner: BookmarkDatabaseCleaner, + appTrackingProtectionDatabase: CoreDataDatabase, + syncService: DDGSyncing, + syncDataProviders: SyncDataProviders ) { self.appTrackingProtectionDatabase = appTrackingProtectionDatabase self.bookmarksDatabase = bookmarksDatabase @@ -161,12 +139,10 @@ class MainViewController: UIViewController { self.syncDataProviders = syncDataProviders self.favoritesViewModel = FavoritesListViewModel(bookmarksDatabase: bookmarksDatabase) self.bookmarksCachingSearch = BookmarksCachingSearch(bookmarksStore: CoreDataBookmarksSearchStore(bookmarksStore: bookmarksDatabase)) - super.init(coder: coder) - bindSyncService() - } - required init?(coder: NSCoder) { - fatalError("Use init?(code:") + super.init(nibName: nil, bundle: nil) + + bindSyncService() } fileprivate var tabCountInfo: TabCountInfo? @@ -197,6 +173,12 @@ class MainViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + viewCoordinator = MainViewFactory.createViewHierarchy(self.view) + + viewCoordinator.toolbarBackButton.action = #selector(onBackPressed) + viewCoordinator.toolbarForwardButton.action = #selector(onForwardPressed) + viewCoordinator.toolbarFireButton.action = #selector(onFirePressed) + loadSuggestionTray() loadTabsBarIfNeeded() loadFindInPage() @@ -237,6 +219,9 @@ class MainViewController: UIViewController { startOnboardingFlowIfNotSeenBefore() tabsBarController?.refresh(tabsModel: tabManager.model) + _ = AppWidthObserver.shared.willResize(toWidth: view.frame.width) + applyWidth() + if DaxDialogs.shared.shouldShowFireButtonPulse { showFireButtonPulse() } @@ -259,8 +244,8 @@ class MainViewController: UIViewController { return } - controller.view.frame = suggestionTrayContainer.bounds - suggestionTrayContainer.addSubview(controller.view) + controller.view.frame = viewCoordinator.suggestionTrayContainer.bounds + viewCoordinator.suggestionTrayContainer.addSubview(controller.view) controller.dismissHandler = dismissSuggestionTray controller.autocompleteDelegate = self @@ -273,9 +258,9 @@ class MainViewController: UIViewController { let storyboard = UIStoryboard(name: "TabSwitcher", bundle: nil) let controller: TabsBarViewController = storyboard.instantiateViewController(identifier: "TabsBar") - controller.view.frame = tabsBar.bounds + controller.view.frame = viewCoordinator.tabBarContainer.bounds controller.delegate = self - tabsBar.addSubview(controller.view) + viewCoordinator.tabBarContainer.addSubview(controller.view) tabsBarController = controller } @@ -358,15 +343,15 @@ class MainViewController: UIViewController { private func initTabButton() { tabSwitcherButton.delegate = self - tabsButton.customView = tabSwitcherButton - tabsButton.isAccessibilityElement = true - tabsButton.accessibilityTraits = .button + viewCoordinator.toolbarTabSwitcherButton.customView = tabSwitcherButton + viewCoordinator.toolbarTabSwitcherButton.isAccessibilityElement = true + viewCoordinator.toolbarTabSwitcherButton.accessibilityTraits = .button } private func initMenuButton() { - lastToolbarButton.customView = menuButton - lastToolbarButton.isAccessibilityElement = true - lastToolbarButton.accessibilityTraits = .button + viewCoordinator.lastToolbarButton.customView = menuButton + viewCoordinator.lastToolbarButton.isAccessibilityElement = true + viewCoordinator.lastToolbarButton.accessibilityTraits = .button menuButton.delegate = self } @@ -409,21 +394,6 @@ class MainViewController: UIViewController { Pixel.fire(pixel: .tabBarBookmarksLongPressed) currentTab?.saveAsBookmark(favorite: true, viewModel: menuBookmarksViewModel) } - - @IBSegueAction func onCreateSuggestionTray(_ coder: NSCoder, sender: Any?, segueIdentifier: String?) -> SuggestionTrayViewController { - guard let controller = SuggestionTrayViewController(coder: coder, - favoritesViewModel: favoritesViewModel, - bookmarksSearch: bookmarksCachingSearch) else { - fatalError("Failed to create controller") - } - - controller.dismissHandler = dismissSuggestionTray - controller.autocompleteDelegate = self - controller.favoritesOverlayDelegate = self - suggestionTrayController = controller - - return controller - } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) @@ -512,12 +482,12 @@ class MainViewController: UIViewController { omniBar = OmniBar.loadFromXib() omniBar.omniDelegate = self omniBar.menuButtonContent.delegate = self - omniBar.frame = customNavigationBar.bounds - customNavigationBar.addSubview(omniBar) + omniBar.frame = viewCoordinator.navigationBarContainer.bounds + viewCoordinator.navigationBarContainer.addSubview(omniBar) } fileprivate func attachHomeScreen() { - logoContainer.isHidden = false + viewCoordinator.logoContainer.isHidden = false findInPageView.isHidden = true chromeManager.detach() @@ -558,7 +528,7 @@ class MainViewController: UIViewController { let alert = ForgetDataAlert.buildAlert(forgetTabsAndDataHandler: { [weak self] in self?.forgetAllWithAnimation {} }) - self.present(controller: alert, fromView: self.toolbar) + self.present(controller: alert, fromView: self.viewCoordinator.toolbar) } } @@ -607,7 +577,7 @@ class MainViewController: UIViewController { func loadUrlInNewTab(_ url: URL, reuseExisting: Bool = false, inheritedAttribution: AdClickAttributionLogic.State?) { allowContentUnderflow = false - customNavigationBar.alpha = 1 + viewCoordinator.navigationBarContainer.alpha = 1 loadViewIfNeeded() if reuseExisting, let existing = tabManager.first(withUrl: url) { selectTab(existing) @@ -662,7 +632,7 @@ class MainViewController: UIViewController { } private func prepareTabForRequest(request: () -> Void) { - customNavigationBar.alpha = 1 + viewCoordinator.navigationBarContainer.alpha = 1 allowContentUnderflow = false request() guard let tab = currentTab else { fatalError("no tab") } @@ -677,7 +647,7 @@ class MainViewController: UIViewController { } func select(tabAt index: Int) { - customNavigationBar.alpha = 1 + viewCoordinator.navigationBarContainer.alpha = 1 allowContentUnderflow = false let tab = tabManager.select(tabAt: index) select(tab: tab) @@ -702,16 +672,16 @@ class MainViewController: UIViewController { currentTab?.progressWorker.progressBar = nil currentTab?.chromeDelegate = nil addToView(controller: tab) - tab.progressWorker.progressBar = progressView + tab.progressWorker.progressBar = viewCoordinator.progress chromeManager.attach(to: tab.webView.scrollView) tab.chromeDelegate = self } private func addToView(controller: UIViewController) { addChild(controller) - containerView.subviews.forEach { $0.removeFromSuperview() } - containerView.addSubview(controller.view) - controller.view.frame = containerView.bounds + viewCoordinator.contentContainer.subviews.forEach { $0.removeFromSuperview() } + viewCoordinator.contentContainer.addSubview(controller.view) + controller.view.frame = viewCoordinator.contentContainer.bounds controller.didMove(toParent: self) } @@ -734,7 +704,7 @@ class MainViewController: UIViewController { } private func refreshTabIcon() { - tabsButton.accessibilityHint = UserText.numberOfTabs(tabManager.count) + viewCoordinator.toolbarTabSwitcherButton.accessibilityHint = UserText.numberOfTabs(tabManager.count) tabSwitcherButton.tabCount = tabManager.count tabSwitcherButton.hasUnread = tabManager.hasUnread } @@ -765,11 +735,11 @@ class MainViewController: UIViewController { } fileprivate func refreshBackForwardButtons() { - backButton.isEnabled = currentTab?.canGoBack ?? false - forwardButton.isEnabled = currentTab?.canGoForward ?? false + viewCoordinator.toolbarBackButton.isEnabled = currentTab?.canGoBack ?? false + viewCoordinator.toolbarForwardButton.isEnabled = currentTab?.canGoForward ?? false - omniBar.backButton.isEnabled = backButton.isEnabled - omniBar.forwardButton.isEnabled = forwardButton.isEnabled + omniBar.backButton.isEnabled = viewCoordinator.toolbarBackButton.isEnabled + omniBar.forwardButton.isEnabled = viewCoordinator.toolbarForwardButton.isEnabled } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { @@ -798,7 +768,7 @@ class MainViewController: UIViewController { DispatchQueue.main.async { // Do this async otherwise the toolbar buttons skew to the right - if self.navBarTop.constant >= 0 { + if self.viewCoordinator.constraints.navigationBarContainerTop.constant >= 0 { self.showBars() } // If tabs have been udpated, do this async to make sure size calcs are current @@ -815,7 +785,7 @@ class MainViewController: UIViewController { let expectedState: MenuButton.State if homeController != nil { expectedState = .bookmarksImage - lastToolbarButton.accessibilityLabel = UserText.bookmarksButtonHint + viewCoordinator.lastToolbarButton.accessibilityLabel = UserText.bookmarksButtonHint omniBar.menuButton.accessibilityLabel = UserText.bookmarksButtonHint } else { @@ -824,7 +794,7 @@ class MainViewController: UIViewController { } else { expectedState = .menuImage } - lastToolbarButton.accessibilityLabel = UserText.menuButtonHint + viewCoordinator.lastToolbarButton.accessibilityLabel = UserText.menuButtonHint omniBar.menuButton.accessibilityLabel = UserText.menuButtonHint } @@ -841,14 +811,14 @@ class MainViewController: UIViewController { } private func applyLargeWidth() { - tabsBar.isHidden = false - toolbar.isHidden = true + viewCoordinator.tabBarContainer.isHidden = false + viewCoordinator.toolbar.isHidden = true omniBar.enterPadState() } private func applySmallWidth() { - tabsBar.isHidden = true - toolbar.isHidden = false + viewCoordinator.tabBarContainer.isHidden = true + viewCoordinator.toolbar.isHidden = false omniBar.enterPhoneState() } @@ -872,13 +842,13 @@ class MainViewController: UIViewController { omniBar.hideSeparator() } } - suggestionTrayContainer.isHidden = false + viewCoordinator.suggestionTrayContainer.isHidden = false currentTab?.webView.accessibilityElementsHidden = true } func hideSuggestionTray() { omniBar.showSeparator() - suggestionTrayContainer.isHidden = true + viewCoordinator.suggestionTrayContainer.isHidden = true currentTab?.webView.accessibilityElementsHidden = false suggestionTrayController?.didHide() } @@ -912,7 +882,7 @@ class MainViewController: UIViewController { super.viewDidLayoutSubviews() notificationView?.layoutSubviews() let height = notificationView?.frame.size.height ?? 0 - notificationContainerHeight.constant = height + viewCoordinator.constraints.notificationContainerHeight.constant = height ViewHighlighter.updatePositions() } @@ -922,13 +892,13 @@ class MainViewController: UIViewController { notificationView.setTitle(text: title) notificationView.setMessage(text: message) - notificationContainer.addSubview(notificationView) - notificationContainerTop.constant = -notificationView.frame.size.height + viewCoordinator.notificationBarContainer.addSubview(notificationView) + viewCoordinator.constraints.notificationContainerTop.constant = -notificationView.frame.size.height self.notificationView = notificationView DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - self.notificationContainerTop.constant = 0 - self.notificationContainerHeight.constant = notificationView.frame.size.height + self.viewCoordinator.constraints.notificationContainerTop.constant = 0 + self.viewCoordinator.constraints.notificationContainerHeight.constant = notificationView.frame.size.height UIView.animate(withDuration: 0.3) { self.view.layoutIfNeeded() } @@ -938,12 +908,12 @@ class MainViewController: UIViewController { func hideNotification() { - notificationContainerTop.constant = -(notificationView?.frame.size.height ?? 0) - notificationContainerHeight.constant = 0 + viewCoordinator.constraints.notificationContainerTop.constant = -(notificationView?.frame.size.height ?? 0) + viewCoordinator.constraints.notificationContainerHeight.constant = 0 UIView.animate(withDuration: 0.5, animations: { self.view.layoutIfNeeded() }, completion: { _ in - self.notificationContainerTop.constant = 0 + self.viewCoordinator.constraints.notificationContainerTop.constant = 0 self.notificationView?.removeFromSuperview() }) @@ -969,13 +939,13 @@ class MainViewController: UIViewController { } func replaceToolbar(item target: UIBarButtonItem, with replacement: UIBarButtonItem) { - guard let items = toolbar.items else { return } + guard let items = viewCoordinator.toolbar.items else { return } let newItems = items.compactMap({ $0 == target ? replacement : $0 }) - toolbar.setItems(newItems, animated: false) + viewCoordinator.toolbar.setItems(newItems, animated: false) } func newTab(reuseExisting: Bool = false, allowingKeyboard: Bool = true) { @@ -997,12 +967,12 @@ class MainViewController: UIViewController { } func animateLogoAppearance() { - logoContainer.alpha = 0 - logoContainer.transform = CGAffineTransform(scaleX: 0.5, y: 0.5) + viewCoordinator.logoContainer.alpha = 0 + viewCoordinator.logoContainer.transform = CGAffineTransform(scaleX: 0.5, y: 0.5) DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { UIView.animate(withDuration: 0.2) { - self.logoContainer.alpha = 1 - self.logoContainer.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) + self.viewCoordinator.logoContainer.alpha = 1 + self.viewCoordinator.logoContainer.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) } } } @@ -1011,7 +981,7 @@ class MainViewController: UIViewController { currentTab?.findInPage?.delegate = self findInPageView.update(with: currentTab?.findInPage, updateTextField: true) // hide toolbar on iPhone - toolbar.accessibilityElementsHidden = !AppWidthObserver.shared.isLargeWidth + viewCoordinator.toolbar.accessibilityElementsHidden = !AppWidthObserver.shared.isLargeWidth } private func showVoiceSearch() { @@ -1094,7 +1064,7 @@ extension MainViewController: FindInPageViewDelegate { func done(findInPageView: FindInPageView) { currentTab?.findInPage = nil - toolbar.accessibilityElementsHidden = false + viewCoordinator.toolbar.accessibilityElementsHidden = false } } @@ -1105,6 +1075,10 @@ extension MainViewController: BrowserChromeDelegate { static let duration = 0.1 } + var tabBarContainer: UIView { + viewCoordinator.tabBarContainer + } + private func hideKeyboard() { dismissOmniBar() _ = findInPageView.resignFirstResponder() @@ -1131,8 +1105,8 @@ extension MainViewController: BrowserChromeDelegate { self.view.layoutIfNeeded() self.omniBar.alpha = percent - self.tabsBar.alpha = percent - self.toolbar.alpha = percent + self.viewCoordinator.tabBarContainer.alpha = percent + self.viewCoordinator.toolbar.alpha = percent } if animated { @@ -1147,8 +1121,8 @@ extension MainViewController: BrowserChromeDelegate { updateNavBarConstant(hidden ? 0 : 1.0) omniBar.alpha = hidden ? 0 : 1 - tabsBar.alpha = hidden ? 0 : 1 - statusBarBackground.alpha = hidden ? 0 : 1 + viewCoordinator.tabBarContainer.alpha = hidden ? 0 : 1 + viewCoordinator.statusBackground.alpha = hidden ? 0 : 1 } var canHideBars: Bool { @@ -1156,11 +1130,11 @@ extension MainViewController: BrowserChromeDelegate { } var isToolbarHidden: Bool { - return toolbar.alpha < 1 + return viewCoordinator.toolbar.alpha < 1 } var toolbarHeight: CGFloat { - return toolbar.frame.size.height + return viewCoordinator.toolbar.frame.size.height } var barsMaxHeight: CGFloat { @@ -1171,20 +1145,20 @@ extension MainViewController: BrowserChromeDelegate { private func updateToolbarConstant(_ ratio: CGFloat) { var bottomHeight = toolbarHeight bottomHeight += view.safeAreaInsets.bottom - let multiplier = toolbar.isHidden ? 1.0 : 1.0 - ratio - toolbarBottom.constant = bottomHeight * multiplier + let multiplier = viewCoordinator.toolbar.isHidden ? 1.0 : 1.0 - ratio + viewCoordinator.constraints.toolbarBottom.constant = bottomHeight * multiplier findInPageHeightLayoutConstraint.constant = findInPageView.container.frame.height + view.safeAreaInsets.bottom } // 1.0 - full size, 0.0 - hidden private func updateNavBarConstant(_ ratio: CGFloat) { - let browserTabsOffset = (tabsBar.isHidden ? 0 : tabsBar.frame.size.height) - let navBarTopOffset = customNavigationBar.frame.size.height + browserTabsOffset - if !tabsBar.isHidden { + let browserTabsOffset = (viewCoordinator.tabBarContainer.isHidden ? 0 : viewCoordinator.tabBarContainer.frame.size.height) + let navBarTopOffset = viewCoordinator.navigationBarContainer.frame.size.height + browserTabsOffset + if !viewCoordinator.tabBarContainer.isHidden { let topBarsConstant = -browserTabsOffset * (1.0 - ratio) - tabsBarTop.constant = topBarsConstant + viewCoordinator.constraints.tabBarContainerTop.constant = topBarsConstant } - navBarTop.constant = browserTabsOffset + -navBarTopOffset * (1.0 - ratio) + viewCoordinator.constraints.navigationBarContainerTop.constant = browserTabsOffset + -navBarTopOffset * (1.0 - ratio) } } @@ -1279,7 +1253,7 @@ extension MainViewController: OmniBarDelegate { } func onEnterPressed() { - guard !suggestionTrayContainer.isHidden else { return } + guard !viewCoordinator.suggestionTrayContainer.isHidden else { return } suggestionTrayController?.willDismiss(with: omniBar.textField.text ?? "") } @@ -1457,16 +1431,16 @@ extension MainViewController: HomeControllerDelegate { } func home(_ home: HomeViewController, didRequestHideLogo hidden: Bool) { - logoContainer.isHidden = hidden + viewCoordinator.logoContainer.isHidden = hidden } func homeDidRequestLogoContainer(_ home: HomeViewController) -> UIView { - return logoContainer + return viewCoordinator.logoContainer } func home(_ home: HomeViewController, searchTransitionUpdated percent: CGFloat) { - statusBarBackground?.alpha = percent - customNavigationBar?.alpha = percent + viewCoordinator.statusBackground.alpha = percent + viewCoordinator.navigationBarContainer.alpha = percent } } @@ -1863,10 +1837,10 @@ extension MainViewController: AutoClearWorker { guard let window = view.window else { return } let fireButtonView: UIView? - if toolbar.isHidden { + if viewCoordinator.toolbar.isHidden { fireButtonView = tabsBarController?.fireButton } else { - fireButtonView = fireButton.value(forKey: "view") as? UIView + fireButtonView = viewCoordinator.toolbarFireButton.value(forKey: "view") as? UIView } guard let view = fireButtonView else { return } @@ -1884,25 +1858,25 @@ extension MainViewController: Themable { setNeedsStatusBarAppearanceUpdate() if AppWidthObserver.shared.isLargeWidth { - statusBarBackground.backgroundColor = theme.tabsBarBackgroundColor + viewCoordinator.statusBackground.backgroundColor = theme.tabsBarBackgroundColor } else { - statusBarBackground.backgroundColor = theme.omniBarBackgroundColor + viewCoordinator.statusBackground.backgroundColor = theme.omniBarBackgroundColor } view.backgroundColor = theme.mainViewBackgroundColor - customNavigationBar?.backgroundColor = theme.barBackgroundColor - customNavigationBar?.tintColor = theme.barTintColor + viewCoordinator.navigationBarContainer.backgroundColor = theme.barBackgroundColor + viewCoordinator.navigationBarContainer.tintColor = theme.barTintColor - omniBar?.decorate(with: theme) - progressView?.decorate(with: theme) + omniBar.decorate(with: theme) + viewCoordinator.progress.decorate(with: theme) - toolbar?.barTintColor = theme.barBackgroundColor - toolbar?.tintColor = theme.barTintColor + viewCoordinator.toolbar.barTintColor = theme.barBackgroundColor + viewCoordinator.toolbar.tintColor = theme.barTintColor tabSwitcherButton.decorate(with: theme) gestureBookmarksButton.decorate(with: theme) - tabsButton.tintColor = theme.barTintColor + viewCoordinator.toolbarTabSwitcherButton.tintColor = theme.barTintColor presentedMenuButton.decorate(with: theme) @@ -1910,7 +1884,7 @@ extension MainViewController: Themable { findInPageView.decorate(with: theme) - logoText.tintColor = theme.ddgTextTintColor + viewCoordinator.logoText.tintColor = theme.ddgTextTintColor } } @@ -1983,11 +1957,11 @@ extension MainViewController { let backMenu = historyMenu(with: currentTab.webView.backForwardList.backList.reversed()) omniBar.backButton.menu = backMenu - backButton.menu = backMenu + viewCoordinator.toolbarBackButton.menu = backMenu let forwardMenu = historyMenu(with: currentTab.webView.backForwardList.forwardList) omniBar.forwardButton.menu = forwardMenu - forwardButton.menu = forwardMenu + viewCoordinator.toolbarForwardButton.menu = forwardMenu } private func historyMenu(with backForwardList: [WKBackForwardListItem]) -> UIMenu { diff --git a/DuckDuckGo/UIView+Constraints.swift b/DuckDuckGo/UIView+Constraints.swift index 65c2f0cbf3..4daabe252e 100644 --- a/DuckDuckGo/UIView+Constraints.swift +++ b/DuckDuckGo/UIView+Constraints.swift @@ -21,9 +21,9 @@ import UIKit extension UIView { - func constrainView(_ other: UIView, + func constrainView(_ other: Any, by attribute: NSLayoutConstraint.Attribute, - to otherAttribute: NSLayoutConstraint.Attribute, + to otherAttribute: NSLayoutConstraint.Attribute? = nil, relatedBy relation: NSLayoutConstraint.Relation = .equal, multiplier: Double = 1.0, constant: Double = 0.0) -> NSLayoutConstraint { @@ -32,7 +32,7 @@ extension UIView { attribute: attribute, relatedBy: relation, toItem: other, - attribute: otherAttribute, + attribute: otherAttribute ?? attribute, multiplier: multiplier, constant: constant) diff --git a/DuckDuckGo/bg.lproj/Main.strings b/DuckDuckGo/bg.lproj/Main.strings deleted file mode 100644 index d227fca0ed..0000000000 --- a/DuckDuckGo/bg.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Сърфиране напред"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Превключване на раздели"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Сърфиране назад"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Отметки"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Затваряне на всички раздели и изчистване на данните"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 от 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Готово"; - diff --git a/DuckDuckGo/cs.lproj/Main.strings b/DuckDuckGo/cs.lproj/Main.strings deleted file mode 100644 index 4ed4a36e30..0000000000 --- a/DuckDuckGo/cs.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Procházet dopředu"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Přepínač karet"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Procházet zpátky"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Záložky"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Zavřít všechny karty a vymazat data"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 z 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Hotovo"; - diff --git a/DuckDuckGo/da.lproj/Main.strings b/DuckDuckGo/da.lproj/Main.strings deleted file mode 100644 index 83131719e5..0000000000 --- a/DuckDuckGo/da.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Gennemse fremad"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Faneskifter"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Gennemse tilbage"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Bogmærker"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Luk alle faner og ryd data"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 af 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Færdig"; - diff --git a/DuckDuckGo/de.lproj/Main.strings b/DuckDuckGo/de.lproj/Main.strings deleted file mode 100644 index b2f9f23424..0000000000 --- a/DuckDuckGo/de.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Vorwärts"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Tabwechsel-Bildschirm"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Zurück"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Lesezeichen"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Alle Tabs schließen und Daten löschen"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 von 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Fertig"; - diff --git a/DuckDuckGo/el.lproj/Main.strings b/DuckDuckGo/el.lproj/Main.strings deleted file mode 100644 index f4a511320c..0000000000 --- a/DuckDuckGo/el.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Περιήγηση προς τα μπροστά"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Εναλλαγή καρτελών"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Περιήγηση προς τα πίσω"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Σελιδοδείκτες"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Κλείσιμο όλων των καρτελών και εκκαθάριση δεδομένων"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 από 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Ολοκληρώθηκε"; - diff --git a/DuckDuckGo/es.lproj/Main.strings b/DuckDuckGo/es.lproj/Main.strings deleted file mode 100644 index 0bc0cac4cc..0000000000 --- a/DuckDuckGo/es.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Avanzar"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Cambiar pestañas"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Retroceder"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Marcadores"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Cerrar todas las pestañas y borrar los datos"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 de 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Hecho"; - diff --git a/DuckDuckGo/et.lproj/Main.strings b/DuckDuckGo/et.lproj/Main.strings deleted file mode 100644 index f6ef3e05b0..0000000000 --- a/DuckDuckGo/et.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Sirvi edasi"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Vahekaardi vaheldaja"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Sirvi tagasi"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Järjehoidjad"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Sulge kõik vahekaardid ja kustuta andmed"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 / 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Valmis"; - diff --git a/DuckDuckGo/fi.lproj/Main.strings b/DuckDuckGo/fi.lproj/Main.strings deleted file mode 100644 index f0b1e8064c..0000000000 --- a/DuckDuckGo/fi.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Selaa eteenpäin"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Välilehtien vaihtotyökalu"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Selaa taaksepäin"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Kirjanmerkit"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Sulje kaikki välilehdet ja tyhjennä tiedot"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1/12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Valmis"; - diff --git a/DuckDuckGo/fr.lproj/Main.strings b/DuckDuckGo/fr.lproj/Main.strings deleted file mode 100644 index 8ff3d6c928..0000000000 --- a/DuckDuckGo/fr.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Afficher la page suivante"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Outil de changement d'onglet"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Afficher la page précédente"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Signets"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Fermer tous les onglets et effacer les données"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 sur 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Terminé"; - diff --git a/DuckDuckGo/hr.lproj/Main.strings b/DuckDuckGo/hr.lproj/Main.strings deleted file mode 100644 index b272121196..0000000000 --- a/DuckDuckGo/hr.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Pretraži unaprijed"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Mjenjač kartica"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Pretraži unazad"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Knjižne oznake"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Zatvori sve kartice i očisti podatke"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 od 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Gotovo"; - diff --git a/DuckDuckGo/hu.lproj/Main.strings b/DuckDuckGo/hu.lproj/Main.strings deleted file mode 100644 index 20a12da220..0000000000 --- a/DuckDuckGo/hu.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Böngészés előre"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Lapváltó"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Böngészés vissza"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Könyvjelzők"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Összes lap bezárása és adattörlés"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1/12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Kész"; - diff --git a/DuckDuckGo/it.lproj/Main.strings b/DuckDuckGo/it.lproj/Main.strings deleted file mode 100644 index d98e3e79a0..0000000000 --- a/DuckDuckGo/it.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Vai avanti"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Selettore schede"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Torna indietro"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Segnalibri"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Chiudi tutte le schede e cancella i dati"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 di 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Fatto"; - diff --git a/DuckDuckGo/lt.lproj/Main.strings b/DuckDuckGo/lt.lproj/Main.strings deleted file mode 100644 index 802a934cc0..0000000000 --- a/DuckDuckGo/lt.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Naršyti pirmyn"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Skirtukų perjungiklis"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Naršyti atgal"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Žymės"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Uždaryti visus skirtukus ir išvalyti duomenis"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 iš 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Atlikta"; - diff --git a/DuckDuckGo/lv.lproj/Main.strings b/DuckDuckGo/lv.lproj/Main.strings deleted file mode 100644 index 90b6fcf657..0000000000 --- a/DuckDuckGo/lv.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Pārlūkot uz priekšu"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Ciļņu pārslēdzējs"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Pārlūkot atpakaļ"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Grāmatzīmes"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Aizvērt visas cilnes un notīrīt datus"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 no 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Gatavs"; - diff --git a/DuckDuckGo/nb.lproj/Main.strings b/DuckDuckGo/nb.lproj/Main.strings deleted file mode 100644 index 50c970d34d..0000000000 --- a/DuckDuckGo/nb.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Gå frem"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Fanebytter"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Gå tilbake"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Bokmerker"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Lukk alle faner og slett data"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 av 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Ferdig"; - diff --git a/DuckDuckGo/nl.lproj/Main.strings b/DuckDuckGo/nl.lproj/Main.strings deleted file mode 100644 index 7136ee440a..0000000000 --- a/DuckDuckGo/nl.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Vooruit browsen"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Wisselen tussen tabbladen"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Terug browsen"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Bladwijzers"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Alle tabbladen sluiten en gegevens wissen"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 van 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Klaar"; - diff --git a/DuckDuckGo/pl.lproj/Main.strings b/DuckDuckGo/pl.lproj/Main.strings deleted file mode 100644 index f3a3e28e05..0000000000 --- a/DuckDuckGo/pl.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Przeglądaj dalej"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Przełącznik kart"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Przeglądaj wstecz"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Zakładki"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Zamknij wszystkie karty i wyczyść dane"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 z 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Gotowe"; - diff --git a/DuckDuckGo/pt.lproj/Main.strings b/DuckDuckGo/pt.lproj/Main.strings deleted file mode 100644 index 3bb92a1fbb..0000000000 --- a/DuckDuckGo/pt.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Navegar para a frente"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Alternar de separador"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Navegar para trás"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Marcadores"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Fechar todos os separadores e limpar os dados"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 de 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Feito"; - diff --git a/DuckDuckGo/ro.lproj/Main.strings b/DuckDuckGo/ro.lproj/Main.strings deleted file mode 100644 index cdc12a056d..0000000000 --- a/DuckDuckGo/ro.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Navigare înainte"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Comutator între file"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Navigare înapoi"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Semne de carte"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Închide toate filele și șterge datele"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 din 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Terminat"; - diff --git a/DuckDuckGo/ru.lproj/Main.strings b/DuckDuckGo/ru.lproj/Main.strings deleted file mode 100644 index ad87d393bf..0000000000 --- a/DuckDuckGo/ru.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Вперед"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Переключатель вкладок"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Назад"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Закладки"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Закрыть все вкладки и удалить данные"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 из 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Готово"; - diff --git a/DuckDuckGo/sk.lproj/Main.strings b/DuckDuckGo/sk.lproj/Main.strings deleted file mode 100644 index 3e86b1d44b..0000000000 --- a/DuckDuckGo/sk.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Prehliadajte dopredu"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Prepínač kariet"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Prehliadajte dozadu"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Záložky"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Zatvoriť všetky karty a vymazať údaje"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 z 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Hotovo"; - diff --git a/DuckDuckGo/sl.lproj/Main.strings b/DuckDuckGo/sl.lproj/Main.strings deleted file mode 100644 index e8129b28f8..0000000000 --- a/DuckDuckGo/sl.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Brskaj naprej"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Preklopi med zavihki"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Brskaj nazaj"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Zaznamki"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Zapri vse zavihke in izbriši podatke"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 od 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Končano"; - diff --git a/DuckDuckGo/sv.lproj/Main.strings b/DuckDuckGo/sv.lproj/Main.strings deleted file mode 100644 index 85c434c49f..0000000000 --- a/DuckDuckGo/sv.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "Bläddra framåt"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Flikväxlare"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Bläddra tillbaka"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Bokmärken"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Stäng alla flikar och rensa data"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1 av 12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Klart"; - diff --git a/DuckDuckGo/tr.lproj/Main.strings b/DuckDuckGo/tr.lproj/Main.strings deleted file mode 100644 index 9f6e3a39ae..0000000000 --- a/DuckDuckGo/tr.lproj/Main.strings +++ /dev/null @@ -1,21 +0,0 @@ -/* Class = "UIBarButtonItem"; title = "Browse Forward"; ObjectID = "cUp-YP-aMf"; */ -"cUp-YP-aMf.title" = "İleri Git"; - -/* Class = "UIBarButtonItem"; title = "Tab Switcher"; ObjectID = "K7o-WL-SC5"; */ -"K7o-WL-SC5.title" = "Sekme Değiştirici"; - -/* Class = "UIBarButtonItem"; title = "Browse Back"; ObjectID = "Kc6-IR-lKx"; */ -"Kc6-IR-lKx.title" = "Geri Dön"; - -/* Class = "UIBarButtonItem"; title = "Bookmarks"; ObjectID = "M7u-mw-fly"; */ -"M7u-mw-fly.title" = "Yer İmleri"; - -/* Class = "UIBarButtonItem"; title = "Close all tabs and clear data"; ObjectID = "ntb-c7-mjV"; */ -"ntb-c7-mjV.title" = "Tüm sekmeleri kapat ve verileri temizle"; - -/* Class = "UILabel"; text = "1 of 12"; ObjectID = "rSE-zZ-iud"; */ -"rSE-zZ-iud.text" = "1/12"; - -/* Class = "UIButton"; normalTitle = "Done"; ObjectID = "X8N-Ee-U1n"; */ -"X8N-Ee-U1n.normalTitle" = "Bitti"; - diff --git a/DuckDuckGoTests/BarsAnimatorTests.swift b/DuckDuckGoTests/BarsAnimatorTests.swift index 198ba820a9..40efd123f9 100644 --- a/DuckDuckGoTests/BarsAnimatorTests.swift +++ b/DuckDuckGoTests/BarsAnimatorTests.swift @@ -181,5 +181,5 @@ private class BrowserChromeDelegateMock: BrowserChromeDelegate { var omniBar: OmniBar! = OmniBar(frame: CGRect(x: 0, y: 0, width: 300, height: 30)) - var tabsBar: UIView! = UIView() + var tabBarContainer: UIView = UIView() }