From adf7fcfd323349854234a07e1cb84734e30423da Mon Sep 17 00:00:00 2001 From: Cyndi Chin Date: Mon, 7 Oct 2024 11:32:53 -0400 Subject: [PATCH] Refactor FXIOS-10221 [Homepage] Naming conventions for old homepage (#22426) --- .../Common/Logger/LoggerCategory.swift | 9 ++- firefox-ios/Client.xcodeproj/project.pbxproj | 56 ++++++------- .../Browser/BrowserCoordinator.swift | 70 ++++++++-------- .../Browser/BrowserDelegate.swift | 16 ++-- .../BrowserViewController+KeyCommands.swift | 18 ++--- ...BrowserViewController+URLBarDelegate.swift | 2 +- ...owserViewController+WebViewDelegates.swift | 2 +- .../Views/BrowserViewController.swift | 20 ++--- .../Components/ContentContainer.swift | 20 ++--- .../HistoryHighlightsViewModel.swift | 2 +- ...swift => HomepageDiffableDataSource.swift} | 6 +- ...ft => HomepageSectionLayoutProvider.swift} | 4 +- ...ler.swift => HomepageViewController.swift} | 18 ++--- .../Frontend/Home/HomepageViewModel.swift | 2 +- .../Home/JumpBackIn/JumpBackInViewModel.swift | 4 +- ...ift => LegacyHomepageViewController.swift} | 32 ++++---- .../PrivateHomepageViewController.swift | 2 +- .../DataManagement/ContileNetworking.swift | 4 +- .../DataManagement/ContileProvider.swift | 4 +- .../v1/Interface/WallpaperManager.swift | 6 +- .../Utilities/WallpaperFilePathProvider.swift | 8 +- .../Utilities/WallpaperMetadataUtility.swift | 4 +- .../Utilities/WallpaperMigrationUtility.swift | 2 +- .../Utilities/WallpaperStorageUtility.swift | 2 +- .../Utilities/WallpaperThumbnailUtility.swift | 2 +- .../v1/WallpaperSettingsViewController.swift | 2 +- .../CertificatesHandler.swift | 4 +- .../BrowserCoordinatorTests.swift | 80 ++++++++++--------- .../Frontend/ContentContainerTests.swift | 50 ++++++------ ...> LegacyHomepageViewControllerTests.swift} | 14 ++-- ... => HomepageDiffableDataSourceTests.swift} | 6 +- ...wift => HomepageViewControllerTests.swift} | 10 +-- 32 files changed, 252 insertions(+), 229 deletions(-) rename firefox-ios/Client/Frontend/Home/Homepage Rebuild/{NewHomepageDiffableDataSource.swift => HomepageDiffableDataSource.swift} (92%) rename firefox-ios/Client/Frontend/Home/Homepage Rebuild/{NewHomepageCompositionalLayout.swift => HomepageSectionLayoutProvider.swift} (97%) rename firefox-ios/Client/Frontend/Home/Homepage Rebuild/{NewHomepageViewController.swift => HomepageViewController.swift} (86%) rename firefox-ios/Client/Frontend/Home/{HomepageViewController.swift => LegacyHomepageViewController.swift} (97%) rename firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/{HomepageViewControllerTests.swift => LegacyHomepageViewControllerTests.swift} (85%) rename firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/{NewHomepageDiffableDataSourceTests.swift => HomepageDiffableDataSourceTests.swift} (93%) rename firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/{NewHomepageViewControllerTests.swift => HomepageViewControllerTests.swift} (87%) diff --git a/BrowserKit/Sources/Common/Logger/LoggerCategory.swift b/BrowserKit/Sources/Common/Logger/LoggerCategory.swift index 3c92a109d126..4f0e9164fa3d 100644 --- a/BrowserKit/Sources/Common/Logger/LoggerCategory.swift +++ b/BrowserKit/Sources/Common/Logger/LoggerCategory.swift @@ -14,17 +14,20 @@ public enum LoggerCategory: String { /// Related to address and credit card autofill case autofill + /// Related to the certificate handler + case certificate + /// Related to coordinator navigation case coordinator /// Related to experiments, nimbus and the messaging framework. case experiments - /// Related to homepage UI and it's data management. - case homepage + /// Related to old homepage UI and it's data management. To be replaced by the homepage rebuild project. + case legacyHomepage /// Related to new homepage UI and it's data management for the homepage rebuild project. - case newHomepage + case homepage /// Related to errors around image fetches, and includes all image types (`SiteImageType`, and general images). case images diff --git a/firefox-ios/Client.xcodeproj/project.pbxproj b/firefox-ios/Client.xcodeproj/project.pbxproj index 8e57a73e0025..7d44873a0604 100644 --- a/firefox-ios/Client.xcodeproj/project.pbxproj +++ b/firefox-ios/Client.xcodeproj/project.pbxproj @@ -319,7 +319,7 @@ 3B61CD631F2A769D00D38DE1 /* pocketglobalfeed.json in Resources */ = {isa = PBXBuildFile; fileRef = 3B61CD621F2A769D00D38DE1 /* pocketglobalfeed.json */; }; 3B6F40181DC7849C00656CC6 /* TopSitesViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B6F40171DC7849C00656CC6 /* TopSitesViewModelTests.swift */; }; 3BB50E111D6274CD004B33DF /* TopSiteItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB50E101D6274CD004B33DF /* TopSiteItemCell.swift */; }; - 3BB50E201D627539004B33DF /* HomepageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB50E1F1D627539004B33DF /* HomepageViewController.swift */; }; + 3BB50E201D627539004B33DF /* LegacyHomepageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB50E1F1D627539004B33DF /* LegacyHomepageViewController.swift */; }; 3BCE6D3C1CEB9E4D0080928C /* ThirdPartySearchAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BCE6D3B1CEB9E4D0080928C /* ThirdPartySearchAlerts.swift */; }; 3BF4B8E91D38497A00493393 /* BaseTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BF4B8E81D38497A00493393 /* BaseTestCase.swift */; }; 3BF56D271CDBBE1F00AC4D75 /* SimpleToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BF56D261CDBBE1F00AC4D75 /* SimpleToast.swift */; }; @@ -631,7 +631,7 @@ 81F617CB2C877EC7003799BF /* MainMenuTelemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81F617CA2C877EC7003799BF /* MainMenuTelemetry.swift */; }; 884CA7492344A301002E4711 /* TextContentDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 884CA7482344A301002E4711 /* TextContentDetector.swift */; }; 8A0017C128A3FF6100FEFC8B /* MessageCardDataAdaptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A0017C028A3FF6100FEFC8B /* MessageCardDataAdaptor.swift */; }; - 8A00BD882CAB401700680AF9 /* NewHomepageViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A00BD862CAB3FE500680AF9 /* NewHomepageViewControllerTests.swift */; }; + 8A00BD882CAB401700680AF9 /* HomepageViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A00BD862CAB3FE500680AF9 /* HomepageViewControllerTests.swift */; }; 8A01891C275E9C2A00923EFE /* ClearHistorySheetProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A01891B275E9C2A00923EFE /* ClearHistorySheetProvider.swift */; }; 8A03294E288F1F0800AD9B89 /* TopSitesDimension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A03294D288F1F0800AD9B89 /* TopSitesDimension.swift */; }; 8A03309528C2653600286539 /* LegacyTabFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A03309428C2653600286539 /* LegacyTabFileManager.swift */; }; @@ -799,7 +799,7 @@ 8A7AE4442BAB510B0072DAEC /* LibraryPanelCoordinatorDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7AE4432BAB510B0072DAEC /* LibraryPanelCoordinatorDelegate.swift */; }; 8A7AE4472BAC78230072DAEC /* MockLibraryNavigationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7AE4452BAC76B00072DAEC /* MockLibraryNavigationHandler.swift */; }; 8A7AF0C72C9A119A009691B5 /* TabPeekStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7AF0C52C9A1167009691B5 /* TabPeekStateTests.swift */; }; - 8A7D08E32CAAF7C30035999C /* NewHomepageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7D08E22CAAF7C30035999C /* NewHomepageViewController.swift */; }; + 8A7D08E32CAAF7C30035999C /* HomepageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A7D08E22CAAF7C30035999C /* HomepageViewController.swift */; }; 8A7D1AC52BA3542600162F4B /* splashScreen.json in Resources */ = {isa = PBXBuildFile; fileRef = 8A7D1AC42BA3542600162F4B /* splashScreen.json */; }; 8A8158CB2C2C77B000281F72 /* MicrosurveyTelemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A8158CA2C2C77B000281F72 /* MicrosurveyTelemetry.swift */; }; 8A827E302C20C7F5008D5E3C /* MicrosurveyMiddlewareTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A827E2E2C20C55E008D5E3C /* MicrosurveyMiddlewareTests.swift */; }; @@ -852,9 +852,9 @@ 8A9F0B5827C59E1800FE09AE /* ImageIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9F0B5527C595F300FE09AE /* ImageIdentifiers.swift */; }; 8A9F0B5927C5A2AB00FE09AE /* ImageIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A9F0B5527C595F300FE09AE /* ImageIdentifiers.swift */; }; 8AA020EF2B9A37E500771DE0 /* NimbusSplashScreenFeatureLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA020EE2B9A37E500771DE0 /* NimbusSplashScreenFeatureLayer.swift */; }; - 8AA0A6632CAC40AA00AC7EB3 /* NewHomepageDiffableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6622CAC40AA00AC7EB3 /* NewHomepageDiffableDataSource.swift */; }; - 8AA0A6652CAC6B7100AC7EB3 /* NewHomepageCompositionalLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6642CAC6B7100AC7EB3 /* NewHomepageCompositionalLayout.swift */; }; - 8AA0A6682CAC747500AC7EB3 /* NewHomepageDiffableDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6662CAC745300AC7EB3 /* NewHomepageDiffableDataSourceTests.swift */; }; + 8AA0A6632CAC40AA00AC7EB3 /* HomepageDiffableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6622CAC40AA00AC7EB3 /* HomepageDiffableDataSource.swift */; }; + 8AA0A6652CAC6B7100AC7EB3 /* HomepageSectionLayoutProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6642CAC6B7100AC7EB3 /* HomepageSectionLayoutProvider.swift */; }; + 8AA0A6682CAC747500AC7EB3 /* HomepageDiffableDataSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0A6662CAC745300AC7EB3 /* HomepageDiffableDataSourceTests.swift */; }; 8AA6ADB52742B567004EEE23 /* TelemetryWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA6ADB42742B567004EEE23 /* TelemetryWrapperTests.swift */; }; 8AA7347B28AEDB3100443D24 /* PocketViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA7347A28AEDB3100443D24 /* PocketViewModelTests.swift */; }; 8AA8389D2CA2FEFC003FA256 /* StoreTestUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AA8389C2CA2FEFC003FA256 /* StoreTestUtility.swift */; }; @@ -1617,7 +1617,7 @@ E1ADE23E2B06559500FD17AA /* FakespotAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1ADE23D2B06559500FD17AA /* FakespotAction.swift */; }; E1AEC176286E0CF500062E29 /* JumpBackInViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC16F286E0CF500062E29 /* JumpBackInViewModelTests.swift */; }; E1AEC177286E0CF500062E29 /* HistoryHighlightsViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC170286E0CF500062E29 /* HistoryHighlightsViewModelTests.swift */; }; - E1AEC178286E0CF500062E29 /* HomepageViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC171286E0CF500062E29 /* HomepageViewControllerTests.swift */; }; + E1AEC178286E0CF500062E29 /* LegacyHomepageViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC171286E0CF500062E29 /* LegacyHomepageViewControllerTests.swift */; }; E1AEC179286E0CF500062E29 /* FirefoxHomeViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC172286E0CF500062E29 /* FirefoxHomeViewModelTests.swift */; }; E1AEC17A286E0CF500062E29 /* WebViewNavigationHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AEC175286E0CF500062E29 /* WebViewNavigationHandlerTests.swift */; }; E1AF27362A13BDFE00CE5991 /* EngagementNotificationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1AF27352A13BDFE00CE5991 /* EngagementNotificationTests.swift */; }; @@ -2834,7 +2834,7 @@ 3B704751960D3C7E442AFBAE /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Search.strings; sourceTree = ""; }; 3B9A4BDF8865C6533212FC6C /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Menu.strings; sourceTree = ""; }; 3BB50E101D6274CD004B33DF /* TopSiteItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopSiteItemCell.swift; sourceTree = ""; }; - 3BB50E1F1D627539004B33DF /* HomepageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomepageViewController.swift; sourceTree = ""; }; + 3BB50E1F1D627539004B33DF /* LegacyHomepageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyHomepageViewController.swift; sourceTree = ""; }; 3BC659481E5BA4AE006D560F /* TopSites */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TopSites; sourceTree = ""; }; 3BCC4716A1AC7645F49D316A /* uz */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uz; path = uz.lproj/InfoPlist.strings; sourceTree = ""; }; 3BCE6D3B1CEB9E4D0080928C /* ThirdPartySearchAlerts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThirdPartySearchAlerts.swift; sourceTree = ""; }; @@ -6729,7 +6729,7 @@ 890045908C7B76449D0FEA78 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Localizable.strings; sourceTree = ""; }; 89AE47D2B80AF49BFB9763BA /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/LoginManager.strings; sourceTree = ""; }; 8A0017C028A3FF6100FEFC8B /* MessageCardDataAdaptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageCardDataAdaptor.swift; sourceTree = ""; }; - 8A00BD862CAB3FE500680AF9 /* NewHomepageViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewHomepageViewControllerTests.swift; sourceTree = ""; }; + 8A00BD862CAB3FE500680AF9 /* HomepageViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageViewControllerTests.swift; sourceTree = ""; }; 8A01891B275E9C2A00923EFE /* ClearHistorySheetProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearHistorySheetProvider.swift; sourceTree = ""; }; 8A03294D288F1F0800AD9B89 /* TopSitesDimension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopSitesDimension.swift; sourceTree = ""; }; 8A03309428C2653600286539 /* LegacyTabFileManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyTabFileManager.swift; sourceTree = ""; }; @@ -6917,7 +6917,7 @@ 8A7AE4432BAB510B0072DAEC /* LibraryPanelCoordinatorDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibraryPanelCoordinatorDelegate.swift; sourceTree = ""; }; 8A7AE4452BAC76B00072DAEC /* MockLibraryNavigationHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockLibraryNavigationHandler.swift; sourceTree = ""; }; 8A7AF0C52C9A1167009691B5 /* TabPeekStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabPeekStateTests.swift; sourceTree = ""; }; - 8A7D08E22CAAF7C30035999C /* NewHomepageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewHomepageViewController.swift; sourceTree = ""; }; + 8A7D08E22CAAF7C30035999C /* HomepageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageViewController.swift; sourceTree = ""; }; 8A7D1AC42BA3542600162F4B /* splashScreen.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splashScreen.json; sourceTree = ""; }; 8A8158CA2C2C77B000281F72 /* MicrosurveyTelemetry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrosurveyTelemetry.swift; sourceTree = ""; }; 8A827E2E2C20C55E008D5E3C /* MicrosurveyMiddlewareTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrosurveyMiddlewareTests.swift; sourceTree = ""; }; @@ -6971,9 +6971,9 @@ 8A9E46BC2A6599E5003327D4 /* MockStatusBarScrollDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockStatusBarScrollDelegate.swift; sourceTree = ""; }; 8A9F0B5527C595F300FE09AE /* ImageIdentifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageIdentifiers.swift; sourceTree = ""; }; 8AA020EE2B9A37E500771DE0 /* NimbusSplashScreenFeatureLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NimbusSplashScreenFeatureLayer.swift; sourceTree = ""; }; - 8AA0A6622CAC40AA00AC7EB3 /* NewHomepageDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewHomepageDiffableDataSource.swift; sourceTree = ""; }; - 8AA0A6642CAC6B7100AC7EB3 /* NewHomepageCompositionalLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewHomepageCompositionalLayout.swift; sourceTree = ""; }; - 8AA0A6662CAC745300AC7EB3 /* NewHomepageDiffableDataSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewHomepageDiffableDataSourceTests.swift; sourceTree = ""; }; + 8AA0A6622CAC40AA00AC7EB3 /* HomepageDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageDiffableDataSource.swift; sourceTree = ""; }; + 8AA0A6642CAC6B7100AC7EB3 /* HomepageSectionLayoutProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageSectionLayoutProvider.swift; sourceTree = ""; }; + 8AA0A6662CAC745300AC7EB3 /* HomepageDiffableDataSourceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageDiffableDataSourceTests.swift; sourceTree = ""; }; 8AA6ADB42742B567004EEE23 /* TelemetryWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelemetryWrapperTests.swift; sourceTree = ""; }; 8AA7347A28AEDB3100443D24 /* PocketViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PocketViewModelTests.swift; sourceTree = ""; }; 8AA8389C2CA2FEFC003FA256 /* StoreTestUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreTestUtility.swift; sourceTree = ""; }; @@ -8610,7 +8610,7 @@ E1ADE23D2B06559500FD17AA /* FakespotAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakespotAction.swift; sourceTree = ""; }; E1AEC16F286E0CF500062E29 /* JumpBackInViewModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JumpBackInViewModelTests.swift; sourceTree = ""; }; E1AEC170286E0CF500062E29 /* HistoryHighlightsViewModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryHighlightsViewModelTests.swift; sourceTree = ""; }; - E1AEC171286E0CF500062E29 /* HomepageViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomepageViewControllerTests.swift; sourceTree = ""; }; + E1AEC171286E0CF500062E29 /* LegacyHomepageViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyHomepageViewControllerTests.swift; sourceTree = ""; }; E1AEC172286E0CF500062E29 /* FirefoxHomeViewModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirefoxHomeViewModelTests.swift; sourceTree = ""; }; E1AEC175286E0CF500062E29 /* WebViewNavigationHandlerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewNavigationHandlerTests.swift; sourceTree = ""; }; E1AF27352A13BDFE00CE5991 /* EngagementNotificationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EngagementNotificationTests.swift; sourceTree = ""; }; @@ -10499,8 +10499,8 @@ 8A00BD852CAB3FC200680AF9 /* Homepage Rebuild */ = { isa = PBXGroup; children = ( - 8A00BD862CAB3FE500680AF9 /* NewHomepageViewControllerTests.swift */, - 8AA0A6662CAC745300AC7EB3 /* NewHomepageDiffableDataSourceTests.swift */, + 8A00BD862CAB3FE500680AF9 /* HomepageViewControllerTests.swift */, + 8AA0A6662CAC745300AC7EB3 /* HomepageDiffableDataSourceTests.swift */, ); path = "Homepage Rebuild"; sourceTree = ""; @@ -10827,9 +10827,9 @@ 8A7D08E12CAAF79F0035999C /* Homepage Rebuild */ = { isa = PBXGroup; children = ( - 8A7D08E22CAAF7C30035999C /* NewHomepageViewController.swift */, - 8AA0A6622CAC40AA00AC7EB3 /* NewHomepageDiffableDataSource.swift */, - 8AA0A6642CAC6B7100AC7EB3 /* NewHomepageCompositionalLayout.swift */, + 8A7D08E22CAAF7C30035999C /* HomepageViewController.swift */, + 8AA0A6622CAC40AA00AC7EB3 /* HomepageDiffableDataSource.swift */, + 8AA0A6642CAC6B7100AC7EB3 /* HomepageSectionLayoutProvider.swift */, ); path = "Homepage Rebuild"; sourceTree = ""; @@ -12674,7 +12674,7 @@ children = ( E1AEC172286E0CF500062E29 /* FirefoxHomeViewModelTests.swift */, 5AF6254128A5799D00A90253 /* HistoryHighlights */, - E1AEC171286E0CF500062E29 /* HomepageViewControllerTests.swift */, + E1AEC171286E0CF500062E29 /* LegacyHomepageViewControllerTests.swift */, 8AE80BC32891DAB000BC12EA /* JumpBackIn */, 8ADAFAC428AEBF5000FFEBE3 /* LogoHeader */, 8A32DD4E28B4199E00D57C60 /* MessageCard */, @@ -13480,7 +13480,7 @@ 8A285B07294A5D4C00149B0F /* HomepageHeroImageViewModel.swift */, 8AB59589284145B30090F4AE /* HomepageSectionHandler.swift */, 1DFE57FE27BAE3150025DE58 /* HomepageSectionType.swift */, - 3BB50E1F1D627539004B33DF /* HomepageViewController.swift */, + 3BB50E1F1D627539004B33DF /* LegacyHomepageViewController.swift */, 1DFE57FC27BADD7C0025DE58 /* HomepageViewModel.swift */, 8AB8572F27D94CAD0075C173 /* HomepageViewModelProtocol.swift */, 8AB8574927D97CE90075C173 /* HomePanelDelegate.swift */, @@ -15323,7 +15323,7 @@ 1D0BA05C24F46A0400D731B5 /* TopSitesProvider.swift in Sources */, 0BF0DB941A8545800039F300 /* URLBarView.swift in Sources */, DFACBF7F277B5F7B003D5F41 /* WallpaperBackgroundView.swift in Sources */, - 8A7D08E32CAAF7C30035999C /* NewHomepageViewController.swift in Sources */, + 8A7D08E32CAAF7C30035999C /* HomepageViewController.swift in Sources */, D01017F5219CB6BD009CBB5A /* DownloadContentScript.swift in Sources */, 8A093D832A4B68940099ABA5 /* PrivacySettingsDelegate.swift in Sources */, 39F819C61FD70F5D009E31E4 /* GlobalTabEventHandlers.swift in Sources */, @@ -15428,7 +15428,7 @@ C8BD87602A0C248000CD803A /* OnboardingButtonsModel.swift in Sources */, 0BB5B2881AC0A2B90052877D /* SnackBar.swift in Sources */, E1442FCF294782D9003680B0 /* UIView+Screenshot.swift in Sources */, - 8AA0A6652CAC6B7100AC7EB3 /* NewHomepageCompositionalLayout.swift in Sources */, + 8AA0A6652CAC6B7100AC7EB3 /* HomepageSectionLayoutProvider.swift in Sources */, 8AB8572C27D945FA0075C173 /* TopSitesDataAdaptor.swift in Sources */, C889569A27E8D1AC00E3779E /* LegacyInactiveTabHeader.swift in Sources */, 7BEFC6801BFF68C30059C952 /* QuickActions.swift in Sources */, @@ -15670,7 +15670,7 @@ 43DB9784292D6846002E0B9F /* ShareButton.swift in Sources */, BD6B361E2B3C2511005E5345 /* CircularProgressView.swift in Sources */, 8AB8574627D97CB00075C173 /* HomepageContextMenuProtocol.swift in Sources */, - 3BB50E201D627539004B33DF /* HomepageViewController.swift in Sources */, + 3BB50E201D627539004B33DF /* LegacyHomepageViewController.swift in Sources */, C82A94F3269F68F300624AA7 /* CoreFlaggableFeature.swift in Sources */, F84B22241A09122500AAB793 /* LibraryViewController.swift in Sources */, E16941B82C5119A200FF5F4E /* Autocompletable.swift in Sources */, @@ -16030,7 +16030,7 @@ 59A68FD5260B8D520F890F4A /* ReaderPanel.swift in Sources */, 0A93C8AA2C87070300BEA143 /* TrackingProtectionConnectionStatusView.swift in Sources */, C849E46126B9C39B00260F0B /* EnhancedTrackingProtectionVC.swift in Sources */, - 8AA0A6632CAC40AA00AC7EB3 /* NewHomepageDiffableDataSource.swift in Sources */, + 8AA0A6632CAC40AA00AC7EB3 /* HomepageDiffableDataSource.swift in Sources */, E40FAB0C1A7ABB77009CB80D /* WebServer.swift in Sources */, 59A68D66379CFA85C4EAF00B /* TwoLineImageOverlayCell.swift in Sources */, 0A49784A2C53E63200B1E82A /* TrackingProtectionViewController.swift in Sources */, @@ -16373,14 +16373,14 @@ 21FA8FB22AE856EB0013B815 /* MockTabTrayCoordinatorDelegate.swift in Sources */, C8699152289177F5007ACC5C /* WallpaperNetworkingTests.swift in Sources */, C818AD452A2100BA007F30BC /* OnboardingNotificationCardHelperTests.swift in Sources */, - E1AEC178286E0CF500062E29 /* HomepageViewControllerTests.swift in Sources */, + E1AEC178286E0CF500062E29 /* LegacyHomepageViewControllerTests.swift in Sources */, 8A4EA0D42C01100200E4E4F1 /* MicrosurveySurfaceManagerTests.swift in Sources */, 8ADEC6832A40F208002D2ED8 /* AppSettingsTableViewControllerTests.swift in Sources */, 5A475E8E29DB89C7009C13FD /* TabManagerTests.swift in Sources */, C88012232A40E38D00F4D1D6 /* IntroViewControllerTests.swift in Sources */, E16E1C9628BFB2E600EE2EF5 /* WallpaperSettingsViewModelTests.swift in Sources */, E1463D042982D0240074E16E /* NotificationManagerTests.swift in Sources */, - 8AA0A6682CAC747500AC7EB3 /* NewHomepageDiffableDataSourceTests.swift in Sources */, + 8AA0A6682CAC747500AC7EB3 /* HomepageDiffableDataSourceTests.swift in Sources */, 3B61CD591F2A750800D38DE1 /* PocketFeedTests.swift in Sources */, C8E1BC0A28085AA700C62964 /* NimbusFeatureFlagLayerTests.swift in Sources */, F80D53CF2A09A3350047ED14 /* RustSyncManagerTests.swift in Sources */, @@ -16391,7 +16391,7 @@ 8AE1E1D927B1BD380024C45E /* UIStackViewExtensionsTests.swift in Sources */, 8A0727492B4898D20071BB9F /* WebviewTelemetryTests.swift in Sources */, 3B6F40181DC7849C00656CC6 /* TopSitesViewModelTests.swift in Sources */, - 8A00BD882CAB401700680AF9 /* NewHomepageViewControllerTests.swift in Sources */, + 8A00BD882CAB401700680AF9 /* HomepageViewControllerTests.swift in Sources */, C869915528917803007ACC5C /* WallpaperMetadataTestProvider.swift in Sources */, BC003F5E2B59F44600929ECB /* BrowserViewControllerTests.swift in Sources */, ); diff --git a/firefox-ios/Client/Coordinators/Browser/BrowserCoordinator.swift b/firefox-ios/Client/Coordinators/Browser/BrowserCoordinator.swift index f57ea4e25a8c..e504c93d790c 100644 --- a/firefox-ios/Client/Coordinators/Browser/BrowserCoordinator.swift +++ b/firefox-ios/Client/Coordinators/Browser/BrowserCoordinator.swift @@ -29,8 +29,8 @@ class BrowserCoordinator: BaseCoordinator, MainMenuCoordinatorDelegate { var browserViewController: BrowserViewController var webviewController: WebviewViewController? + var legacyHomepageViewController: LegacyHomepageViewController? var homepageViewController: HomepageViewController? - var newHomepageViewController: NewHomepageViewController? var privateViewController: PrivateHomepageViewController? var errorViewController: NativeErrorPageViewController? @@ -103,33 +103,37 @@ class BrowserCoordinator: BaseCoordinator, // MARK: - BrowserDelegate - func showHomepage(inline: Bool, - toastContainer: UIView, - homepanelDelegate: HomePanelDelegate, - libraryPanelDelegate: LibraryPanelDelegate, - statusBarScrollDelegate: StatusBarScrollDelegate, - overlayManager: OverlayModeManager) { - let homepageController = getHomepage(inline: inline, - toastContainer: toastContainer, - homepanelDelegate: homepanelDelegate, - libraryPanelDelegate: libraryPanelDelegate, - statusBarScrollDelegate: statusBarScrollDelegate, - overlayManager: overlayManager) - - guard browserViewController.embedContent(homepageController) else { return } - self.homepageViewController = homepageController - homepageController.scrollToTop() + func showLegacyHomepage( + inline: Bool, + toastContainer: UIView, + homepanelDelegate: HomePanelDelegate, + libraryPanelDelegate: LibraryPanelDelegate, + statusBarScrollDelegate: StatusBarScrollDelegate, + overlayManager: OverlayModeManager + ) { + let legacyHomepageViewController = getHomepage( + inline: inline, + toastContainer: toastContainer, + homepanelDelegate: homepanelDelegate, + libraryPanelDelegate: libraryPanelDelegate, + statusBarScrollDelegate: statusBarScrollDelegate, + overlayManager: overlayManager + ) + + guard browserViewController.embedContent(legacyHomepageViewController) else { return } + self.legacyHomepageViewController = legacyHomepageViewController + legacyHomepageViewController.scrollToTop() // We currently don't support full page screenshot of the homepage screenshotService.screenshotableView = nil } - func showNewHomepage() { - let homepageController = NewHomepageViewController(windowUUID: windowUUID) + func showHomepage() { + let homepageController = HomepageViewController(windowUUID: windowUUID) guard browserViewController.embedContent(homepageController) else { logger.log("Unable to embed new homepage", level: .debug, category: .coordinator) return } - self.newHomepageViewController = homepageController + self.homepageViewController = homepageController } func showPrivateHomepage(overlayManager: OverlayModeManager) { @@ -192,23 +196,23 @@ class BrowserCoordinator: BaseCoordinator, homepanelDelegate: HomePanelDelegate, libraryPanelDelegate: LibraryPanelDelegate, statusBarScrollDelegate: StatusBarScrollDelegate, - overlayManager: OverlayModeManager) -> HomepageViewController { - if let homepageViewController = homepageViewController { - homepageViewController.configure(isZeroSearch: inline) - return homepageViewController + overlayManager: OverlayModeManager) -> LegacyHomepageViewController { + if let legacyHomepageViewController = legacyHomepageViewController { + legacyHomepageViewController.configure(isZeroSearch: inline) + return legacyHomepageViewController } else { - let homepageViewController = HomepageViewController( + let legacyHomepageViewController = LegacyHomepageViewController( profile: profile, isZeroSearch: inline, toastContainer: toastContainer, tabManager: tabManager, overlayManager: overlayManager) - homepageViewController.homePanelDelegate = homepanelDelegate - homepageViewController.libraryPanelDelegate = libraryPanelDelegate - homepageViewController.statusBarScrollDelegate = statusBarScrollDelegate - homepageViewController.browserNavigationHandler = self + legacyHomepageViewController.homePanelDelegate = homepanelDelegate + legacyHomepageViewController.libraryPanelDelegate = libraryPanelDelegate + legacyHomepageViewController.statusBarScrollDelegate = statusBarScrollDelegate + legacyHomepageViewController.browserNavigationHandler = self - return homepageViewController + return legacyHomepageViewController } } @@ -828,9 +832,9 @@ class BrowserCoordinator: BaseCoordinator, // Clean up views and ensure BVC for the window is freed browserViewController.view.endEditing(true) browserViewController.dismissUrlBar() - homepageViewController?.view.removeFromSuperview() - homepageViewController?.removeFromParent() - homepageViewController = nil + legacyHomepageViewController?.view.removeFromSuperview() + legacyHomepageViewController?.removeFromParent() + legacyHomepageViewController = nil browserViewController.contentContainer.subviews.forEach { $0.removeFromSuperview() } browserViewController.removeFromParent() case .libraryOpened: diff --git a/firefox-ios/Client/Coordinators/Browser/BrowserDelegate.swift b/firefox-ios/Client/Coordinators/Browser/BrowserDelegate.swift index ad5ac21a3e73..0650a070a496 100644 --- a/firefox-ios/Client/Coordinators/Browser/BrowserDelegate.swift +++ b/firefox-ios/Client/Coordinators/Browser/BrowserDelegate.swift @@ -14,15 +14,17 @@ protocol BrowserDelegate: AnyObject { /// - libraryPanelDelegate: The library panel delegate for the homepage /// - statusBarScrollDelegate: The delegate that takes care of the status bar overlay scroll /// - overlayManager: The overlay manager for the homepage - func showHomepage(inline: Bool, - toastContainer: UIView, - homepanelDelegate: HomePanelDelegate, - libraryPanelDelegate: LibraryPanelDelegate, - statusBarScrollDelegate: StatusBarScrollDelegate, - overlayManager: OverlayModeManager) + func showLegacyHomepage( + inline: Bool, + toastContainer: UIView, + homepanelDelegate: HomePanelDelegate, + libraryPanelDelegate: LibraryPanelDelegate, + statusBarScrollDelegate: StatusBarScrollDelegate, + overlayManager: OverlayModeManager + ) /// Show the new homepage to the user as part of the homepage rebuild project - func showNewHomepage() + func showHomepage() /// Show the private homepage to the user as part of felt privacy func showPrivateHomepage(overlayManager: OverlayModeManager) diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+KeyCommands.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+KeyCommands.swift index 39ff7071b92b..7b0f9a953a69 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+KeyCommands.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+KeyCommands.swift @@ -44,7 +44,7 @@ extension BrowserViewController { guard let tab = tabManager.selectedTab, let url = tab.canonicalURL?.displayURL else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { addBookmark(url: url.absoluteString, title: tab.title) } } @@ -60,7 +60,7 @@ extension BrowserViewController { store.dispatch(GeneralBrowserAction(windowUUID: windowUUID, actionType: GeneralBrowserActionType.reloadWebsite)) } else { - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { tab.reload() } } @@ -77,7 +77,7 @@ extension BrowserViewController { store.dispatch(GeneralBrowserAction(windowUUID: windowUUID, actionType: GeneralBrowserActionType.reloadWebsiteNoCache)) } else { - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { tab.reload(bypassCache: true) } } @@ -94,7 +94,7 @@ extension BrowserViewController { store.dispatch(GeneralBrowserAction(windowUUID: windowUUID, actionType: GeneralBrowserActionType.navigateBack)) } else { - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { tab.goBack() } } @@ -111,7 +111,7 @@ extension BrowserViewController { store.dispatch(GeneralBrowserAction(windowUUID: windowUUID, actionType: GeneralBrowserActionType.navigateForward)) } else { - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { tab.goForward() } } @@ -134,7 +134,7 @@ extension BrowserViewController { private func findInPage(withText text: String) { guard let tab = tabManager.selectedTab else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { self.tab(tab, didSelectFindInPageForSelection: text) } } @@ -341,7 +341,7 @@ extension BrowserViewController { func zoomIn() { guard let currentTab = tabManager.selectedTab else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { currentTab.zoomIn() } } @@ -350,7 +350,7 @@ extension BrowserViewController { func zoomOut() { guard let currentTab = tabManager.selectedTab else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { currentTab.zoomOut() } } @@ -359,7 +359,7 @@ extension BrowserViewController { func resetZoom() { guard let currentTab = tabManager.selectedTab else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { currentTab.resetZoom() } } diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+URLBarDelegate.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+URLBarDelegate.swift index 02e395d877db..225b77aa3c86 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+URLBarDelegate.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+URLBarDelegate.swift @@ -219,7 +219,7 @@ extension BrowserViewController: URLBarDelegate { func urlBarDidPressScrollToTop(_ urlBar: URLBarView) { guard let selectedTab = tabManager.selectedTab else { return } - if !contentContainer.hasHomepage { + if !contentContainer.hasLegacyHomepage { // Only scroll to top if we are not showing the home view controller selectedTab.webView?.scrollView.setContentOffset(CGPoint.zero, animated: true) } diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift index 294ce48a773a..94e3669c317e 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift @@ -324,7 +324,7 @@ extension BrowserViewController: WKUIDelegate { type: WKMediaCaptureType, decisionHandler: @escaping (WKPermissionDecision) -> Void) { // If the tab isn't the selected one or we're on the homepage, do not show the media capture prompt - guard tabManager.selectedTab?.webView == webView, !contentContainer.hasHomepage else { + guard tabManager.selectedTab?.webView == webView, !contentContainer.hasLegacyHomepage else { decisionHandler(.deny) return } diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift index 0002b145a298..930d3590eef6 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift @@ -1269,7 +1269,7 @@ class BrowserViewController: UIViewController, func frontEmbeddedContent(_ viewController: ContentContainable) { contentContainer.update(content: viewController) - statusBarOverlay.resetState(isHomepage: contentContainer.hasHomepage) + statusBarOverlay.resetState(isHomepage: contentContainer.hasLegacyHomepage) } /// Embed a ContentContainable inside the content container @@ -1282,7 +1282,7 @@ class BrowserViewController: UIViewController, viewController.willMove(toParent: self) contentContainer.add(content: viewController) viewController.didMove(toParent: self) - statusBarOverlay.resetState(isHomepage: contentContainer.hasHomepage) + statusBarOverlay.resetState(isHomepage: contentContainer.hasLegacyHomepage) UIAccessibility.post(notification: UIAccessibility.Notification.screenChanged, argument: nil) return true @@ -1308,14 +1308,16 @@ class BrowserViewController: UIViewController, } if featureFlags.isFeatureEnabled(.homepageRebuild, checking: .buildOnly) { - browserDelegate?.showNewHomepage() + browserDelegate?.showHomepage() } else { - browserDelegate?.showHomepage(inline: inline, - toastContainer: contentContainer, - homepanelDelegate: self, - libraryPanelDelegate: self, - statusBarScrollDelegate: statusBarOverlay, - overlayManager: overlayManager) + browserDelegate?.showLegacyHomepage( + inline: inline, + toastContainer: contentContainer, + homepanelDelegate: self, + libraryPanelDelegate: self, + statusBarScrollDelegate: statusBarOverlay, + overlayManager: overlayManager + ) } } diff --git a/firefox-ios/Client/Frontend/Components/ContentContainer.swift b/firefox-ios/Client/Frontend/Components/ContentContainer.swift index f643e736613d..56db6c060138 100644 --- a/firefox-ios/Client/Frontend/Components/ContentContainer.swift +++ b/firefox-ios/Client/Frontend/Components/ContentContainer.swift @@ -5,11 +5,11 @@ import UIKit enum ContentType { - case webview case homepage + case legacyHomepage case privateHomepage case nativeErrorPage - case newHomepage + case webview } protocol ContentContainable: UIViewController { @@ -25,16 +25,16 @@ class ContentContainer: UIView { return contentController?.view } - var hasHomepage: Bool { - return type == .homepage + var hasLegacyHomepage: Bool { + return type == .legacyHomepage } var hasPrivateHomepage: Bool { return type == .privateHomepage } - var hasNewHomepage: Bool { - return type == .newHomepage + var hasHomepage: Bool { + return type == .homepage } var hasWebView: Bool { @@ -51,12 +51,12 @@ class ContentContainer: UIView { /// - Returns: True when we can add the view controller to the container func canAdd(content: ContentContainable) -> Bool { switch type { - case .homepage: - return !(content is HomepageViewController) + case .legacyHomepage: + return !(content is LegacyHomepageViewController) case .nativeErrorPage: return !(content is NativeErrorPageViewController) - case .newHomepage: - return !(content is NewHomepageViewController) + case .homepage: + return !(content is HomepageViewController) case .privateHomepage: return !(content is PrivateHomepageViewController) case .webview: diff --git a/firefox-ios/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModel.swift b/firefox-ios/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModel.swift index f80899e3789b..421f98029602 100644 --- a/firefox-ios/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModel.swift +++ b/firefox-ios/Client/Frontend/Home/HistoryHighlights/HistoryHighlightsViewModel.swift @@ -446,7 +446,7 @@ extension HistoryHighlightsViewModel: HistoryHighlightsDelegate { self.historyItems = self.historyHighlightsDataAdaptor.getHistoryHighlights() self.logger.log("HistoryHighlights didLoadNewData and section shouldShow \(self.shouldShow)", level: .debug, - category: .homepage) + category: .legacyHomepage) guard self.isEnabled else { return } self.delegate?.reloadView() } diff --git a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageDiffableDataSource.swift b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageDiffableDataSource.swift similarity index 92% rename from firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageDiffableDataSource.swift rename to firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageDiffableDataSource.swift index 8faa287be206..71a3414c8052 100644 --- a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageDiffableDataSource.swift +++ b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageDiffableDataSource.swift @@ -4,11 +4,11 @@ import UIKit -typealias HomepageSection = NewHomepageDiffableDataSource.HomeSection -typealias HomepageItem = NewHomepageDiffableDataSource.HomeItem +typealias HomepageSection = HomepageDiffableDataSource.HomeSection +typealias HomepageItem = HomepageDiffableDataSource.HomeItem /// Holds the data source configuration for the new homepage as part of the rebuild project -final class NewHomepageDiffableDataSource: +final class HomepageDiffableDataSource: UICollectionViewDiffableDataSource { enum HomeSection: Int, Hashable { case header diff --git a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageCompositionalLayout.swift b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageSectionLayoutProvider.swift similarity index 97% rename from firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageCompositionalLayout.swift rename to firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageSectionLayoutProvider.swift index 4b5128e990b1..6047f47e6800 100644 --- a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageCompositionalLayout.swift +++ b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageSectionLayoutProvider.swift @@ -6,7 +6,7 @@ import Foundation import Common /// Holds section layout logic for the new homepage as part of the rebuild project -final class NewHomepageSectionLayoutProvider { +final class HomepageSectionLayoutProvider { private var logger: Logger init(logger: Logger = DefaultLogger.shared) { @@ -19,7 +19,7 @@ final class NewHomepageSectionLayoutProvider { self.logger.log( "Section should not have been nil, something went wrong", level: .fatal, - category: .newHomepage + category: .homepage ) return nil } diff --git a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageViewController.swift b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageViewController.swift similarity index 86% rename from firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageViewController.swift rename to firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageViewController.swift index 846c45a36c77..7540daaf40d2 100644 --- a/firefox-ios/Client/Frontend/Home/Homepage Rebuild/NewHomepageViewController.swift +++ b/firefox-ios/Client/Frontend/Home/Homepage Rebuild/HomepageViewController.swift @@ -5,12 +5,12 @@ import Foundation import Common -final class NewHomepageViewController: UIViewController, ContentContainable, Themeable { +final class HomepageViewController: UIViewController, ContentContainable, Themeable { // MARK: - Typealiases private typealias a11y = AccessibilityIdentifiers.FirefoxHomepage // MARK: - ContentContainable variables - var contentType: ContentType = .newHomepage + var contentType: ContentType = .homepage // MARK: - Themable variables var themeManager: ThemeManager @@ -22,8 +22,8 @@ final class NewHomepageViewController: UIViewController, ContentContainable, The // MARK: - Private variables private var collectionView: UICollectionView? - private var dataSource: NewHomepageDiffableDataSource? - private var layoutConfiguration = NewHomepageSectionLayoutProvider().createCompositionalLayout() + private var dataSource: HomepageDiffableDataSource? + private var layoutConfiguration = HomepageSectionLayoutProvider().createCompositionalLayout() private var logger: Logger // MARK: - Initializers @@ -69,7 +69,7 @@ final class NewHomepageViewController: UIViewController, ContentContainable, The private func setupLayout() { guard let collectionView else { logger.log( - "NewHomepage collectionview should not have been nil, something went wrong", + "Homepage collectionview should not have been nil, something went wrong", level: .fatal, category: .homepage ) @@ -105,14 +105,14 @@ final class NewHomepageViewController: UIViewController, ContentContainable, The private func configureDataSource() { guard let collectionView else { logger.log( - "NewHomepage collectionview should not have been nil, something went wrong", + "Homepage collectionview should not have been nil, something went wrong", level: .fatal, - category: .newHomepage + category: .homepage ) return } - dataSource = NewHomepageDiffableDataSource( + dataSource = HomepageDiffableDataSource( collectionView: collectionView ) { [weak self] (collectionView, indexPath, item) -> UICollectionViewCell? in return self?.configureCell(for: item, at: indexPath) @@ -120,7 +120,7 @@ final class NewHomepageViewController: UIViewController, ContentContainable, The } private func configureCell( - for item: NewHomepageDiffableDataSource.HomeItem, + for item: HomepageDiffableDataSource.HomeItem, at indexPath: IndexPath ) -> UICollectionViewCell { // TODO: FXIOS-10163 - Dummy collection cells, to update with proper cells diff --git a/firefox-ios/Client/Frontend/Home/HomepageViewModel.swift b/firefox-ios/Client/Frontend/Home/HomepageViewModel.swift index 97486f19e4df..a2526c2ca2c4 100644 --- a/firefox-ios/Client/Frontend/Home/HomepageViewModel.swift +++ b/firefox-ios/Client/Frontend/Home/HomepageViewModel.swift @@ -235,7 +235,7 @@ class HomepageViewModel: FeatureFlaggable, InjectedThemeUUIDIdentifiable { } logger.log("Homepage amount of sections shown \(shownSections.count)", level: .debug, - category: .homepage) + category: .legacyHomepage) } func refreshData(for traitCollection: UITraitCollection, size: CGSize) { diff --git a/firefox-ios/Client/Frontend/Home/JumpBackIn/JumpBackInViewModel.swift b/firefox-ios/Client/Frontend/Home/JumpBackIn/JumpBackInViewModel.swift index 20caa39ffec1..9e57e0f46c26 100644 --- a/firefox-ios/Client/Frontend/Home/JumpBackIn/JumpBackInViewModel.swift +++ b/firefox-ios/Client/Frontend/Home/JumpBackIn/JumpBackInViewModel.swift @@ -360,7 +360,7 @@ extension JumpBackInViewModel: HomepageViewModelProtocol { refreshData(maxItemsToDisplay: maxItemsToDisplay) logger.log("JumpBackIn section shouldShow \(shouldShow)", level: .debug, - category: .homepage) + category: .legacyHomepage) } func updatePrivacyConcernedSection(isPrivate: Bool) { @@ -452,7 +452,7 @@ extension JumpBackInViewModel: JumpBackInDelegate { await self.updateJumpBackInData() logger.log("JumpBack didLoadNewData and section shouldShow \(self.shouldShow)", level: .debug, - category: .homepage) + category: .legacyHomepage) reloadView() } } diff --git a/firefox-ios/Client/Frontend/Home/HomepageViewController.swift b/firefox-ios/Client/Frontend/Home/LegacyHomepageViewController.swift similarity index 97% rename from firefox-ios/Client/Frontend/Home/HomepageViewController.swift rename to firefox-ios/Client/Frontend/Home/LegacyHomepageViewController.swift index d87e657fbd2a..da12705d8a40 100644 --- a/firefox-ios/Client/Frontend/Home/HomepageViewController.swift +++ b/firefox-ios/Client/Frontend/Home/LegacyHomepageViewController.swift @@ -11,7 +11,7 @@ import UIKit import enum MozillaAppServices.VisitType -class HomepageViewController: +class LegacyHomepageViewController: UIViewController, FeatureFlaggable, Themeable, @@ -48,7 +48,7 @@ class HomepageViewController: var windowUUID: WindowUUID { return tabManager.windowUUID } var currentWindowUUID: UUID? { return windowUUID } - var contentType: ContentType = .homepage + var contentType: ContentType = .legacyHomepage var themeManager: ThemeManager var notificationCenter: NotificationProtocol @@ -299,7 +299,7 @@ class HomepageViewController: self.logger.log( "Section \(viewModel.sectionType) is going to show", level: .debug, - category: .homepage + category: .legacyHomepage ) return viewModel.section( for: layoutEnvironment.traitCollection, @@ -342,7 +342,7 @@ class HomepageViewController: /// done with the new trait. On iPad, trait collection doesn't change from portrait to landscape (and vice-versa) /// since it's `.regular` on both. We reloadOnRotation from viewWillTransition in that case. private func reloadOnRotation(newSize: CGSize) { - logger.log("Reload on rotation to new size \(newSize)", level: .info, category: .homepage) + logger.log("Reload on rotation to new size \(newSize)", level: .info, category: .legacyHomepage) if presentedViewController as? PhotonActionSheet != nil { presentedViewController?.dismiss(animated: false, completion: nil) @@ -367,7 +367,7 @@ class HomepageViewController: else { return } let privacySectionState = isPrivate ? "Removing": "Adding" - logger.log("\(privacySectionState) privacy sensitive sections", level: .info, category: .homepage) + logger.log("\(privacySectionState) privacy sensitive sections", level: .info, category: .legacyHomepage) viewModel.isPrivate = isPrivate reloadView() } @@ -539,7 +539,7 @@ class HomepageViewController: // MARK: - CollectionView Data Source -extension HomepageViewController: UICollectionViewDelegate, UICollectionViewDataSource { +extension LegacyHomepageViewController: UICollectionViewDelegate, UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { @@ -580,7 +580,7 @@ extension HomepageViewController: UICollectionViewDelegate, UICollectionViewData guard let learnMoreURL = SupportUtils.URLForPocketLearnMore else { self.logger.log("Failed to retrieve learn more URL from SupportUtils.URLForPocketLearnMore", level: .debug, - category: .homepage) + category: .legacyHomepage) return } self.showSiteWithURLHandler(learnMoreURL) @@ -627,7 +627,7 @@ extension HomepageViewController: UICollectionViewDelegate, UICollectionViewData // MARK: - Actions Handling -private extension HomepageViewController { +private extension LegacyHomepageViewController { // Setup all the tap and long press actions on cells in each sections private func setupSectionsAction() { // Header view @@ -847,7 +847,7 @@ private extension HomepageViewController { } // MARK: FirefoxHomeContextMenuHelperDelegate -extension HomepageViewController: HomepageContextMenuHelperDelegate { +extension LegacyHomepageViewController: HomepageContextMenuHelperDelegate { func homePanelDidRequestToOpenInNewTab(_ url: URL, isPrivate: Bool, selectNewTab: Bool) { homePanelDelegate?.homePanelDidRequestToOpenInNewTab(url, isPrivate: isPrivate, selectNewTab: selectNewTab) } @@ -863,7 +863,7 @@ extension HomepageViewController: HomepageContextMenuHelperDelegate { // MARK: - Status Bar Background -extension HomepageViewController { +extension LegacyHomepageViewController { var statusBarFrame: CGRect? { guard let keyWindow = UIWindow.keyWindow else { return nil } @@ -873,7 +873,7 @@ extension HomepageViewController { // MARK: - Popover Presentation Delegate -extension HomepageViewController: UIPopoverPresentationControllerDelegate { +extension LegacyHomepageViewController: UIPopoverPresentationControllerDelegate { // Dismiss the popover if the device is being rotated. // This is used by the Share UIActivityViewController action sheet on iPad func popoverPresentationController( @@ -893,7 +893,7 @@ extension HomepageViewController: UIPopoverPresentationControllerDelegate { } // MARK: - UIContextMenuInteractionDelegate -extension HomepageViewController: UIContextMenuInteractionDelegate { +extension LegacyHomepageViewController: UIContextMenuInteractionDelegate { // Handles iPad trackpad right clicks func contextMenuInteraction( _ interaction: UIContextMenuInteraction, @@ -910,7 +910,7 @@ extension HomepageViewController: UIContextMenuInteractionDelegate { } // MARK: - UIAdaptivePresentationControllerDelegate -extension HomepageViewController: UIAdaptivePresentationControllerDelegate { +extension LegacyHomepageViewController: UIAdaptivePresentationControllerDelegate { func adaptivePresentationStyle( for controller: UIPresentationController, traitCollection: UITraitCollection @@ -920,7 +920,7 @@ extension HomepageViewController: UIAdaptivePresentationControllerDelegate { } // MARK: FirefoxHomeViewModelDelegate -extension HomepageViewController: HomepageViewModelDelegate { +extension LegacyHomepageViewController: HomepageViewModelDelegate { func reloadView() { ensureMainThread { [weak self] in guard let self = self else { return } @@ -930,13 +930,13 @@ extension HomepageViewController: HomepageViewModelDelegate { self.collectionView.collectionViewLayout.invalidateLayout() self.logger.log("Amount of sections shown is \(self.viewModel.shownSections.count)", level: .debug, - category: .homepage) + category: .legacyHomepage) } } } // MARK: - Notifiable -extension HomepageViewController: Notifiable { +extension LegacyHomepageViewController: Notifiable { func handleNotifications(_ notification: Notification) { ensureMainThread { [weak self] in guard let self = self else { return } diff --git a/firefox-ios/Client/Frontend/Home/PrivateHome/PrivateHomepageViewController.swift b/firefox-ios/Client/Frontend/Home/PrivateHome/PrivateHomepageViewController.swift index 7c7a80aca430..9559849e61e2 100644 --- a/firefox-ios/Client/Frontend/Home/PrivateHome/PrivateHomepageViewController.swift +++ b/firefox-ios/Client/Frontend/Home/PrivateHome/PrivateHomepageViewController.swift @@ -209,7 +209,7 @@ final class PrivateHomepageViewController: guard let privateBrowsingURL = SupportUtils.URLForPrivateBrowsingLearnMore else { self.logger.log("Failed to retrieve URL from SupportUtils.URLForPrivateBrowsingLearnMore", level: .debug, - category: .homepage) + category: .legacyHomepage) return } parentCoordinator?.homePanelDidRequestToOpenInNewTab( diff --git a/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileNetworking.swift b/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileNetworking.swift index 398d15c2d990..fa3374537131 100644 --- a/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileNetworking.swift +++ b/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileNetworking.swift @@ -38,7 +38,7 @@ class DefaultContileNetwork: ContileNetworking { if let error = error { self.logger.log("An error occurred while fetching data: \(error)", level: .debug, - category: .homepage) + category: .legacyHomepage) completion(.failure(ContileNetworkingError.dataUnavailable)) return } @@ -48,7 +48,7 @@ class DefaultContileNetwork: ContileNetworking { else { self.logger.log("Response isn't valid, data is nil?: \(data == nil)", level: .debug, - category: .homepage) + category: .legacyHomepage) completion(.failure(ContileNetworkingError.dataUnavailable)) return } diff --git a/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileProvider.swift b/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileProvider.swift index d5a966e575de..4b355bc95f1f 100644 --- a/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileProvider.swift +++ b/firefox-ios/Client/Frontend/Home/TopSites/DataManagement/ContileProvider.swift @@ -52,7 +52,7 @@ class ContileProvider: ContileProviderInterface, URLCaching, FeatureFlaggable { guard let resourceEndpoint = resourceEndpoint else { logger.log("The Contile resource URL is invalid: \(String(describing: resourceEndpoint))", level: .warning, - category: .homepage) + category: .legacyHomepage) completion(.failure(Error.noDataAvailable)) return } @@ -96,7 +96,7 @@ class ContileProvider: ContileProviderInterface, URLCaching, FeatureFlaggable { } catch let error { self.logger.log("Unable to parse with error: \(error)", level: .warning, - category: .homepage) + category: .legacyHomepage) completion(.failure(Error.noDataAvailable)) } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Interface/WallpaperManager.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Interface/WallpaperManager.swift index 787d58f81cb1..6f326129eeea 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Interface/WallpaperManager.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Interface/WallpaperManager.swift @@ -109,7 +109,7 @@ class WallpaperManager: WallpaperManagerInterface, FeatureFlaggable { } catch { logger.log("Failed to set wallpaper: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) completion(.failure(WallpaperManagerError.other(error))) } } @@ -148,7 +148,7 @@ class WallpaperManager: WallpaperManagerInterface, FeatureFlaggable { } catch { logger.log("Error fetching wallpaper resources: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) completion(.failure(WallpaperManagerError.downloadFailed(error))) } } @@ -237,7 +237,7 @@ class WallpaperManager: WallpaperManagerInterface, FeatureFlaggable { } catch { logger.log("Error getting stored metadata: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) return nil } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperFilePathProvider.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperFilePathProvider.swift index fe2328e3a7ea..db8fa19ffb0d 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperFilePathProvider.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperFilePathProvider.swift @@ -28,7 +28,7 @@ struct WallpaperFilePathProvider { guard let keyDirectoryPath = folderPath(forKey: metadataKey) else { logger.log("WallpaperFilePathProtocol - error fetching keyed directory path for application", level: .debug, - category: .homepage) + category: .legacyHomepage) return nil } @@ -47,7 +47,7 @@ struct WallpaperFilePathProvider { guard let keyDirectoryPath = folderPath(forKey: key) else { logger.log("WallpaperFilePathProvider - error fetching keyed directory path for application", level: .debug, - category: .homepage) + category: .legacyHomepage) return nil } @@ -76,7 +76,7 @@ struct WallpaperFilePathProvider { else { logger.log("WallpaperFilePathProvider - error fetching basePath for application", level: .debug, - category: .homepage) + category: .legacyHomepage) return nil } @@ -96,7 +96,7 @@ struct WallpaperFilePathProvider { } catch { logger.log("Could not create directory at \(directoryPath.absoluteString)", level: .debug, - category: .homepage) + category: .legacyHomepage) } } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMetadataUtility.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMetadataUtility.swift index ba283b8ee099..416b2fa03501 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMetadataUtility.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMetadataUtility.swift @@ -57,7 +57,7 @@ class WallpaperMetadataUtility { } catch { logger.log("Failed to fetch new metadata: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) return false } } @@ -98,7 +98,7 @@ class WallpaperMetadataUtility { } catch { logger.log("Failed to get old metadata: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) return true } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMigrationUtility.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMigrationUtility.swift index db7d6d649d6c..665788b1e1f1 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMigrationUtility.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperMigrationUtility.swift @@ -49,7 +49,7 @@ struct WallpaperMigrationUtility { } catch { logger.log("Metadata migration error: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperStorageUtility.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperStorageUtility.swift index e042da8e9613..7d31bed27617 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperStorageUtility.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperStorageUtility.swift @@ -93,7 +93,7 @@ struct WallpaperStorageUtility: WallpaperMetadataCodableProtocol { } catch { logger.log("WallpaperStorageUtility decoding error: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) } } diff --git a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperThumbnailUtility.swift b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperThumbnailUtility.swift index 2f5e0602ff32..ef16b6d80e6b 100644 --- a/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperThumbnailUtility.swift +++ b/firefox-ios/Client/Frontend/Home/Wallpapers/v1/Utilities/WallpaperThumbnailUtility.swift @@ -56,7 +56,7 @@ class WallpaperThumbnailUtility { } catch { logger.log("Wallpaper thumbnail update error: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) } } diff --git a/firefox-ios/Client/Frontend/Settings/HomepageSettings/WallpaperSettings/v1/WallpaperSettingsViewController.swift b/firefox-ios/Client/Frontend/Settings/HomepageSettings/WallpaperSettings/v1/WallpaperSettingsViewController.swift index 95cd205bac31..e11596930982 100644 --- a/firefox-ios/Client/Frontend/Settings/HomepageSettings/WallpaperSettings/v1/WallpaperSettingsViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/HomepageSettings/WallpaperSettings/v1/WallpaperSettingsViewController.swift @@ -265,7 +265,7 @@ private extension WallpaperSettingsViewController { case .failure(let error): self?.logger.log("Could not download and set wallpaper: \(error.localizedDescription)", level: .warning, - category: .homepage) + category: .legacyHomepage) self?.showError(error) { _ in self?.downloadAndSetWallpaper(at: indexPath) } diff --git a/firefox-ios/Client/Frontend/TrackingProtection/CertificatesHandler.swift b/firefox-ios/Client/Frontend/TrackingProtection/CertificatesHandler.swift index 7e96e81330fd..408a155e25e0 100644 --- a/firefox-ios/Client/Frontend/TrackingProtection/CertificatesHandler.swift +++ b/firefox-ios/Client/Frontend/TrackingProtection/CertificatesHandler.swift @@ -35,7 +35,7 @@ class CertificatesHandler { } catch { DefaultLogger.shared.log("\(error)", level: .warning, - category: .homepage) + category: .certificate) } } return certificates @@ -54,7 +54,7 @@ func getCertificates(for url: URL, completion: @escaping ([Certificate]?) -> Voi if let error = error { DefaultLogger.shared.log("\(error)", level: .warning, - category: .homepage) + category: .certificate) completion(nil) } } diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/BrowserCoordinatorTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/BrowserCoordinatorTests.swift index c36d337de635..0fe75087085a 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/BrowserCoordinatorTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/BrowserCoordinatorTests.swift @@ -91,40 +91,48 @@ final class BrowserCoordinatorTests: XCTestCase, FeatureFlaggable { func testShowHomepage_addsOneHomepageOnly() { let subject = createSubject() - subject.showHomepage(inline: true, - toastContainer: UIView(), - homepanelDelegate: subject.browserViewController, - libraryPanelDelegate: subject.browserViewController, - statusBarScrollDelegate: scrollDelegate, - overlayManager: overlayModeManager) - - let secondHomepage = HomepageViewController(profile: profile, - toastContainer: UIView(), - tabManager: tabManager, - overlayManager: overlayModeManager) + subject.showLegacyHomepage( + inline: true, + toastContainer: UIView(), + homepanelDelegate: subject.browserViewController, + libraryPanelDelegate: subject.browserViewController, + statusBarScrollDelegate: scrollDelegate, + overlayManager: overlayModeManager + ) + + let secondHomepage = LegacyHomepageViewController( + profile: profile, + toastContainer: UIView(), + tabManager: tabManager, + overlayManager: overlayModeManager + ) XCTAssertFalse(subject.browserViewController.contentContainer.canAdd(content: secondHomepage)) - XCTAssertNotNil(subject.homepageViewController) + XCTAssertNotNil(subject.legacyHomepageViewController) XCTAssertNil(subject.webviewController) } func testShowHomepage_reuseExistingHomepage() { let subject = createSubject() - subject.showHomepage(inline: true, - toastContainer: UIView(), - homepanelDelegate: subject.browserViewController, - libraryPanelDelegate: subject.browserViewController, - statusBarScrollDelegate: scrollDelegate, - overlayManager: overlayModeManager) - let firstHomepage = subject.homepageViewController - XCTAssertNotNil(subject.homepageViewController) - - subject.showHomepage(inline: true, - toastContainer: UIView(), - homepanelDelegate: subject.browserViewController, - libraryPanelDelegate: subject.browserViewController, - statusBarScrollDelegate: scrollDelegate, - overlayManager: overlayModeManager) - let secondHomepage = subject.homepageViewController + subject.showLegacyHomepage( + inline: true, + toastContainer: UIView(), + homepanelDelegate: subject.browserViewController, + libraryPanelDelegate: subject.browserViewController, + statusBarScrollDelegate: scrollDelegate, + overlayManager: overlayModeManager + ) + let firstHomepage = subject.legacyHomepageViewController + XCTAssertNotNil(subject.legacyHomepageViewController) + + subject.showLegacyHomepage( + inline: true, + toastContainer: UIView(), + homepanelDelegate: subject.browserViewController, + libraryPanelDelegate: subject.browserViewController, + statusBarScrollDelegate: scrollDelegate, + overlayManager: overlayModeManager + ) + let secondHomepage = subject.legacyHomepageViewController XCTAssertEqual(firstHomepage, secondHomepage) } @@ -132,21 +140,21 @@ final class BrowserCoordinatorTests: XCTestCase, FeatureFlaggable { func testShowNewHomepage_setsProperViewController() { let subject = createSubject() - subject.showNewHomepage() + subject.showHomepage() - XCTAssertNotNil(subject.newHomepageViewController) + XCTAssertNotNil(subject.homepageViewController) XCTAssertNil(subject.webviewController) XCTAssertNil(subject.privateViewController) } func testShowNewHomepage_hasSameInstance() { let subject = createSubject() - subject.showNewHomepage() - let firstHomepage = subject.newHomepageViewController - XCTAssertNotNil(subject.newHomepageViewController) + subject.showHomepage() + let firstHomepage = subject.homepageViewController + XCTAssertNotNil(subject.homepageViewController) - subject.showNewHomepage() - let secondHomepage = subject.newHomepageViewController + subject.showHomepage() + let secondHomepage = subject.homepageViewController XCTAssertEqual(firstHomepage, secondHomepage) } @@ -159,7 +167,7 @@ final class BrowserCoordinatorTests: XCTestCase, FeatureFlaggable { subject.browserViewController = mbvc subject.show(webView: webview) - XCTAssertNil(subject.homepageViewController) + XCTAssertNil(subject.legacyHomepageViewController) XCTAssertNotNil(subject.webviewController) XCTAssertEqual(mbvc.embedContentCalled, 1) XCTAssertEqual(mbvc.saveEmbeddedContent?.contentType, .webview) diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/ContentContainerTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/ContentContainerTests.swift index 5d80db939fe9..7ee1198fe5f7 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/ContentContainerTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/ContentContainerTests.swift @@ -47,14 +47,14 @@ final class ContentContainerTests: XCTestCase { func testCanAddNewHomepage() { let subject = ContentContainer(frame: .zero) - let homepage = NewHomepageViewController(windowUUID: .XCTestDefaultUUID) + let homepage = HomepageViewController(windowUUID: .XCTestDefaultUUID) XCTAssertTrue(subject.canAdd(content: homepage)) } func testCanAddNewHomepageOnceOnly() { let subject = ContentContainer(frame: .zero) - let homepage = NewHomepageViewController(windowUUID: .XCTestDefaultUUID) + let homepage = HomepageViewController(windowUUID: .XCTestDefaultUUID) subject.add(content: homepage) XCTAssertFalse(subject.canAdd(content: homepage)) @@ -100,19 +100,19 @@ final class ContentContainerTests: XCTestCase { XCTAssertFalse(subject.canAdd(content: webview)) } - // MARK: - hasHomepage + // MARK: - hashasLegacyHomepage func testHasHomepage_trueWhenHomepage() { let subject = ContentContainer(frame: .zero) let homepage = createHomepage() subject.add(content: homepage) - XCTAssertTrue(subject.hasHomepage) + XCTAssertTrue(subject.hasLegacyHomepage) } func testHasHomepage_falseWhenNil() { let subject = ContentContainer(frame: .zero) - XCTAssertFalse(subject.hasHomepage) + XCTAssertFalse(subject.hasLegacyHomepage) } func testHasHomepage_falseWhenWebview() { @@ -123,19 +123,19 @@ final class ContentContainerTests: XCTestCase { XCTAssertFalse(subject.hasHomepage) } - // MARK: - hasNewHomepage + // MARK: - hasHomepage func testHasNewHomepage_returnsTrueWhenAdded() { let subject = ContentContainer(frame: .zero) - let homepage = NewHomepageViewController(windowUUID: .XCTestDefaultUUID) + let homepage = HomepageViewController(windowUUID: .XCTestDefaultUUID) subject.add(content: homepage) - XCTAssertTrue(subject.hasNewHomepage) + XCTAssertTrue(subject.hasHomepage) } func testHasNewHomepage_returnsFalseWhenNil() { let subject = ContentContainer(frame: .zero) - XCTAssertFalse(subject.hasNewHomepage) + XCTAssertFalse(subject.hasHomepage) } func testHasNewHomepage_returnsFalseWhenWebview() { @@ -143,7 +143,7 @@ final class ContentContainerTests: XCTestCase { let webview = WebviewViewController(webView: WKWebView()) subject.add(content: webview) - XCTAssertFalse(subject.hasNewHomepage) + XCTAssertFalse(subject.hasHomepage) } // MARK: - hasPrivateHomepage @@ -188,7 +188,7 @@ final class ContentContainerTests: XCTestCase { func testContentView_hasContentNewHomepage_viewIsNotNil() { let subject = ContentContainer(frame: .zero) - let homepage = NewHomepageViewController(windowUUID: .XCTestDefaultUUID) + let homepage = HomepageViewController(windowUUID: .XCTestDefaultUUID) subject.add(content: homepage) XCTAssertNotNil(subject.contentView) } @@ -205,22 +205,22 @@ final class ContentContainerTests: XCTestCase { // MARK: update method - func test_update_hasHomepage_returnsTrue() { + func test_update_hasLegacyHomepage_returnsTrue() { let subject = ContentContainer(frame: .zero) let homepage = createHomepage() subject.update(content: homepage) - XCTAssertTrue(subject.hasHomepage) - XCTAssertFalse(subject.hasNewHomepage) + XCTAssertTrue(subject.hasLegacyHomepage) + XCTAssertFalse(subject.hasHomepage) XCTAssertFalse(subject.hasPrivateHomepage) XCTAssertFalse(subject.hasWebView) } func test_update_hasNewHomepage_returnsTrue() { let subject = ContentContainer(frame: .zero) - let homepage = NewHomepageViewController(windowUUID: .XCTestDefaultUUID) + let homepage = HomepageViewController(windowUUID: .XCTestDefaultUUID) subject.update(content: homepage) - XCTAssertTrue(subject.hasNewHomepage) - XCTAssertFalse(subject.hasHomepage) + XCTAssertTrue(subject.hasHomepage) + XCTAssertFalse(subject.hasLegacyHomepage) XCTAssertFalse(subject.hasPrivateHomepage) XCTAssertFalse(subject.hasWebView) } @@ -233,8 +233,8 @@ final class ContentContainerTests: XCTestCase { ) subject.update(content: privateHomepage) XCTAssertTrue(subject.hasPrivateHomepage) + XCTAssertFalse(subject.hasLegacyHomepage) XCTAssertFalse(subject.hasHomepage) - XCTAssertFalse(subject.hasNewHomepage) XCTAssertFalse(subject.hasWebView) } @@ -243,15 +243,17 @@ final class ContentContainerTests: XCTestCase { let webview = WebviewViewController(webView: WKWebView()) subject.update(content: webview) XCTAssertTrue(subject.hasWebView) + XCTAssertFalse(subject.hasLegacyHomepage) XCTAssertFalse(subject.hasHomepage) - XCTAssertFalse(subject.hasNewHomepage) XCTAssertFalse(subject.hasPrivateHomepage) } - private func createHomepage() -> HomepageViewController { - return HomepageViewController(profile: profile, - toastContainer: UIView(), - tabManager: MockTabManager(), - overlayManager: overlayModeManager) + private func createHomepage() -> LegacyHomepageViewController { + return LegacyHomepageViewController( + profile: profile, + toastContainer: UIView(), + tabManager: MockTabManager(), + overlayManager: overlayModeManager + ) } } diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/HomepageViewControllerTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/LegacyHomepageViewControllerTests.swift similarity index 85% rename from firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/HomepageViewControllerTests.swift rename to firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/LegacyHomepageViewControllerTests.swift index 34a2c9aa52d4..a87e5aec4a32 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/HomepageViewControllerTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Home/LegacyHomepageViewControllerTests.swift @@ -7,7 +7,7 @@ import XCTest import Common -class HomepageViewControllerTests: XCTestCase { +class LegacyHomepageViewControllerTests: XCTestCase { var profile: MockProfile! override func setUp() { @@ -31,10 +31,12 @@ class HomepageViewControllerTests: XCTestCase { let overlayManager = MockOverlayModeManager() overlayManager.setURLBar(urlBarView: urlBar) - let firefoxHomeViewController = HomepageViewController(profile: profile, - toastContainer: UIView(), - tabManager: tabManager, - overlayManager: overlayManager) + let firefoxHomeViewController = LegacyHomepageViewController( + profile: profile, + toastContainer: UIView(), + tabManager: tabManager, + overlayManager: overlayManager + ) trackForMemoryLeaks(firefoxHomeViewController) } @@ -47,7 +49,7 @@ class HomepageViewControllerTests: XCTestCase { let overlayManager = MockOverlayModeManager() overlayManager.setURLBar(urlBarView: urlBar) - let subject = HomepageViewController( + let subject = LegacyHomepageViewController( profile: profile, toastContainer: UIView(), tabManager: tabManager, diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageDiffableDataSourceTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageDiffableDataSourceTests.swift similarity index 93% rename from firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageDiffableDataSourceTests.swift rename to firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageDiffableDataSourceTests.swift index fe2af79588db..f2667dcef04e 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageDiffableDataSourceTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageDiffableDataSourceTests.swift @@ -6,16 +6,16 @@ import XCTest @testable import Client -final class NewHomepageDiffableDataSourceTests: XCTestCase { +final class HomepageDiffableDataSourceTests: XCTestCase { var collectionView: UICollectionView? - var diffableDataSource: NewHomepageDiffableDataSource? + var diffableDataSource: HomepageDiffableDataSource? override func setUpWithError() throws { try super.setUpWithError() collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) let collectionView = try XCTUnwrap(collectionView) - diffableDataSource = NewHomepageDiffableDataSource( + diffableDataSource = HomepageDiffableDataSource( collectionView: collectionView ) { (collectionView, indexPath, item) -> UICollectionViewCell? in return UICollectionViewCell() diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageViewControllerTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageViewControllerTests.swift similarity index 87% rename from firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageViewControllerTests.swift rename to firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageViewControllerTests.swift index 01186c1d265a..8f379a0579be 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/NewHomepageViewControllerTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/Frontend/Homepage Rebuild/HomepageViewControllerTests.swift @@ -7,7 +7,7 @@ import Common @testable import Client -final class NewHomepageViewControllerTests: XCTestCase { +final class HomepageViewControllerTests: XCTestCase { let windowUUID: WindowUUID = .XCTestDefaultUUID var mockNotificationCenter: MockNotificationCenter? var mockThemeManager: MockThemeManager? @@ -26,7 +26,7 @@ final class NewHomepageViewControllerTests: XCTestCase { func testInitialCreation_hasCorrectContentType() { let sut = createSubject() - XCTAssertEqual(sut.contentType, .newHomepage) + XCTAssertEqual(sut.contentType, .homepage) } func testInitialCreation_hasCorrectWindowUUID() { @@ -50,7 +50,7 @@ final class NewHomepageViewControllerTests: XCTestCase { // MARK: - Deinit State func testDeinit_callsAppropriateNotificationCenterMethods() { - var sut: NewHomepageViewController? = createSubject() + var sut: HomepageViewController? = createSubject() XCTAssertNotNil(sut) XCTAssertEqual(mockNotificationCenter?.removeObserverCallCount, 0) @@ -61,12 +61,12 @@ final class NewHomepageViewControllerTests: XCTestCase { XCTAssertEqual(mockNotificationCenter?.removeObserverCallCount, 1) } - private func createSubject() -> NewHomepageViewController { + private func createSubject() -> HomepageViewController { let notificationCenter = MockNotificationCenter() let themeManager = MockThemeManager() mockNotificationCenter = notificationCenter mockThemeManager = themeManager - let homepageViewController = NewHomepageViewController( + let homepageViewController = HomepageViewController( windowUUID: .XCTestDefaultUUID, themeManager: themeManager, notificationCenter: notificationCenter