Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Application/DevLogPresentation/Sources/Main/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,11 @@ struct MainView: View {
TodoDetailView(store: profileViewCoordinator.makeTodoDetailStore(todoId: todoId))
.id(todoId)
case .settings:
SettingsView(viewModel: profileViewCoordinator.settingsViewModel)
SettingsView(store: profileViewCoordinator.settingsStore)
.environment(profileViewCoordinator.router)
case .theme:
ThemeView(
theme: Binding(
get: { profileViewCoordinator.settingsViewModel.state.theme },
set: { profileViewCoordinator.settingsViewModel.send(.setTheme($0)) }
)
)
@Bindable var settingsStore = profileViewCoordinator.settingsStore
ThemeView(theme: $settingsStore.theme)
case .pushNotification:
PushNotificationSettingsView(
store: profileViewCoordinator.makePushNotificationSettingsStore()
Expand Down
10 changes: 3 additions & 7 deletions Application/DevLogPresentation/Sources/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,13 @@ struct ProfileView: View {
private func profileDestinationView(_ route: ProfileRoute) -> some View {
switch route {
case .settings:
SettingsView(viewModel: coordinator.settingsViewModel)
SettingsView(store: coordinator.settingsStore)
.environment(coordinator.router)
case .activity(let todoId):
TodoDetailView(store: coordinator.makeTodoDetailStore(todoId: todoId))
case .theme:
ThemeView(
theme: Binding(
get: { coordinator.settingsViewModel.state.theme },
set: { coordinator.settingsViewModel.send(.setTheme($0)) }
)
)
@Bindable var settingsStore = coordinator.settingsStore
ThemeView(theme: $settingsStore.theme)
case .pushNotification:
PushNotificationSettingsView(store: coordinator.makePushNotificationSettingsStore())
case .account:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import DevLogDomain
@Observable
final class ProfileViewCoordinator {
let viewModel: ProfileViewModel
let settingsViewModel: SettingsViewModel
let settingsStore: StoreOf<SettingsFeature>
var router = NavigationRouter<ProfileRoute>()
private let container: DIContainer

Expand All @@ -29,15 +29,18 @@ final class ProfileViewCoordinator {
fetchHeatmapActivityTypesUseCase: container.resolve(FetchHeatmapActivityTypesUseCase.self),
updateHeatmapActivityTypesUseCase: container.resolve(UpdateHeatmapActivityTypesUseCase.self)
)
self.settingsViewModel = SettingsViewModel(
deleteAuthUseCase: container.resolve(DeleteAuthUseCase.self),
signOutUseCase: container.resolve(SignOutUseCase.self),
networkConnectivityUseCase: container.resolve(ObserveNetworkConnectivityUseCase.self),
systemThemeUseCase: container.resolve(ObserveSystemThemeUseCase.self),
updateSystemThemeUseCase: container.resolve(UpdateSystemThemeUseCase.self),
fetchWebPageImageDirSizeUseCase: container.resolve(FetchWebPageImageDirSizeUseCase.self),
clearWebPageImageDirectoryUseCase: container.resolve(ClearWebPageImageDirectoryUseCase.self)
)
self.settingsStore = Store(initialState: SettingsFeature.State()) {
SettingsFeature()
} withDependencies: {
$0.deleteAuthUseCase = container.resolve(DeleteAuthUseCase.self)
$0.signOutUseCase = container.resolve(SignOutUseCase.self)
$0.networkConnectivityUseCase = container.resolve(ObserveNetworkConnectivityUseCase.self)
$0.systemThemeUseCase = container.resolve(ObserveSystemThemeUseCase.self)
$0.updateSystemThemeUseCase = container.resolve(UpdateSystemThemeUseCase.self)
$0.fetchWebPageImageDirSizeUseCase = container.resolve(FetchWebPageImageDirSizeUseCase.self)
$0.clearWebPageImageDirectoryUseCase = container.resolve(ClearWebPageImageDirectoryUseCase.self)
}
self.settingsStore.send(.startObserving)
Comment thread
opficdev marked this conversation as resolved.
}

func fetchData() {
Expand Down
Loading