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
4 changes: 2 additions & 2 deletions DevLog.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16;
IPHONEOS_DEPLOYMENT_TARGET = 17;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -438,7 +438,7 @@
INFOPLIST_KEY_UIStatusBarStyle = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 16;
IPHONEOS_DEPLOYMENT_TARGET = 17;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
4 changes: 2 additions & 2 deletions DevLog/App/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

struct RootView: View {
@Environment(\.diContainer) var container: DIContainer
@StateObject var viewModel: RootViewModel
@State var viewModel: RootViewModel

var body: some View {
ZStack {
Expand Down Expand Up @@ -50,7 +50,7 @@ struct RootView: View {
} message: {
Text(viewModel.state.alertMessage)
}
.onChange(of: viewModel.state.isFirstLaunch) { newValue in
.onChange(of: viewModel.state.isFirstLaunch) { _, newValue in
if newValue {
viewModel.send(.setFirstLaunch(false))
viewModel.send(.signOutAuto)
Expand Down
2 changes: 1 addition & 1 deletion DevLog/Presentation/Protocol/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

@MainActor
protocol Store: ObservableObject {
protocol Store: AnyObject {
associatedtype State
associatedtype Action
associatedtype SideEffect
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/AccountViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class AccountViewModel: Store {
struct State {
var currentProvider: AuthProvider?
Expand Down Expand Up @@ -47,7 +48,7 @@ final class AccountViewModel: Store {
case unlinkSuccess
}

@Published private(set) var state: State = .init()
private(set) var state: State = .init()
private let fetchProvidersUseCase: FetchAuthProvidersUseCase
private let linkProviderUseCase: LinkAuthProviderUseCase
private let unlinkProviderUseCase: UnlinkAuthProviderUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class HomeViewModel: Store {
struct State: Equatable {
var todoKindPreferences = TodoKind.allCases.map { TodoKindPreference(kind: $0, isVisible: true) }
Expand Down Expand Up @@ -81,7 +82,7 @@ final class HomeViewModel: Store {
case urlInputAlert
}

@Published private(set) var state = State()
private(set) var state = State()
private let upsertTodoUseCase: UpsertTodoUseCase
private let addWebPageUseCase: AddWebPageUseCase
private let deleteWebPageUseCase: DeleteWebPageUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/LoginViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import FirebaseAuth
import GoogleSignIn

@Observable
final class LoginViewModel: Store {
struct State {
var signIn: Bool?
Expand Down Expand Up @@ -37,7 +38,7 @@ final class LoginViewModel: Store {
private let signOutUseCase: SignOutUseCase
private let sessionUseCase: AuthSessionUseCase

@Published private(set) var state = State()
private(set) var state = State()
private var cancellables = Set<AnyCancellable>()

init(
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/ProfileViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class ProfileViewModel: Store {
struct State {
var name: String = ""
Expand Down Expand Up @@ -51,7 +52,7 @@ final class ProfileViewModel: Store {
case updateHeatmapActivityTypes(Set<ProfileActivityType>)
}

@Published private(set) var state = State()
private(set) var state = State()
private let fetchUserDataUseCase: FetchUserDataUseCase
private let fetchTodosUseCase: FetchTodosUseCase
private let upsertStatusMessageUseCase: UpsertStatusMessageUseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class PushNotificationListViewModel: Store {
struct State {
var notifications: [PushNotificationItem] = []
Expand Down Expand Up @@ -50,7 +51,7 @@ final class PushNotificationListViewModel: Store {
case toggleRead(String)
}

@Published private(set) var state: State
private(set) var state: State
private let fetchUseCase: FetchPushNotificationsUseCase
private let deleteUseCase: DeletePushNotificationUseCase
private let toggleReadUseCase: TogglePushNotificationReadUseCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class PushNotificationSettingsViewModel: Store {
struct State {
var pushNotificationEnable: Bool = false
Expand Down Expand Up @@ -45,7 +46,7 @@ final class PushNotificationSettingsViewModel: Store {
case updatePushNotificationSettings
}

@Published private(set) var state: State = .init()
private(set) var state: State = .init()
private let calendar = Calendar.current
private let fetchPushSettingsUseCase: FetchPushSettingsUseCase
private let updatePushSettingsUseCase: UpdatePushSettingsUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/RootViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import Combine

@Observable
final class RootViewModel: Store {
struct State {
var showAlert: Bool = false
Expand All @@ -32,7 +33,7 @@ final class RootViewModel: Store {
case signOut
}

@Published private(set) var state: State
private(set) var state: State
private let connectivityProvider = NWPathConnectivityProvider()
private var cancellables = Set<AnyCancellable>()
private let sessionUseCase: AuthSessionUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/SearchViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import OrderedCollections

@Observable
final class SearchViewModel: Store {
struct State {
var isLoading: Bool = false
Expand Down Expand Up @@ -42,7 +43,7 @@ final class SearchViewModel: Store {
case fetch(String)
}

@Published private(set) var state: State = .init()
private(set) var state: State = .init()
private let fetchWebPagesUseCase: FetchWebPagesUseCase
private let fetchTodosUseCase: FetchTodosUseCase
private let fetchRecentSearchQueriesUseCase: FetchRecentSearchQueriesUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/SettingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import Combine

@Observable
final class SettingViewModel: Store {
struct State {
var theme: SystemTheme = .automatic
Expand Down Expand Up @@ -41,7 +42,7 @@ final class SettingViewModel: Store {
case signOut, deleteAuth, error, removeCache
}

@Published private(set) var state = State()
private(set) var state = State()
private let deleteAuthuseCase: DeleteAuthUseCase
private let signOutUseCase: SignOutUseCase
private let sessionUseCase: AuthSessionUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/TodoDetailViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class TodoDetailViewModel: Store {
struct State {
var todo: Todo?
Expand All @@ -33,7 +34,7 @@ final class TodoDetailViewModel: Store {
case upsertTodo(Todo)
}

@Published private(set) var state: State = .init()
private(set) var state: State = .init()
private let fetchUseCase: FetchTodoByIDUseCase
private let upsertUseCase: UpsertTodoUseCase
private let todoID: String
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/TodoEditorViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import OrderedCollections

@Observable
final class TodoEditorViewModel: Store {
struct State {
var title: String = ""
Expand Down Expand Up @@ -41,7 +42,7 @@ final class TodoEditorViewModel: Store {

enum SideEffect { }

@Published private(set) var state = State()
private(set) var state = State()
private let calendar = Calendar.current
let navigationTitle: String
private let id: String
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/TodoListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class TodoListViewModel: Store {
struct State {
var todos: [TodoListItem] = []
Expand Down Expand Up @@ -74,7 +75,7 @@ final class TodoListViewModel: Store {
case togglePinned(TodoListItem)
}

@Published private(set) var state: State
private(set) var state: State
private let searchDebounceDelay: Double = 0.4
private var searchDebounceTask: Task<Void, Never>?
private let fetchTodosUseCase: FetchTodosUseCase
Expand Down
3 changes: 2 additions & 1 deletion DevLog/Presentation/ViewModel/TodoManageViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Foundation

@Observable
final class TodoManageViewModel: Store {
struct State {
var todoKindPreferences: [TodoKindPreference]
Expand All @@ -19,7 +20,7 @@ final class TodoManageViewModel: Store {

enum SideEffect { }

@Published private(set) var state: State
private(set) var state: State

init(_ todoKindPreferences: [TodoKindPreference]) {
self.state = State(todoKindPreferences: todoKindPreferences)
Expand Down
2 changes: 1 addition & 1 deletion DevLog/UI/Common/Component/Toast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private struct ToastOverlayView<Label: View>: View {
)
.offset(y: yOffset)
.opacity(opacityValue)
.onChange(of: isPresented) { newValue in
.onChange(of: isPresented) { _, newValue in
if newValue {
resetForNewPresentation()
presentAnimated()
Expand Down
5 changes: 3 additions & 2 deletions DevLog/UI/Common/NavigationRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

import SwiftUI

final class NavigationRouter: ObservableObject {
@Published var path = NavigationPath()
@Observable
final class NavigationRouter {
var path = NavigationPath()

func push(_ element: any Hashable) {
Task { @MainActor in
Expand Down
24 changes: 0 additions & 24 deletions DevLog/UI/Common/Searchable.swift

This file was deleted.

6 changes: 3 additions & 3 deletions DevLog/UI/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import SwiftUI
struct HomeView: View {
@Environment(\.diContainer) var container: any DIContainer
@Environment(\.sceneWidth) var sceneWidth: CGFloat
@StateObject private var router = NavigationRouter()
@StateObject var viewModel: HomeViewModel
@State private var router = NavigationRouter()
@State var viewModel: HomeViewModel

var body: some View {
NavigationStack(path: $router.path) {
Expand All @@ -32,7 +32,7 @@ struct HomeView: View {
deleteTodoUseCase: container.resolve(DeleteTodoUseCase.self),
kind: todoKind
))
.environmentObject(router)
.environment(router)
case .detail(let todoID):
TodoDetailView(viewModel: TodoDetailViewModel(
fetchUseCase: container.resolve(FetchTodoByIDUseCase.self),
Expand Down
2 changes: 1 addition & 1 deletion DevLog/UI/Home/TodoDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct TodoDetailView: View {
@StateObject var viewModel: TodoDetailViewModel
@State var viewModel: TodoDetailViewModel

var body: some View {
ZStack {
Expand Down
4 changes: 2 additions & 2 deletions DevLog/UI/Home/TodoEditorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OrderedCollections
import SwiftUI

struct TodoEditorView: View {
@StateObject var viewModel: TodoEditorViewModel
@State var viewModel: TodoEditorViewModel
@Environment(\.safeAreaInsets) private var safeAreaInsets
@Environment(\.dismiss) private var dismiss
@FocusState private var field: Field?
Expand Down Expand Up @@ -245,7 +245,7 @@ private struct TagEditor<Content: View>: View {
sheetHeight += tagsHeight + (tagsHeight == 0 ? 0 : spacing)
}
}
.onChange(of: tags) { newTags in
.onChange(of: tags) { _, newTags in
DispatchQueue.main.async {
tagsHeight = geometry.size.height
sheetHeight = fieldHeight + tagsHeight + (newTags.isEmpty ? 0 : spacing)
Expand Down
4 changes: 2 additions & 2 deletions DevLog/UI/Home/TodoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import SwiftUI

struct TodoListView: View {
@StateObject var viewModel: TodoListViewModel
@EnvironmentObject var router: NavigationRouter
@State var viewModel: TodoListViewModel
@Environment(NavigationRouter.self) var router
@Environment(\.diContainer) var container: DIContainer
@Environment(\.colorScheme) private var colorScheme

Expand Down
2 changes: 1 addition & 1 deletion DevLog/UI/Home/TodoManageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct TodoManageView: View {
@StateObject var viewModel: TodoManageViewModel
@State var viewModel: TodoManageViewModel
var onDismiss: (([TodoKindPreference]) -> Void)?

var body: some View {
Expand Down
2 changes: 1 addition & 1 deletion DevLog/UI/Login/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
struct LoginView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.sceneWidth) var sceneWidth
@StateObject var viewModel: LoginViewModel
@State var viewModel: LoginViewModel

var body: some View {
ZStack {
Expand Down
Loading