From 9eb444c4192683304a0fc89c69cb8c7af475fb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=C5=9Apiewak?= Date: Mon, 21 Oct 2024 11:21:02 +0200 Subject: [PATCH] Remove HomeSectionRenderer protocol --- DuckDuckGo.xcodeproj/project.pbxproj | 8 -- .../FavoritesHomeViewSectionRenderer.swift | 2 +- DuckDuckGo/HomeViewSectionRenderer.swift | 85 ------------- .../HomeViewSectionRenderersExtension.swift | 115 ------------------ 4 files changed, 1 insertion(+), 209 deletions(-) delete mode 100644 DuckDuckGo/HomeViewSectionRenderer.swift delete mode 100644 DuckDuckGo/HomeViewSectionRenderersExtension.swift diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index b5568e80d3..818b7e8206 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -391,7 +391,6 @@ 850559D023CF647C0055C0D5 /* PreserveLogins.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850559CF23CF647C0055C0D5 /* PreserveLogins.swift */; }; 850559D223CF710C0055C0D5 /* WebCacheManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850559D123CF710C0055C0D5 /* WebCacheManagerTests.swift */; }; 85058366219AE9EA00ED4EDB /* HomePageConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85058365219AE9EA00ED4EDB /* HomePageConfiguration.swift */; }; - 85058368219C49E000ED4EDB /* HomeViewSectionRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85058367219C49E000ED4EDB /* HomeViewSectionRenderer.swift */; }; 85058369219F424500ED4EDB /* UIColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1B745211E549D550072547E /* UIColorExtension.swift */; }; 8505836A219F424500ED4EDB /* UIAlertControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83004E832193E14C00DA013C /* UIAlertControllerExtension.swift */; }; 8505836C219F424500ED4EDB /* TextFieldWithInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F197EA3B1E6885F20029BDC1 /* TextFieldWithInsets.swift */; }; @@ -530,7 +529,6 @@ 85C29708247BDD060063A335 /* DaxDialogsBrowsingSpecTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C29706247BDCFF0063A335 /* DaxDialogsBrowsingSpecTests.swift */; }; 85C2970A247EB7AA0063A335 /* Text.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 85C29709247EB7AA0063A335 /* Text.xcassets */; }; 85C2971A248162CA0063A335 /* DaxOnboardingPadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C29719248162CA0063A335 /* DaxOnboardingPadViewController.swift */; }; - 85C861E628FF1B5F00189466 /* HomeViewSectionRenderersExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C861E528FF1B5F00189466 /* HomeViewSectionRenderersExtension.swift */; }; 85C8E61D2B0E47380029A6BD /* BookmarksDatabaseSetup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C8E61C2B0E47380029A6BD /* BookmarksDatabaseSetup.swift */; }; 85C91CA224671F4C00A11132 /* AppDeepLinkSchemes.swift in Sources */ = {isa = PBXBuildFile; fileRef = F17D723B1E8BB374003E8B0E /* AppDeepLinkSchemes.swift */; }; 85CA53A824BB343700A6288C /* Favicons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85CA53A324B9F2BD00A6288C /* Favicons.swift */; }; @@ -1680,7 +1678,6 @@ 850559CF23CF647C0055C0D5 /* PreserveLogins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreserveLogins.swift; sourceTree = ""; }; 850559D123CF710C0055C0D5 /* WebCacheManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebCacheManagerTests.swift; sourceTree = ""; }; 85058365219AE9EA00ED4EDB /* HomePageConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageConfiguration.swift; sourceTree = ""; }; - 85058367219C49E000ED4EDB /* HomeViewSectionRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewSectionRenderer.swift; sourceTree = ""; }; 850ABD002AC3961100A733DF /* MainViewController+Segues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MainViewController+Segues.swift"; sourceTree = ""; }; 850ABD022AC4D46C00A733DF /* SuggestionTray.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SuggestionTray.storyboard; sourceTree = ""; }; 850F93DA2B594AB800823EEA /* ZippedPassKitPreviewHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZippedPassKitPreviewHelper.swift; sourceTree = ""; }; @@ -1811,7 +1808,6 @@ 85C29706247BDCFF0063A335 /* DaxDialogsBrowsingSpecTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DaxDialogsBrowsingSpecTests.swift; sourceTree = ""; }; 85C29709247EB7AA0063A335 /* Text.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Text.xcassets; sourceTree = ""; }; 85C29719248162CA0063A335 /* DaxOnboardingPadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DaxOnboardingPadViewController.swift; sourceTree = ""; }; - 85C861E528FF1B5F00189466 /* HomeViewSectionRenderersExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewSectionRenderersExtension.swift; sourceTree = ""; }; 85C8E61C2B0E47380029A6BD /* BookmarksDatabaseSetup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksDatabaseSetup.swift; sourceTree = ""; }; 85CA53A324B9F2BD00A6288C /* Favicons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Favicons.swift; path = ../DuckDuckGo/Favicons.swift; sourceTree = ""; }; 85CA53A924BB376800A6288C /* NotFoundCachingDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotFoundCachingDownloader.swift; sourceTree = ""; }; @@ -3822,8 +3818,6 @@ children = ( 85B9CB8321AEBD72009001F1 /* Cells */, 85374D3621AC417200FF5A1E /* Renderers */, - 85058367219C49E000ED4EDB /* HomeViewSectionRenderer.swift */, - 85C861E528FF1B5F00189466 /* HomeViewSectionRenderersExtension.swift */, ); name = FavoritesSearchOverlay; sourceTree = ""; @@ -7628,7 +7622,6 @@ 1DEAADEC2BA45B4500E25A97 /* SettingsAccessibilityView.swift in Sources */, 85C8E61D2B0E47380029A6BD /* BookmarksDatabaseSetup.swift in Sources */, 3132FA2C27A07A1B00DD7A12 /* FilePreview.swift in Sources */, - 85C861E628FF1B5F00189466 /* HomeViewSectionRenderersExtension.swift in Sources */, CB825C922C071B1400BCC586 /* AlertView.swift in Sources */, 1DDF40292BA04FCD006850D9 /* SettingsPrivacyProtectionsView.swift in Sources */, BDE91CD82C629A910005CB74 /* UnifiedFeedbackSender.swift in Sources */, @@ -7684,7 +7677,6 @@ 85058369219F424500ED4EDB /* UIColorExtension.swift in Sources */, BDE219E62C406D19005D5884 /* PrivacyProDataReporting.swift in Sources */, D6E83C312B1EA309006C8AFB /* SettingsCell.swift in Sources */, - 85058368219C49E000ED4EDB /* HomeViewSectionRenderer.swift in Sources */, 1DEAADEE2BA45DFE00E25A97 /* SettingsDataClearingView.swift in Sources */, 6F96FF102C2B128500162692 /* NewTabPageCustomizeButtonView.swift in Sources */, EE01EB432AFC1E0A0096AAC9 /* NetworkProtectionVPNLocationView.swift in Sources */, diff --git a/DuckDuckGo/FavoritesHomeViewSectionRenderer.swift b/DuckDuckGo/FavoritesHomeViewSectionRenderer.swift index 55cd05b365..e4cf90c408 100644 --- a/DuckDuckGo/FavoritesHomeViewSectionRenderer.swift +++ b/DuckDuckGo/FavoritesHomeViewSectionRenderer.swift @@ -34,7 +34,7 @@ protocol FavoritesHomeViewSectionRendererDelegate: AnyObject { favoriteDeleted favorite: BookmarkEntity) } -class FavoritesHomeViewSectionRenderer: NSObject, HomeViewSectionRenderer { +class FavoritesHomeViewSectionRenderer { struct Constants { diff --git a/DuckDuckGo/HomeViewSectionRenderer.swift b/DuckDuckGo/HomeViewSectionRenderer.swift deleted file mode 100644 index fae5a39eca..0000000000 --- a/DuckDuckGo/HomeViewSectionRenderer.swift +++ /dev/null @@ -1,85 +0,0 @@ -// -// HomeViewSectionRenderer.swift -// DuckDuckGo -// -// Copyright © 2018 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 - -protocol HomeViewSectionRenderer: AnyObject { - - // MARK: required - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int - - func collectionView(_ collectionView: UICollectionView, - cellForItemAt indexPath: IndexPath) -> UICollectionViewCell - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - sizeForItemAt indexPath: IndexPath) -> CGSize - - // MARK: optional - - func openedAsNewTab(allowingKeyboard: Bool) - - func launchNewSearch() - - func supportsReordering() -> Bool - - func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool - - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - referenceSizeForHeaderInSection section: Int) -> CGSize? - - func scrollViewDidScroll(_ scrollView: UIScrollView) - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - referenceSizeForFooterInSection section: Int) -> CGSize? - - func collectionView(_ collectionView: UICollectionView, - viewForSupplementaryElementOfKind kind: String, - at indexPath: IndexPath) -> UICollectionReusableView - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - insetForSectionAt section: Int) -> UIEdgeInsets? - - func collectionView(_ collectionView: UICollectionView, - contextMenuConfigurationForItemAt indexPath: IndexPath, - point: CGPoint) -> UIContextMenuConfiguration? - - func collectionView(_ collectionView: UICollectionView, - previewForDismissingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? - - func collectionView(_ collectionView: UICollectionView, - previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? - - func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] - - func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) - - func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal - - func endReordering() - - func didAppear() - -} diff --git a/DuckDuckGo/HomeViewSectionRenderersExtension.swift b/DuckDuckGo/HomeViewSectionRenderersExtension.swift deleted file mode 100644 index 2a98cb16f4..0000000000 --- a/DuckDuckGo/HomeViewSectionRenderersExtension.swift +++ /dev/null @@ -1,115 +0,0 @@ -// -// HomeViewSectionRenderersExtension.swift -// DuckDuckGo -// -// Copyright © 2022 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 - -/// An extension that implements the protocol so that other classes don't need to implement everything. -extension HomeViewSectionRenderer { - - func openedAsNewTab(allowingKeyboard: Bool) { } - - func menuItemsFor(itemAt: Int) -> [UIMenuItem]? { - return nil - } - - func launchNewSearch() { } - - func supportsReordering() -> Bool { return false } - - func collectionView(_ collectionView: UICollectionView, - canMoveItemAt indexPath: IndexPath) -> Bool { - return false - } - - func collectionView(_ collectionView: UICollectionView, - moveItemAt sourceIndexPath: IndexPath, - to destinationIndexPath: IndexPath) { } - - func collectionView(_ collectionView: UICollectionView, - targetIndexPathForMoveFromItemAt originalIndexPath: IndexPath, - toProposedIndexPath proposedIndexPath: IndexPath) -> IndexPath? { - return nil - } - - func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { - return false - } - - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { } - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - referenceSizeForHeaderInSection section: Int) -> CGSize? { - return nil - } - - func scrollViewDidScroll(_ scrollView: UIScrollView) { } - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - referenceSizeForFooterInSection section: Int) -> CGSize? { - return nil - } - - func collectionView(_ collectionView: UICollectionView, - viewForSupplementaryElementOfKind kind: String, - at indexPath: IndexPath) -> UICollectionReusableView { - return collectionView.dequeueReusableSupplementaryView(ofKind: kind, - withReuseIdentifier: EmptyCollectionReusableView.reuseIdentifier, - for: indexPath) - } - - func collectionView(_ collectionView: UICollectionView, - layout collectionViewLayout: UICollectionViewLayout, - insetForSectionAt section: Int) -> UIEdgeInsets? { - return nil - } - - func collectionView(_ collectionView: UICollectionView, - contextMenuConfigurationForItemAt indexPath: IndexPath, - point: CGPoint) -> UIContextMenuConfiguration? { - return nil - } - - - func collectionView(_ collectionView: UICollectionView, - previewForDismissingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? { - return nil - } - - func collectionView(_ collectionView: UICollectionView, - previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? { - return nil - } - - func collectionView(_ collectionView: UICollectionView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { - return [] - } - - func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator) { - } - - func collectionView(_ collectionView: UICollectionView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UICollectionViewDropProposal { - return UICollectionViewDropProposal(operation: .forbidden) - } - - func endReordering() { } - - func didAppear() { } -}