Renaming
This commit is contained in:
parent
bdd2ee9a9d
commit
dd2f70a3f8
|
@ -112,8 +112,8 @@ extension NotificationTypesPreferencesViewModel {
|
||||||
static let development = NotificationTypesPreferencesViewModel(identityService: .development)
|
static let development = NotificationTypesPreferencesViewModel(identityService: .development)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension StatusesViewModel {
|
extension StatusListViewModel {
|
||||||
static let development = StatusesViewModel(statusListService: IdentityService.development.service(timeline: .home))
|
static let development = StatusListViewModel(statusListService: IdentityService.development.service(timeline: .home))
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:enable force_try
|
// swiftlint:enable force_try
|
||||||
|
|
|
@ -161,8 +161,8 @@
|
||||||
D0BEC93924C9632800E864C4 /* RootViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93724C9632800E864C4 /* RootViewModel.swift */; };
|
D0BEC93924C9632800E864C4 /* RootViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93724C9632800E864C4 /* RootViewModel.swift */; };
|
||||||
D0BEC93B24C96FD500E864C4 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93A24C96FD500E864C4 /* RootView.swift */; };
|
D0BEC93B24C96FD500E864C4 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC93A24C96FD500E864C4 /* RootView.swift */; };
|
||||||
D0BEC93C24C96FD500E864C4 /* 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 */; };
|
D0BEC94724CA22C400E864C4 /* StatusListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */; };
|
||||||
D0BEC94824CA22C400E864C4 /* StatusesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */; };
|
D0BEC94824CA22C400E864C4 /* StatusListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */; };
|
||||||
D0C963FB24CC359D003BD330 /* AlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C963FA24CC359D003BD330 /* AlertItem.swift */; };
|
D0C963FB24CC359D003BD330 /* AlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C963FA24CC359D003BD330 /* AlertItem.swift */; };
|
||||||
D0C963FC24CC359D003BD330 /* 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 */; };
|
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 = "<group>"; };
|
D0B23F0C24D210E90066F411 /* NSError+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSError+Extensions.swift"; sourceTree = "<group>"; };
|
||||||
D0BEC93724C9632800E864C4 /* RootViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewModel.swift; sourceTree = "<group>"; };
|
D0BEC93724C9632800E864C4 /* RootViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewModel.swift; sourceTree = "<group>"; };
|
||||||
D0BEC93A24C96FD500E864C4 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
|
D0BEC93A24C96FD500E864C4 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
|
||||||
D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusesViewModel.swift; sourceTree = "<group>"; };
|
D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusListViewModel.swift; sourceTree = "<group>"; };
|
||||||
D0C963FA24CC359D003BD330 /* AlertItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertItem.swift; sourceTree = "<group>"; };
|
D0C963FA24CC359D003BD330 /* AlertItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertItem.swift; sourceTree = "<group>"; };
|
||||||
D0C963FD24CC3812003BD330 /* Publisher+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extensions.swift"; sourceTree = "<group>"; };
|
D0C963FD24CC3812003BD330 /* Publisher+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extensions.swift"; sourceTree = "<group>"; };
|
||||||
D0CD847224DBDEC700CF380C /* MastodonPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonPreferences.swift; sourceTree = "<group>"; };
|
D0CD847224DBDEC700CF380C /* MastodonPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonPreferences.swift; sourceTree = "<group>"; };
|
||||||
|
@ -729,7 +729,7 @@
|
||||||
D0091B6A24DC10CE0040E8D2 /* PostingReadingPreferencesViewModel.swift */,
|
D0091B6A24DC10CE0040E8D2 /* PostingReadingPreferencesViewModel.swift */,
|
||||||
D0091B7024DD68220040E8D2 /* PreferencesViewModel.swift */,
|
D0091B7024DD68220040E8D2 /* PreferencesViewModel.swift */,
|
||||||
D0BEC93724C9632800E864C4 /* RootViewModel.swift */,
|
D0BEC93724C9632800E864C4 /* RootViewModel.swift */,
|
||||||
D0BEC94624CA22C400E864C4 /* StatusesViewModel.swift */,
|
D0BEC94624CA22C400E864C4 /* StatusListViewModel.swift */,
|
||||||
D0A2453E24EF55D000B07068 /* StatusViewModel.swift */,
|
D0A2453E24EF55D000B07068 /* StatusViewModel.swift */,
|
||||||
);
|
);
|
||||||
path = "View Models";
|
path = "View Models";
|
||||||
|
@ -1060,7 +1060,7 @@
|
||||||
D0ED1BD724CF94B200B4899C /* Application.swift in Sources */,
|
D0ED1BD724CF94B200B4899C /* Application.swift in Sources */,
|
||||||
D047FAAE24C3E21200AF17C5 /* MetatextApp.swift in Sources */,
|
D047FAAE24C3E21200AF17C5 /* MetatextApp.swift in Sources */,
|
||||||
D03658D124EDD80900AC17EC /* ContextEndpoint+Stubbing.swift in Sources */,
|
D03658D124EDD80900AC17EC /* ContextEndpoint+Stubbing.swift in Sources */,
|
||||||
D0BEC94724CA22C400E864C4 /* StatusesViewModel.swift in Sources */,
|
D0BEC94724CA22C400E864C4 /* StatusListViewModel.swift in Sources */,
|
||||||
D0666A4E24C6C39600F3F04B /* Instance.swift in Sources */,
|
D0666A4E24C6C39600F3F04B /* Instance.swift in Sources */,
|
||||||
D057426724E9FE1D00839EBA /* ContentDatabase.swift in Sources */,
|
D057426724E9FE1D00839EBA /* ContentDatabase.swift in Sources */,
|
||||||
D02D86E424EF9848004583CC /* TouchFallthroughTextView.swift in Sources */,
|
D02D86E424EF9848004583CC /* TouchFallthroughTextView.swift in Sources */,
|
||||||
|
@ -1174,7 +1174,7 @@
|
||||||
D0CD847424DBDEC700CF380C /* MastodonPreferences.swift in Sources */,
|
D0CD847424DBDEC700CF380C /* MastodonPreferences.swift in Sources */,
|
||||||
D0ED1BD824CF94B200B4899C /* Application.swift in Sources */,
|
D0ED1BD824CF94B200B4899C /* Application.swift in Sources */,
|
||||||
D047FAAF24C3E21200AF17C5 /* MetatextApp.swift in Sources */,
|
D047FAAF24C3E21200AF17C5 /* MetatextApp.swift in Sources */,
|
||||||
D0BEC94824CA22C400E864C4 /* StatusesViewModel.swift in Sources */,
|
D0BEC94824CA22C400E864C4 /* StatusListViewModel.swift in Sources */,
|
||||||
D02D86ED24EF9CA3004583CC /* CodingUserInfoKey+Extensions.swift in Sources */,
|
D02D86ED24EF9CA3004583CC /* CodingUserInfoKey+Extensions.swift in Sources */,
|
||||||
D0159FA624DE98F600E78478 /* NSMutableAttributedString+Extensions.swift in Sources */,
|
D0159FA624DE98F600E78478 /* NSMutableAttributedString+Extensions.swift in Sources */,
|
||||||
D0EC8DC324DF7D9C00A08489 /* IdentityService.swift in Sources */,
|
D0EC8DC324DF7D9C00A08489 /* IdentityService.swift in Sources */,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
class StatusesViewModel: ObservableObject {
|
class StatusListViewModel: ObservableObject {
|
||||||
@Published private(set) var statusIDs = [[String]]()
|
@Published private(set) var statusIDs = [[String]]()
|
||||||
@Published var alertItem: AlertItem?
|
@Published var alertItem: AlertItem?
|
||||||
@Published private(set) var loading = false
|
@Published private(set) var loading = false
|
||||||
|
@ -28,7 +28,7 @@ class StatusesViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension StatusesViewModel {
|
extension StatusListViewModel {
|
||||||
var contextParentID: String? { statusListService.contextParentID }
|
var contextParentID: String? { statusListService.contextParentID }
|
||||||
|
|
||||||
func request(maxID: String? = nil, minID: String? = nil) {
|
func request(maxID: String? = nil, minID: String? = nil) {
|
||||||
|
@ -64,14 +64,14 @@ extension StatusesViewModel {
|
||||||
return statusViewModel
|
return statusViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
func contextViewModel(id: String) -> StatusesViewModel? {
|
func contextViewModel(id: String) -> StatusListViewModel? {
|
||||||
guard let status = statuses[id] else { return nil }
|
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]]) {
|
func determineIfScrollPositionShouldBeMaintained(newStatusSections: [[Status]]) {
|
||||||
maintainScrollPositionOfStatusID = nil // clear old value
|
maintainScrollPositionOfStatusID = nil // clear old value
|
||||||
|
|
|
@ -4,7 +4,7 @@ import SwiftUI
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
class StatusListViewController: UITableViewController {
|
class StatusListViewController: UITableViewController {
|
||||||
private let viewModel: StatusesViewModel
|
private let viewModel: StatusListViewModel
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
private var cellHeightCaches = [CGFloat: [String: CGFloat]]()
|
private var cellHeightCaches = [CGFloat: [String: CGFloat]]()
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class StatusListViewController: UITableViewController {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
init(viewModel: StatusesViewModel) {
|
init(viewModel: StatusListViewModel) {
|
||||||
self.viewModel = viewModel
|
self.viewModel = viewModel
|
||||||
|
|
||||||
super.init(style: .plain)
|
super.init(style: .plain)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import Combine
|
||||||
class TabNavigationViewModel: ObservableObject {
|
class TabNavigationViewModel: ObservableObject {
|
||||||
@Published private(set) var identity: Identity
|
@Published private(set) var identity: Identity
|
||||||
@Published private(set) var recentIdentities = [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 presentingSecondaryNavigation = false
|
||||||
@Published var alertItem: AlertItem?
|
@Published var alertItem: AlertItem?
|
||||||
var selectedTab: Tab? = .timelines
|
var selectedTab: Tab? = .timelines
|
||||||
|
@ -17,7 +17,7 @@ class TabNavigationViewModel: ObservableObject {
|
||||||
init(identityService: IdentityService) {
|
init(identityService: IdentityService) {
|
||||||
self.identityService = identityService
|
self.identityService = identityService
|
||||||
identity = identityService.identity
|
identity = identityService.identity
|
||||||
timelineViewModel = StatusesViewModel(statusListService: identityService.service(timeline: .home))
|
timelineViewModel = StatusListViewModel(statusListService: identityService.service(timeline: .home))
|
||||||
identityService.$identity.dropFirst().assign(to: &$identity)
|
identityService.$identity.dropFirst().assign(to: &$identity)
|
||||||
|
|
||||||
identityService.recentIdentitiesObservation()
|
identityService.recentIdentitiesObservation()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct StatusListView: UIViewControllerRepresentable {
|
struct StatusListView: UIViewControllerRepresentable {
|
||||||
let viewModel: StatusesViewModel
|
let viewModel: StatusListViewModel
|
||||||
|
|
||||||
func makeUIViewController(context: Context) -> StatusListViewController {
|
func makeUIViewController(context: Context) -> StatusListViewController {
|
||||||
StatusListViewController(viewModel: viewModel)
|
StatusListViewController(viewModel: viewModel)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Combine
|
||||||
|
|
||||||
class SidebarNavigationViewModel: ObservableObject {
|
class SidebarNavigationViewModel: ObservableObject {
|
||||||
@Published private(set) var identity: Identity
|
@Published private(set) var identity: Identity
|
||||||
@Published private(set) var timelineViewModel: StatusesViewModel
|
@Published private(set) var timelineViewModel: StatusListViewModel
|
||||||
@Published var alertItem: AlertItem?
|
@Published var alertItem: AlertItem?
|
||||||
var selectedTab: Tab? = .timelines
|
var selectedTab: Tab? = .timelines
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class SidebarNavigationViewModel: ObservableObject {
|
||||||
init(identityService: IdentityService) {
|
init(identityService: IdentityService) {
|
||||||
self.identityService = identityService
|
self.identityService = identityService
|
||||||
identity = identityService.identity
|
identity = identityService.identity
|
||||||
timelineViewModel = StatusesViewModel(statusListService: identityService.service(timeline: .home))
|
timelineViewModel = StatusListViewModel(statusListService: identityService.service(timeline: .home))
|
||||||
identityService.$identity.dropFirst().assign(to: &$identity)
|
identityService.$identity.dropFirst().assign(to: &$identity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue