From e283e274e3e053391e8618b718b2d75c13b671d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Est=C3=AAv=C3=A3o?= Date: Mon, 18 Nov 2024 10:51:07 +0000 Subject: [PATCH] Refactor class models --- podcasts.xcodeproj/project.pbxproj | 8 ++++---- podcasts/DownloadsViewController.swift | 4 ++-- ...annerView.swift => ManageDownloadsBannerView.swift} | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) rename podcasts/{DownloadsManageBannerView.swift => ManageDownloadsBannerView.swift} (90%) diff --git a/podcasts.xcodeproj/project.pbxproj b/podcasts.xcodeproj/project.pbxproj index 6be918256..8808ec21c 100644 --- a/podcasts.xcodeproj/project.pbxproj +++ b/podcasts.xcodeproj/project.pbxproj @@ -1749,7 +1749,7 @@ FF06AFA72CB692D30099EC9B /* MediaFileHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF06AFA62CB692D30099EC9B /* MediaFileHandle.swift */; }; FF06AFA82CB692D30099EC9B /* MediaFileHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF06AFA62CB692D30099EC9B /* MediaFileHandle.swift */; }; FF09982E2CDA996D00C1647B /* MarqueeTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF09982D2CDA996D00C1647B /* MarqueeTextView.swift */; }; - FF0998302CE79C8F00C1647B /* DownloadsManageBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF09982F2CE79C7500C1647B /* DownloadsManageBannerView.swift */; }; + FF0998302CE79C8F00C1647B /* ManageDownloadsBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF09982F2CE79C7500C1647B /* ManageDownloadsBannerView.swift */; }; FF0A1D522C580CF5003931E6 /* TranscriptsDataRetriever.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF6BBCF12C578CE600604A01 /* TranscriptsDataRetriever.swift */; }; FF1D0CB82C9CE11300F600C6 /* ReferralsMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1D0CB72C9CE11300F600C6 /* ReferralsMessageView.swift */; }; FF1D0CBA2C9DC62200F600C6 /* ReferralsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF1D0CB92C9DC62200F600C6 /* ReferralsCoordinator.swift */; }; @@ -3694,7 +3694,7 @@ FF06AFA22CB6928B0099EC9B /* MediaExporterResourceLoaderDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaExporterResourceLoaderDelegate.swift; sourceTree = ""; }; FF06AFA62CB692D30099EC9B /* MediaFileHandle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaFileHandle.swift; sourceTree = ""; }; FF09982D2CDA996D00C1647B /* MarqueeTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarqueeTextView.swift; sourceTree = ""; }; - FF09982F2CE79C7500C1647B /* DownloadsManageBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadsManageBannerView.swift; sourceTree = ""; }; + FF09982F2CE79C7500C1647B /* ManageDownloadsBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManageDownloadsBannerView.swift; sourceTree = ""; }; FF1D0CB72C9CE11300F600C6 /* ReferralsMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReferralsMessageView.swift; sourceTree = ""; }; FF1D0CB92C9DC62200F600C6 /* ReferralsCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReferralsCoordinator.swift; sourceTree = ""; }; FF1DF0192C8A206E0028B8D8 /* ReferralCardAnimatedGradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReferralCardAnimatedGradientView.swift; sourceTree = ""; }; @@ -5946,7 +5946,7 @@ BD7516E01C0FC8180099F53E /* Downloads */ = { isa = PBXGroup; children = ( - FF09982F2CE79C7500C1647B /* DownloadsManageBannerView.swift */, + FF09982F2CE79C7500C1647B /* ManageDownloadsBannerView.swift */, BDA2065E1BB3D4D600D38389 /* DownloadsViewController.swift */, BDF5FD1D1FD8D38900F2A339 /* DownloadsViewController+Table.swift */, BDDF8AA7240CEBF9009BA263 /* DownloadsViewController+Swipe.swift */, @@ -10128,7 +10128,7 @@ 403B5B0021796F2F00821A54 /* DownloadFilterOverlayController.swift in Sources */, 102141152C7E12CB0065D34A /* PlusPaywallReviewsStars.swift in Sources */, 4041FEA7218FF3B80089D4A1 /* AddCell.swift in Sources */, - FF0998302CE79C8F00C1647B /* DownloadsManageBannerView.swift in Sources */, + FF0998302CE79C8F00C1647B /* ManageDownloadsBannerView.swift in Sources */, BD4BBFA21D221FDA001BEE4D /* Queue.swift in Sources */, 8B99197729A686BA00A5C81C /* SearchResultsView.swift in Sources */, 40E1B4CA2255856C006C96CE /* FiltersShortcutsViewController.swift in Sources */, diff --git a/podcasts/DownloadsViewController.swift b/podcasts/DownloadsViewController.swift index 95c5544ed..f2e6c4ad7 100644 --- a/podcasts/DownloadsViewController.swift +++ b/podcasts/DownloadsViewController.swift @@ -141,7 +141,7 @@ class DownloadsViewController: PCViewController { func showManageDownloadsBanner() { guard FeatureFlag.manageDownloadedEpisodes.enabled, - DownloadsManageModel.shouldShowBanner + ManageDownloadsBannerModel.shouldShowBanner else { downloadsTable.tableHeaderView = nil return @@ -151,7 +151,7 @@ class DownloadsViewController: PCViewController { } lazy var bannerView: UIView = { - let banner = DownloadsManageBannerView(dataModel: DownloadsManageModel(initialSize: "", onManageTap: { [weak self] in + let banner = ManageDownloadsBannerView(dataModel: ManageDownloadsBannerModel(initialSize: "", onManageTap: { [weak self] in Analytics.track(.freeUpSpaceManageDownloadsTapped) self?.navigationController?.pushViewController(DownloadedFilesViewController(), animated: true) })).themedUIView diff --git a/podcasts/DownloadsManageBannerView.swift b/podcasts/ManageDownloadsBannerView.swift similarity index 90% rename from podcasts/DownloadsManageBannerView.swift rename to podcasts/ManageDownloadsBannerView.swift index 28e47d70f..156054e9b 100644 --- a/podcasts/DownloadsManageBannerView.swift +++ b/podcasts/ManageDownloadsBannerView.swift @@ -2,7 +2,7 @@ import SwiftUI import PocketCastsUtils import Combine -class DownloadsManageModel: ObservableObject { +class ManageDownloadsBannerModel: ObservableObject { @Published var sizeOccupied: String = "" @@ -35,11 +35,11 @@ class DownloadsManageModel: ObservableObject { } } -struct DownloadsManageBannerView: View { +struct ManageDownloadsBannerView: View { @EnvironmentObject var theme: Theme - @ObservedObject var dataModel: DownloadsManageModel + @ObservedObject var dataModel: ManageDownloadsBannerModel var body: some View { HStack(alignment: .top) { @@ -77,14 +77,14 @@ struct DownloadsManageBannerView: View { } #Preview("Light") { - DownloadsManageBannerView(dataModel: .init(initialSize: "100 MB")) + ManageDownloadsBannerView(dataModel: .init(initialSize: "100 MB")) .environmentObject(Theme(previewTheme: .light)) .padding(16) .frame(height: 132) } #Preview("Dark") { - DownloadsManageBannerView(dataModel: .init(initialSize: "100 MB")) + ManageDownloadsBannerView(dataModel: .init(initialSize: "100 MB")) .environmentObject(Theme(previewTheme: .dark)) .padding(16) .frame(height: 132)