From dd2f70a3f8e7235b59ccbbc29e2cb37cebf6f34d Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Wed, 26 Aug 2020 14:20:44 -0700 Subject: [PATCH] Renaming --- Development Assets/DevelopmentModels.swift | 4 ++-- Metatext.xcodeproj/project.pbxproj | 12 ++++++------ ...usesViewModel.swift => StatusListViewModel.swift} | 10 +++++----- iOS/View Controllers/StatusListViewController.swift | 4 ++-- iOS/View Models/TabNavigationViewModel.swift | 4 ++-- iOS/Views/StatusListView.swift | 2 +- macOS/View Models/SidebarNavigationViewModel.swift | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) rename Shared/View Models/{StatusesViewModel.swift => StatusListViewModel.swift} (92%) diff --git a/Development Assets/DevelopmentModels.swift b/Development Assets/DevelopmentModels.swift index e578d20..52eaf94 100644 --- a/Development Assets/DevelopmentModels.swift +++ b/Development Assets/DevelopmentModels.swift @@ -112,8 +112,8 @@ extension NotificationTypesPreferencesViewModel { static let development = NotificationTypesPreferencesViewModel(identityService: .development) } -extension StatusesViewModel { - static let development = StatusesViewModel(statusListService: IdentityService.development.service(timeline: .home)) +extension StatusListViewModel { + static let development = StatusListViewModel(statusListService: IdentityService.development.service(timeline: .home)) } // swiftlint:enable force_try diff --git a/Metatext.xcodeproj/project.pbxproj b/Metatext.xcodeproj/project.pbxproj index 61a935b..e9434e3 100644 --- a/Metatext.xcodeproj/project.pbxproj +++ b/Metatext.xcodeproj/project.pbxproj @@ -161,8 +161,8 @@ D0BEC93924C9632800E864C4 /* RootViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93724C9632800E864C4 /* RootViewModel.swift */; }; D0BEC93B24C96FD500E864C4 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93A24C96FD500E864C4 /* RootView.swift */; }; D0BEC93C24C96FD500E864C4 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93A24C96FD500E864C4 /* RootView.swift */; }; - D0BEC94724CA22C400E864C4 /* StatusesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */; }; - D0BEC94824CA22C400E864C4 /* StatusesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */; }; + D0BEC94724CA22C400E864C4 /* StatusListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */; }; + D0BEC94824CA22C400E864C4 /* StatusListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */; }; D0C963FB24CC359D003BD330 /* AlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C963FA24CC359D003BD330 /* AlertItem.swift */; }; D0C963FC24CC359D003BD330 /* AlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C963FA24CC359D003BD330 /* AlertItem.swift */; }; D0C963FE24CC3812003BD330 /* Publisher+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C963FD24CC3812003BD330 /* Publisher+Extensions.swift */; }; @@ -369,7 +369,7 @@ D0B23F0C24D210E90066F411 /* NSError+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSError+Extensions.swift"; sourceTree = ""; }; D0BEC93724C9632800E864C4 /* RootViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewModel.swift; sourceTree = ""; }; D0BEC93A24C96FD500E864C4 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = ""; }; - D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusesViewModel.swift; sourceTree = ""; }; + D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusListViewModel.swift; sourceTree = ""; }; D0C963FA24CC359D003BD330 /* AlertItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertItem.swift; sourceTree = ""; }; D0C963FD24CC3812003BD330 /* Publisher+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extensions.swift"; sourceTree = ""; }; D0CD847224DBDEC700CF380C /* MastodonPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonPreferences.swift; sourceTree = ""; }; @@ -729,7 +729,7 @@ D0091B6A24DC10CE0040E8D2 /* PostingReadingPreferencesViewModel.swift */, D0091B7024DD68220040E8D2 /* PreferencesViewModel.swift */, D0BEC93724C9632800E864C4 /* RootViewModel.swift */, - D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */, + D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */, D0A2453E24EF55D000B07068 /* StatusViewModel.swift */, ); path = "View Models"; @@ -1060,7 +1060,7 @@ D0ED1BD724CF94B200B4899C /* Application.swift in Sources */, D047FAAE24C3E21200AF17C5 /* MetatextApp.swift in Sources */, D03658D124EDD80900AC17EC /* ContextEndpoint+Stubbing.swift in Sources */, - D0BEC94724CA22C400E864C4 /* StatusesViewModel.swift in Sources */, + D0BEC94724CA22C400E864C4 /* StatusListViewModel.swift in Sources */, D0666A4E24C6C39600F3F04B /* Instance.swift in Sources */, D057426724E9FE1D00839EBA /* ContentDatabase.swift in Sources */, D02D86E424EF9848004583CC /* TouchFallthroughTextView.swift in Sources */, @@ -1174,7 +1174,7 @@ D0CD847424DBDEC700CF380C /* MastodonPreferences.swift in Sources */, D0ED1BD824CF94B200B4899C /* Application.swift in Sources */, D047FAAF24C3E21200AF17C5 /* MetatextApp.swift in Sources */, - D0BEC94824CA22C400E864C4 /* StatusesViewModel.swift in Sources */, + D0BEC94824CA22C400E864C4 /* StatusListViewModel.swift in Sources */, D02D86ED24EF9CA3004583CC /* CodingUserInfoKey+Extensions.swift in Sources */, D0159FA624DE98F600E78478 /* NSMutableAttributedString+Extensions.swift in Sources */, D0EC8DC324DF7D9C00A08489 /* IdentityService.swift in Sources */, diff --git a/Shared/View Models/StatusesViewModel.swift b/Shared/View Models/StatusListViewModel.swift similarity index 92% rename from Shared/View Models/StatusesViewModel.swift rename to Shared/View Models/StatusListViewModel.swift index 81c9e07..e9fa389 100644 --- a/Shared/View Models/StatusesViewModel.swift +++ b/Shared/View Models/StatusListViewModel.swift @@ -3,7 +3,7 @@ import Foundation import Combine -class StatusesViewModel: ObservableObject { +class StatusListViewModel: ObservableObject { @Published private(set) var statusIDs = [[String]]() @Published var alertItem: AlertItem? @Published private(set) var loading = false @@ -28,7 +28,7 @@ class StatusesViewModel: ObservableObject { } } -extension StatusesViewModel { +extension StatusListViewModel { var contextParentID: String? { statusListService.contextParentID } func request(maxID: String? = nil, minID: String? = nil) { @@ -64,14 +64,14 @@ extension StatusesViewModel { return statusViewModel } - func contextViewModel(id: String) -> StatusesViewModel? { + func contextViewModel(id: String) -> StatusListViewModel? { guard let status = statuses[id] else { return nil } - return StatusesViewModel(statusListService: statusListService.contextService(status: status)) + return StatusListViewModel(statusListService: statusListService.contextService(status: status)) } } -private extension StatusesViewModel { +private extension StatusListViewModel { func determineIfScrollPositionShouldBeMaintained(newStatusSections: [[Status]]) { maintainScrollPositionOfStatusID = nil // clear old value diff --git a/iOS/View Controllers/StatusListViewController.swift b/iOS/View Controllers/StatusListViewController.swift index 7a9e20d..600b56b 100644 --- a/iOS/View Controllers/StatusListViewController.swift +++ b/iOS/View Controllers/StatusListViewController.swift @@ -4,7 +4,7 @@ import SwiftUI import Combine class StatusListViewController: UITableViewController { - private let viewModel: StatusesViewModel + private let viewModel: StatusListViewModel private var cancellables = Set() private var cellHeightCaches = [CGFloat: [String: CGFloat]]() @@ -24,7 +24,7 @@ class StatusListViewController: UITableViewController { } }() - init(viewModel: StatusesViewModel) { + init(viewModel: StatusListViewModel) { self.viewModel = viewModel super.init(style: .plain) diff --git a/iOS/View Models/TabNavigationViewModel.swift b/iOS/View Models/TabNavigationViewModel.swift index a93b4e2..c6f3842 100644 --- a/iOS/View Models/TabNavigationViewModel.swift +++ b/iOS/View Models/TabNavigationViewModel.swift @@ -6,7 +6,7 @@ import Combine class TabNavigationViewModel: ObservableObject { @Published private(set) var identity: Identity @Published private(set) var recentIdentities = [Identity]() - @Published private(set) var timelineViewModel: StatusesViewModel + @Published private(set) var timelineViewModel: StatusListViewModel @Published var presentingSecondaryNavigation = false @Published var alertItem: AlertItem? var selectedTab: Tab? = .timelines @@ -17,7 +17,7 @@ class TabNavigationViewModel: ObservableObject { init(identityService: IdentityService) { self.identityService = identityService identity = identityService.identity - timelineViewModel = StatusesViewModel(statusListService: identityService.service(timeline: .home)) + timelineViewModel = StatusListViewModel(statusListService: identityService.service(timeline: .home)) identityService.$identity.dropFirst().assign(to: &$identity) identityService.recentIdentitiesObservation() diff --git a/iOS/Views/StatusListView.swift b/iOS/Views/StatusListView.swift index b9b2e96..0251b81 100644 --- a/iOS/Views/StatusListView.swift +++ b/iOS/Views/StatusListView.swift @@ -3,7 +3,7 @@ import SwiftUI struct StatusListView: UIViewControllerRepresentable { - let viewModel: StatusesViewModel + let viewModel: StatusListViewModel func makeUIViewController(context: Context) -> StatusListViewController { StatusListViewController(viewModel: viewModel) diff --git a/macOS/View Models/SidebarNavigationViewModel.swift b/macOS/View Models/SidebarNavigationViewModel.swift index be6f045..c040e0e 100644 --- a/macOS/View Models/SidebarNavigationViewModel.swift +++ b/macOS/View Models/SidebarNavigationViewModel.swift @@ -5,7 +5,7 @@ import Combine class SidebarNavigationViewModel: ObservableObject { @Published private(set) var identity: Identity - @Published private(set) var timelineViewModel: StatusesViewModel + @Published private(set) var timelineViewModel: StatusListViewModel @Published var alertItem: AlertItem? var selectedTab: Tab? = .timelines @@ -15,7 +15,7 @@ class SidebarNavigationViewModel: ObservableObject { init(identityService: IdentityService) { self.identityService = identityService identity = identityService.identity - timelineViewModel = StatusesViewModel(statusListService: identityService.service(timeline: .home)) + timelineViewModel = StatusListViewModel(statusListService: identityService.service(timeline: .home)) identityService.$identity.dropFirst().assign(to: &$identity) } }