diff --git a/Application/DevLogPresentation/Sources/Home/HomeView.swift b/Application/DevLogPresentation/Sources/Home/Home/HomeView.swift similarity index 100% rename from Application/DevLogPresentation/Sources/Home/HomeView.swift rename to Application/DevLogPresentation/Sources/Home/Home/HomeView.swift diff --git a/Application/DevLogPresentation/Sources/Home/HomeViewCoordinator.swift b/Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift similarity index 100% rename from Application/DevLogPresentation/Sources/Home/HomeViewCoordinator.swift rename to Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/HomeViewModel.swift b/Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/HomeViewModel.swift rename to Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/TodoDetailViewModel.swift b/Application/DevLogPresentation/Sources/Home/TodoDetailViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/TodoDetailViewModel.swift rename to Application/DevLogPresentation/Sources/Home/TodoDetailViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/TodoEditorViewModel.swift b/Application/DevLogPresentation/Sources/Home/TodoEditorViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/TodoEditorViewModel.swift rename to Application/DevLogPresentation/Sources/Home/TodoEditorViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/TodoListViewModel.swift b/Application/DevLogPresentation/Sources/Home/TodoListViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/TodoListViewModel.swift rename to Application/DevLogPresentation/Sources/Home/TodoListViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/TodoManageViewModel.swift b/Application/DevLogPresentation/Sources/Home/TodoManageViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/TodoManageViewModel.swift rename to Application/DevLogPresentation/Sources/Home/TodoManageViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/LoginViewModel.swift b/Application/DevLogPresentation/Sources/Login/LoginViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/LoginViewModel.swift rename to Application/DevLogPresentation/Sources/Login/LoginViewModel.swift diff --git a/Application/DevLogPresentation/Sources/Main/MainView.swift b/Application/DevLogPresentation/Sources/Main/MainView.swift index 1b531d5b..ed8a86c0 100644 --- a/Application/DevLogPresentation/Sources/Main/MainView.swift +++ b/Application/DevLogPresentation/Sources/Main/MainView.swift @@ -14,6 +14,7 @@ struct MainView: View { @State private var coordinator: MainViewCoordinator @State private var homeViewCoordinator: HomeViewCoordinator @State private var todayViewCoordinator: TodayViewCoordinator + @State private var profileViewCoordinator: ProfileViewCoordinator @Binding var selectedTab: MainTab init( @@ -23,6 +24,7 @@ struct MainView: View { self._coordinator = State(initialValue: MainViewCoordinator(container: container)) self._homeViewCoordinator = State(initialValue: HomeViewCoordinator(container: container)) self._todayViewCoordinator = State(initialValue: TodayViewCoordinator(container: container)) + self._profileViewCoordinator = State(initialValue: ProfileViewCoordinator(container: container)) self._selectedTab = selectedTab } @@ -316,7 +318,7 @@ struct MainView: View { } private var profileView: some View { - ProfileView(viewModel: coordinator.profileViewModel) + ProfileView(coordinator: profileViewCoordinator) } } diff --git a/Application/DevLogPresentation/Sources/Main/MainViewCoordinator.swift b/Application/DevLogPresentation/Sources/Main/MainViewCoordinator.swift index 1d80bbf0..ce0565d9 100644 --- a/Application/DevLogPresentation/Sources/Main/MainViewCoordinator.swift +++ b/Application/DevLogPresentation/Sources/Main/MainViewCoordinator.swift @@ -14,7 +14,6 @@ import DevLogDomain final class MainViewCoordinator { let mainViewModel: MainViewModel let pushNotificationListViewModel: PushNotificationListViewModel - let profileViewModel: ProfileViewModel var todoIdToPresent: TodoIdItem? private let diContainer: DIContainer @ObservationIgnored @@ -35,14 +34,6 @@ final class MainViewCoordinator { fetchQueryUseCase: container.resolve(FetchPushNotificationQueryUseCase.self), updateQueryUseCase: container.resolve(UpdatePushNotificationQueryUseCase.self) ) - self.profileViewModel = ProfileViewModel( - fetchUserDataUseCase: container.resolve(FetchUserDataUseCase.self), - fetchTodosUseCase: container.resolve(FetchTodosUseCase.self), - upsertStatusMessageUseCase: container.resolve(UpsertStatusMessageUseCase.self), - networkConnectivityUseCase: container.resolve(ObserveNetworkConnectivityUseCase.self), - fetchHeatmapActivityTypesUseCase: container.resolve(FetchHeatmapActivityTypesUseCase.self), - updateHeatmapActivityTypesUseCase: container.resolve(UpdateHeatmapActivityTypesUseCase.self) - ) } func todoListViewModel(category: TodoCategory) -> TodoListViewModel { diff --git a/Application/DevLogPresentation/Sources/ViewModel/MainViewModel.swift b/Application/DevLogPresentation/Sources/Main/MainViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/MainViewModel.swift rename to Application/DevLogPresentation/Sources/Main/MainViewModel.swift diff --git a/Application/DevLogPresentation/Sources/Profile/ProfileView.swift b/Application/DevLogPresentation/Sources/Profile/ProfileView.swift index 142663fe..22c3cdeb 100644 --- a/Application/DevLogPresentation/Sources/Profile/ProfileView.swift +++ b/Application/DevLogPresentation/Sources/Profile/ProfileView.swift @@ -10,42 +10,42 @@ import DevLogCore import DevLogDomain struct ProfileView: View { - @State var viewModel: ProfileViewModel - @State private var router = NavigationRouter() - @Environment(\.diContainer) private var container + let coordinator: ProfileViewCoordinator @FocusState private var focused: Bool var body: some View { - NavigationStack(path: $router.path) { + NavigationStack(path: navigationPath) { ScrollView { LazyVStack(alignment: .leading, spacing: 16) { HStack { - CacheableImage(url: viewModel.state.avatarURL) { + CacheableImage(url: coordinator.viewModel.state.avatarURL) { Image(systemName: "person.crop.circle.fill") .resizable() .scaledToFill() .foregroundStyle(Color(.systemGray2)) } - .frame(width: 60, height: 60) - .cornerRadius(30) - .foregroundStyle(Color.gray) + .frame(width: 60, height: 60) + .cornerRadius(30) + .foregroundStyle(Color.gray) VStack(alignment: .leading) { - Text(viewModel.state.name) + Text(coordinator.viewModel.state.name) .font(.title2) .bold() - Text(viewModel.state.email) + Text(coordinator.viewModel.state.email) .font(.caption2) .foregroundStyle(Color.gray) } } - let connected = viewModel.state.isNetworkConnected + let connected = coordinator.viewModel.state.isNetworkConnected HStack { HStack { Image(systemName: "face.smiling") - TextField(text: Binding( - get: { viewModel.state.statusMessage }, - set: { viewModel.send(.updateStatusMessage($0)) }) + TextField( + text: Binding( + get: { coordinator.viewModel.state.statusMessage }, + set: { coordinator.viewModel.send(.updateStatusMessage($0)) } + ) ) { Text(String(localized: "profile_status_placeholder")) } @@ -53,9 +53,10 @@ struct ProfileView: View { .focused($focused) .disabled(!connected) - if !viewModel.state.statusMessage.isEmpty && viewModel.state.showDoneButton { + if !coordinator.viewModel.state.statusMessage.isEmpty, + coordinator.viewModel.state.showDoneButton { Button(action: { - viewModel.send(.tapResetStatusMessageButton) + coordinator.viewModel.send(.tapResetStatusMessageButton) }) { Image(systemName: "xmark.circle.fill") } @@ -68,10 +69,10 @@ struct ProfileView: View { RoundedRectangle(cornerRadius: 10) .fill(Color(.secondarySystemGroupedBackground)) ) - if viewModel.state.showDoneButton { + if coordinator.viewModel.state.showDoneButton { Button(action: { focused = false - viewModel.send(.willUpdateStatusMessage) + coordinator.viewModel.send(.willUpdateStatusMessage) }) { Text(String(localized: "profile_done")) } @@ -83,64 +84,63 @@ struct ProfileView: View { } .padding(.horizontal, 16) } - .refreshable { viewModel.send(.refresh) } + .refreshable { coordinator.viewModel.send(.refresh) } .frame(maxWidth: .infinity) .background(Color(.systemGroupedBackground)) .toolbar { ToolbarItem(placement: .topBarTrailing) { HStack(spacing: 0) { Button { - router.push(.settings) + coordinator.router.push(.settings) } label: { Image(systemName: "gearshape") } } } } - .navigationDestination(for: ProfileRoute.self) { path in - switch path { + .navigationDestination(for: ProfileRoute.self) { route in + switch route { case .settings: - SettingView(viewModel: SettingViewModel( - 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) - )) - .environment(router) + SettingView(viewModel: coordinator.settingViewModel) + .environment(coordinator.router) case .activity(let todoId): - TodoDetailView(viewModel: TodoDetailViewModel( - fetchTodoUseCase: container.resolve(FetchTodoByIdUseCase.self), - fetchReferenceItemsUseCase: container.resolve(FetchReferenceItemsUseCase.self), - upsertUseCase: container.resolve(UpsertTodoUseCase.self), - todoId: todoId, - showEditButton: false - )) - case .theme, .pushNotification, .account: - EmptyView() + TodoDetailView(viewModel: coordinator.makeTodoDetailViewModel(todoId: todoId)) + case .theme: + ThemeView( + theme: Binding( + get: { coordinator.settingViewModel.state.theme }, + set: { coordinator.settingViewModel.send(.setTheme($0)) } + ) + ) + case .pushNotification: + PushNotificationSettingsView(viewModel: coordinator.makePushNotificationSettingsViewModel()) + case .account: + AccountView(viewModel: coordinator.makeAccountViewModel()) } } - .onAppear { viewModel.send(.onAppear) } + .onAppear { coordinator.viewModel.send(.onAppear) } .onChange(of: focused) { _, newValue in withAnimation { - viewModel.send(.updateStatusTextFieldFocus(newValue)) + coordinator.viewModel.send(.updateStatusTextFieldFocus(newValue)) } } .alert( - "", isPresented: Binding( - get: { viewModel.state.showAlert }, - set: { viewModel.send(.setAlert($0)) } - )) { + "", + isPresented: Binding( + get: { coordinator.viewModel.state.showAlert }, + set: { coordinator.viewModel.send(.setAlert($0)) } + ) + ) { Button(String(localized: "common_close"), role: .cancel) { } } message: { - Text(viewModel.state.alertMessage) + Text(coordinator.viewModel.state.alertMessage) } - .sheet(isPresented: Binding( - get: { viewModel.state.showQuarterPicker }, - set: { viewModel.send(.setQuarterPickerPresented($0)) } - )) { + .sheet( + isPresented: Binding( + get: { coordinator.viewModel.state.showQuarterPicker }, + set: { coordinator.viewModel.send(.setQuarterPickerPresented($0)) } + ) + ) { quarterPickerSheet } } @@ -158,17 +158,17 @@ struct ProfileView: View { quarterNavigator - if let quarter = viewModel.state.activityQuarter { + if let quarter = coordinator.viewModel.state.activityQuarter { HeatmapView( quarter: quarter, - selectedActivityKinds: viewModel.state.selectedActivityKinds, - selectedDay: viewModel.state.selectedDay, - onSelectDay: { viewModel.send(.selectDay($0)) } + selectedActivityKinds: coordinator.viewModel.state.selectedActivityKinds, + selectedDay: coordinator.viewModel.state.selectedDay, + onSelectDay: { coordinator.viewModel.send(.selectDay($0)) } ) - if let selectedDay = viewModel.state.selectedDay { + if let selectedDay = coordinator.viewModel.state.selectedDay { selectedDayDetailSection(for: selectedDay) .overlay { - if viewModel.state.isLoading { + if coordinator.viewModel.state.isLoading { LoadingView() } } @@ -184,9 +184,9 @@ struct ProfileView: View { @ViewBuilder private var quarterResetButton: some View { - if !viewModel.isViewingCurrentQuarter { + if !coordinator.viewModel.isViewingCurrentQuarter { Button { - viewModel.send(.moveToCurrentQuarter) + coordinator.viewModel.send(.moveToCurrentQuarter) } label: { Image(systemName: "arrow.uturn.backward") .bold() @@ -206,25 +206,23 @@ struct ProfileView: View { guard let activityKind = ActivityKind(rawValue: activityKindItem.rawValue) else { return false } - return viewModel.state.selectedActivityKinds.contains(activityKind) + return coordinator.viewModel.state.selectedActivityKinds.contains(activityKind) }, set: { _ in guard let activityKind = ActivityKind(rawValue: activityKindItem.rawValue) else { return } - viewModel.send(.toggleActivityKind(activityKind)) + coordinator.viewModel.send(.toggleActivityKind(activityKind)) } ) ) - .disabled( - { - guard let activityKind = ActivityKind(rawValue: activityKindItem.rawValue) else { - return false - } - return viewModel.state.selectedActivityKinds.count == 1 - && viewModel.state.selectedActivityKinds.contains(activityKind) - }() - ) + .disabled({ + guard let activityKind = ActivityKind(rawValue: activityKindItem.rawValue) else { + return false + } + return coordinator.viewModel.state.selectedActivityKinds.count == 1 + && coordinator.viewModel.state.selectedActivityKinds.contains(activityKind) + }()) } } label: { Image(systemName: "line.3.horizontal.decrease") @@ -236,17 +234,17 @@ struct ProfileView: View { private var quarterNavigator: some View { HStack { Button { - viewModel.send(.moveQuarter(-1)) + coordinator.viewModel.send(.moveQuarter(-1)) } label: { Image(systemName: "chevron.left") } - .disabled(!viewModel.canMoveToPreviousQuarter) + .disabled(!coordinator.viewModel.canMoveToPreviousQuarter) Spacer() Button { - viewModel.send(.openQuarterPicker) + coordinator.viewModel.send(.openQuarterPicker) } label: { HStack(spacing: 4) { - Text(viewModel.quarterTitle) + Text(coordinator.viewModel.quarterTitle) .font(.subheadline) Image(systemName: "chevron.up.chevron.down") .font(.caption2) @@ -256,11 +254,11 @@ struct ProfileView: View { .buttonStyle(.plain) Spacer() Button { - viewModel.send(.moveQuarter(1)) + coordinator.viewModel.send(.moveQuarter(1)) } label: { Image(systemName: "chevron.right") } - .disabled(!viewModel.canMoveToNextQuarter) + .disabled(!coordinator.viewModel.canMoveToNextQuarter) } } @@ -272,11 +270,14 @@ struct ProfileView: View { .font(.subheadline) .foregroundStyle(.secondary) Spacer() - Picker("", selection: Binding( - get: { viewModel.state.selectedQuarterPickerYear }, - set: { viewModel.send(.setQuarterPickerYear($0)) } - )) { - ForEach(viewModel.availableQuarterYears, id: \.self) { year in + Picker( + "", + selection: Binding( + get: { coordinator.viewModel.state.selectedQuarterPickerYear }, + set: { coordinator.viewModel.send(.setQuarterPickerYear($0)) } + ) + ) { + ForEach(coordinator.viewModel.availableQuarterYears, id: \.self) { year in Text(verbatim: String(year)) .tag(year) } @@ -298,7 +299,7 @@ struct ProfileView: View { .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarTrailingButton { - viewModel.send(.setQuarterPickerPresented(false)) + coordinator.viewModel.send(.setQuarterPickerPresented(false)) } } } @@ -308,13 +309,13 @@ struct ProfileView: View { @ViewBuilder private func quarterSelectionButton(for quarter: Int) -> some View { - let quarterStart = viewModel.quarterStartForPicker(quarter: quarter) - let isEnabled = viewModel.isQuarterSelectableForPicker(quarter) - let isSelected = viewModel.isQuarterSelectedForPicker(quarter) + let quarterStart = coordinator.viewModel.quarterStartForPicker(quarter: quarter) + let isEnabled = coordinator.viewModel.isQuarterSelectableForPicker(quarter) + let isSelected = coordinator.viewModel.isQuarterSelectedForPicker(quarter) Button { guard let quarterStart else { return } - viewModel.send(.selectQuarter(quarterStart)) + coordinator.viewModel.send(.selectQuarter(quarterStart)) } label: { Text( String.localizedStringWithFormat( @@ -322,14 +323,14 @@ struct ProfileView: View { Int64(quarter) ) ) - .font(.subheadline.weight(.semibold)) - .frame(maxWidth: .infinity) - .padding(.vertical, 12) - .background( - RoundedRectangle(cornerRadius: 12) - .fill(isSelected ? Color.blue : Color(.systemGray5)) - ) - .foregroundStyle(isSelected ? .white : isEnabled ? .primary : .secondary) + .font(.subheadline.weight(.semibold)) + .frame(maxWidth: .infinity) + .padding(.vertical, 12) + .background( + RoundedRectangle(cornerRadius: 12) + .fill(isSelected ? Color.blue : Color(.systemGray5)) + ) + .foregroundStyle(isSelected ? .white : isEnabled ? .primary : .secondary) } .buttonStyle(.plain) .disabled(!isEnabled) @@ -337,7 +338,7 @@ struct ProfileView: View { @ViewBuilder private func selectedDayDetailSection(for day: HeatmapDay) -> some View { - let activities = viewModel.selectedDayActivities + let activities = coordinator.viewModel.selectedDayActivities VStack(alignment: .leading, spacing: 12) { Text(day.date.formatted(.dateTime.year().month(.wide).day())) @@ -354,7 +355,7 @@ struct ProfileView: View { ForEach(activities) { activity in Button { if !activity.isDeleted { - router.push(.activity(activity.todoId)) + coordinator.router.push(.activity(activity.todoId)) } } label: { let item = TodoCategoryItem(from: activity.category) @@ -399,6 +400,12 @@ struct ProfileView: View { .padding(.top, 4) } + private var navigationPath: Binding<[ProfileRoute]> { + Binding( + get: { coordinator.router.path }, + set: { coordinator.router.path = $0 } + ) + } } enum ProfileRoute: Hashable { diff --git a/Application/DevLogPresentation/Sources/Profile/ProfileViewCoordinator.swift b/Application/DevLogPresentation/Sources/Profile/ProfileViewCoordinator.swift new file mode 100644 index 00000000..4726e92f --- /dev/null +++ b/Application/DevLogPresentation/Sources/Profile/ProfileViewCoordinator.swift @@ -0,0 +1,65 @@ +// +// ProfileViewCoordinator.swift +// DevLogPresentation +// +// Created by opfic on 5/21/26. +// + +import Foundation +import DevLogCore +import DevLogDomain + +@MainActor +@Observable +final class ProfileViewCoordinator { + let viewModel: ProfileViewModel + let settingViewModel: SettingViewModel + var router = NavigationRouter() + private let container: DIContainer + + init(container: DIContainer) { + self.container = container + self.viewModel = ProfileViewModel( + fetchUserDataUseCase: container.resolve(FetchUserDataUseCase.self), + fetchTodosUseCase: container.resolve(FetchTodosUseCase.self), + upsertStatusMessageUseCase: container.resolve(UpsertStatusMessageUseCase.self), + networkConnectivityUseCase: container.resolve(ObserveNetworkConnectivityUseCase.self), + fetchHeatmapActivityTypesUseCase: container.resolve(FetchHeatmapActivityTypesUseCase.self), + updateHeatmapActivityTypesUseCase: container.resolve(UpdateHeatmapActivityTypesUseCase.self) + ) + self.settingViewModel = SettingViewModel( + 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) + ) + } + + func makeAccountViewModel() -> AccountViewModel { + AccountViewModel( + fetchProvidersUseCase: container.resolve(FetchAuthProvidersUseCase.self), + linkProviderUseCase: container.resolve(LinkAuthProviderUseCase.self), + unlinkProviderUseCase: container.resolve(UnlinkAuthProviderUseCase.self) + ) + } + + func makePushNotificationSettingsViewModel() -> PushNotificationSettingsViewModel { + PushNotificationSettingsViewModel( + fetchPushSettingsUseCase: container.resolve(FetchPushSettingsUseCase.self), + updatePushSettingsUseCase: container.resolve(UpdatePushSettingsUseCase.self) + ) + } + + func makeTodoDetailViewModel(todoId: String) -> TodoDetailViewModel { + TodoDetailViewModel( + fetchTodoUseCase: container.resolve(FetchTodoByIdUseCase.self), + fetchReferenceItemsUseCase: container.resolve(FetchReferenceItemsUseCase.self), + upsertUseCase: container.resolve(UpsertTodoUseCase.self), + todoId: todoId, + showEditButton: false + ) + } +} diff --git a/Application/DevLogPresentation/Sources/ViewModel/ProfileViewModel.swift b/Application/DevLogPresentation/Sources/Profile/ProfileViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/ProfileViewModel.swift rename to Application/DevLogPresentation/Sources/Profile/ProfileViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/PushNotificationListViewModel.swift b/Application/DevLogPresentation/Sources/PushNotification/PushNotificationListViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/PushNotificationListViewModel.swift rename to Application/DevLogPresentation/Sources/PushNotification/PushNotificationListViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/RootViewModel.swift b/Application/DevLogPresentation/Sources/Root/RootViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/RootViewModel.swift rename to Application/DevLogPresentation/Sources/Root/RootViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/SearchViewModel.swift b/Application/DevLogPresentation/Sources/Search/SearchViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/SearchViewModel.swift rename to Application/DevLogPresentation/Sources/Search/SearchViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/AccountViewModel.swift b/Application/DevLogPresentation/Sources/Setting/AccountViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/AccountViewModel.swift rename to Application/DevLogPresentation/Sources/Setting/AccountViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/PushNotificationSettingsViewModel.swift b/Application/DevLogPresentation/Sources/Setting/PushNotificationSettingsViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/PushNotificationSettingsViewModel.swift rename to Application/DevLogPresentation/Sources/Setting/PushNotificationSettingsViewModel.swift diff --git a/Application/DevLogPresentation/Sources/Setting/SettingView.swift b/Application/DevLogPresentation/Sources/Setting/SettingView.swift index 01982d52..91bd74e7 100644 --- a/Application/DevLogPresentation/Sources/Setting/SettingView.swift +++ b/Application/DevLogPresentation/Sources/Setting/SettingView.swift @@ -6,11 +6,9 @@ // import SwiftUI -import DevLogCore import DevLogDomain struct SettingView: View { - @Environment(\.diContainer) var container: DIContainer @Environment(NavigationRouter.self) private var router @State var viewModel: SettingViewModel @@ -112,34 +110,6 @@ struct SettingView: View { } .navigationTitle(String(localized: "nav_settings")) .navigationBarTitleDisplayMode(.inline) - .navigationDestination(for: ProfileRoute.self) { path in - switch path { - case .theme: - ThemeView( - theme: Binding( - get: { viewModel.state.theme }, - set: { viewModel.send(.setTheme($0)) } - ) - ) - case .pushNotification: - PushNotificationSettingsView( - viewModel: PushNotificationSettingsViewModel( - fetchPushSettingsUseCase: container.resolve(FetchPushSettingsUseCase.self), - updatePushSettingsUseCase: container.resolve(UpdatePushSettingsUseCase.self) - ) - ) - case .account: - AccountView( - viewModel: AccountViewModel( - fetchProvidersUseCase: container.resolve(FetchAuthProvidersUseCase.self), - linkProviderUseCase: container.resolve(LinkAuthProviderUseCase.self), - unlinkProviderUseCase: container.resolve(UnlinkAuthProviderUseCase.self) - ) - ) - case .settings, .activity: - EmptyView() - } - } .alert( viewModel.state.alertTitle, isPresented: Binding( diff --git a/Application/DevLogPresentation/Sources/ViewModel/SettingViewModel.swift b/Application/DevLogPresentation/Sources/Setting/SettingViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/SettingViewModel.swift rename to Application/DevLogPresentation/Sources/Setting/SettingViewModel.swift diff --git a/Application/DevLogPresentation/Sources/ViewModel/TodayViewModel.swift b/Application/DevLogPresentation/Sources/Today/TodayViewModel.swift similarity index 100% rename from Application/DevLogPresentation/Sources/ViewModel/TodayViewModel.swift rename to Application/DevLogPresentation/Sources/Today/TodayViewModel.swift