Cleanup
This commit is contained in:
parent
e30f526a15
commit
47c7d4c164
|
@ -92,20 +92,16 @@ extension AppEnvironment {
|
|||
webAuthSessionType: SuccessfulStubbingWebAuthSession.self)
|
||||
}
|
||||
|
||||
extension IdentityRepository {
|
||||
static let development = try! IdentityRepository(identityID: devIdentityID, appEnvironment: .development)
|
||||
}
|
||||
|
||||
extension RootViewModel {
|
||||
static let development = RootViewModel(environment: .development)
|
||||
}
|
||||
|
||||
extension MainNavigationViewModel {
|
||||
static let development = MainNavigationViewModel(identityRepository: .development)
|
||||
static let development = RootViewModel.development.mainNavigationViewModel(identityID: devIdentityID)!
|
||||
}
|
||||
|
||||
extension SecondaryNavigationViewModel {
|
||||
static let development = MainNavigationViewModel.development.settingsViewModel()
|
||||
static let development = MainNavigationViewModel.development.secondaryNavigationViewModel()
|
||||
}
|
||||
|
||||
extension IdentitiesViewModel {
|
||||
|
|
|
@ -6,7 +6,7 @@ import Combine
|
|||
class MainNavigationViewModel: ObservableObject {
|
||||
@Published private(set) var identity: Identity
|
||||
@Published private(set) var recentIdentities = [Identity]()
|
||||
@Published var presentingSettings = false
|
||||
@Published var presentingSecondaryNavigation = false
|
||||
@Published var alertItem: AlertItem?
|
||||
var selectedTab: Tab? = .timelines
|
||||
|
||||
|
@ -46,7 +46,7 @@ extension MainNavigationViewModel {
|
|||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func settingsViewModel() -> SecondaryNavigationViewModel {
|
||||
func secondaryNavigationViewModel() -> SecondaryNavigationViewModel {
|
||||
SecondaryNavigationViewModel(identityRepository: identityRepository)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ struct TabNavigation: View {
|
|||
.tag(tab)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $viewModel.presentingSettings) {
|
||||
SecondaryNavigationView(viewModel: viewModel.settingsViewModel())
|
||||
.sheet(isPresented: $viewModel.presentingSecondaryNavigation) {
|
||||
SecondaryNavigationView(viewModel: viewModel.secondaryNavigationViewModel())
|
||||
.environmentObject(rootViewModel)
|
||||
}
|
||||
.alertItem($viewModel.alertItem)
|
||||
|
@ -44,7 +44,7 @@ private extension TabNavigation {
|
|||
.navigationBarTitle(viewModel.identity.handle, displayMode: .inline)
|
||||
.navigationBarItems(
|
||||
leading: Button {
|
||||
viewModel.presentingSettings.toggle()
|
||||
viewModel.presentingSecondaryNavigation.toggle()
|
||||
} label: {
|
||||
KFImage(viewModel.identity.image,
|
||||
options: .downsampled(dimension: 28, scaleFactor: displayScale))
|
||||
|
|
|
@ -61,7 +61,7 @@ private extension SidebarNavigation {
|
|||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
Divider()
|
||||
Button(action: { viewModel.presentingSettings.toggle() }) {
|
||||
Button(action: { viewModel.presentingSecondaryNavigation.toggle() }) {
|
||||
KFImage(viewModel.identity.image,
|
||||
options: .downsampled(dimension: 28, scaleFactor: displayScale))
|
||||
.placeholder { Image(systemName: "gear") }
|
||||
|
@ -76,8 +76,8 @@ private extension SidebarNavigation {
|
|||
.padding(.horizontal, 16)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
.sheet(isPresented: $viewModel.presentingSettings) {
|
||||
SecondaryNavigationView(viewModel: viewModel.settingsViewModel())
|
||||
.sheet(isPresented: $viewModel.presentingSecondaryNavigation) {
|
||||
SecondaryNavigationView(viewModel: viewModel.secondaryNavigationViewModel())
|
||||
.environmentObject(viewModel)
|
||||
.environmentObject(rootViewModel)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue