Renaming
This commit is contained in:
parent
182ecb5b91
commit
a729058add
|
@ -5,7 +5,7 @@ import Foundation
|
||||||
import Mastodon
|
import Mastodon
|
||||||
import ServiceLayer
|
import ServiceLayer
|
||||||
|
|
||||||
public final class TabNavigationViewModel: ObservableObject {
|
public final class NavigationViewModel: ObservableObject {
|
||||||
public let identification: Identification
|
public let identification: Identification
|
||||||
@Published public private(set) var recentIdentities = [Identity]()
|
@Published public private(set) var recentIdentities = [Identity]()
|
||||||
@Published public var timeline: Timeline
|
@Published public var timeline: Timeline
|
||||||
|
@ -40,7 +40,7 @@ public final class TabNavigationViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension TabNavigationViewModel {
|
public extension NavigationViewModel {
|
||||||
var tabs: [Tab] {
|
var tabs: [Tab] {
|
||||||
if identification.service.isAuthorized {
|
if identification.service.isAuthorized {
|
||||||
return Tab.allCases
|
return Tab.allCases
|
||||||
|
@ -92,7 +92,7 @@ public extension TabNavigationViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension TabNavigationViewModel {
|
public extension NavigationViewModel {
|
||||||
enum Tab: CaseIterable {
|
enum Tab: CaseIterable {
|
||||||
case timelines
|
case timelines
|
||||||
case explore
|
case explore
|
||||||
|
@ -101,6 +101,6 @@ public extension TabNavigationViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TabNavigationViewModel.Tab: Identifiable {
|
extension NavigationViewModel.Tab: Identifiable {
|
||||||
public var id: Self { self }
|
public var id: Self { self }
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ import Foundation
|
||||||
import ServiceLayer
|
import ServiceLayer
|
||||||
|
|
||||||
public final class RootViewModel: ObservableObject {
|
public final class RootViewModel: ObservableObject {
|
||||||
@Published public private(set) var navigationViewModel: TabNavigationViewModel?
|
@Published public private(set) var navigationViewModel: NavigationViewModel?
|
||||||
|
|
||||||
@Published private var mostRecentlyUsedIdentityID: UUID?
|
@Published private var mostRecentlyUsedIdentityID: UUID?
|
||||||
private let environment: AppEnvironment
|
private let environment: AppEnvironment
|
||||||
|
@ -100,7 +100,7 @@ private extension RootViewModel {
|
||||||
.store(in: &self.cancellables)
|
.store(in: &self.cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
return TabNavigationViewModel(identification: identification)
|
return NavigationViewModel(identification: identification)
|
||||||
}
|
}
|
||||||
.assign(to: &$navigationViewModel)
|
.assign(to: &$navigationViewModel)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ import PreviewViewModels
|
||||||
struct ListsView_Previews: PreviewProvider {
|
struct ListsView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ListsView(viewModel: .init(identification: .preview))
|
ListsView(viewModel: .init(identification: .preview))
|
||||||
.environmentObject(TabNavigationViewModel(identification: .preview))
|
.environmentObject(NavigationViewModel(identification: .preview))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@ import SwiftUI
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
struct SecondaryNavigationView: View {
|
struct SecondaryNavigationView: View {
|
||||||
@ObservedObject var viewModel: TabNavigationViewModel
|
@ObservedObject var viewModel: NavigationViewModel
|
||||||
@EnvironmentObject var identification: Identification
|
@EnvironmentObject var identification: Identification
|
||||||
@EnvironmentObject var rootViewModel: RootViewModel
|
@EnvironmentObject var rootViewModel: RootViewModel
|
||||||
@Environment(\.displayScale) var displayScale: CGFloat
|
@Environment(\.displayScale) var displayScale: CGFloat
|
||||||
|
@ -85,7 +85,7 @@ import PreviewViewModels
|
||||||
|
|
||||||
struct SecondaryNavigationView_Previews: PreviewProvider {
|
struct SecondaryNavigationView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
SecondaryNavigationView(viewModel: TabNavigationViewModel(identification: .preview))
|
SecondaryNavigationView(viewModel: NavigationViewModel(identification: .preview))
|
||||||
.environmentObject(Identification.preview)
|
.environmentObject(Identification.preview)
|
||||||
.environmentObject(RootViewModel.preview)
|
.environmentObject(RootViewModel.preview)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import PreviewViewModels
|
||||||
|
|
||||||
struct StatusListView_Previews: PreviewProvider {
|
struct StatusListView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
StatusListView(viewModel: TabNavigationViewModel(identification: .preview).viewModel(timeline: .home))
|
StatusListView(viewModel: NavigationViewModel(identification: .preview).viewModel(timeline: .home))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@ import SwiftUI
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
struct TabNavigationView: View {
|
struct TabNavigationView: View {
|
||||||
@ObservedObject var viewModel: TabNavigationViewModel
|
@ObservedObject var viewModel: NavigationViewModel
|
||||||
@EnvironmentObject var rootViewModel: RootViewModel
|
@EnvironmentObject var rootViewModel: RootViewModel
|
||||||
@Environment(\.displayScale) var displayScale: CGFloat
|
@Environment(\.displayScale) var displayScale: CGFloat
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ struct TabNavigationView: View {
|
||||||
|
|
||||||
private extension TabNavigationView {
|
private extension TabNavigationView {
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func view(tab: TabNavigationViewModel.Tab) -> some View {
|
func view(tab: NavigationViewModel.Tab) -> some View {
|
||||||
switch tab {
|
switch tab {
|
||||||
case .timelines:
|
case .timelines:
|
||||||
StatusListView(viewModel: viewModel.viewModel(timeline: viewModel.timeline))
|
StatusListView(viewModel: viewModel.viewModel(timeline: viewModel.timeline))
|
||||||
|
@ -133,7 +133,7 @@ private extension Timeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TabNavigationViewModel.Tab {
|
extension NavigationViewModel.Tab {
|
||||||
var title: String {
|
var title: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .timelines: return "Timelines"
|
case .timelines: return "Timelines"
|
||||||
|
@ -158,7 +158,7 @@ import PreviewViewModels
|
||||||
|
|
||||||
struct TabNavigation_Previews: PreviewProvider {
|
struct TabNavigation_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
TabNavigationView(viewModel: TabNavigationViewModel(identification: .preview))
|
TabNavigationView(viewModel: NavigationViewModel(identification: .preview))
|
||||||
.environmentObject(Identification.preview)
|
.environmentObject(Identification.preview)
|
||||||
.environmentObject(RootViewModel.preview)
|
.environmentObject(RootViewModel.preview)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue