Refactor ViewModel

This commit is contained in:
世界
2025-12-01 17:11:34 +08:00
parent 30492c1191
commit 8e764c56eb
34 changed files with 136 additions and 160 deletions
@@ -7,7 +7,7 @@ import SwiftUI
public struct OverviewView: View {
@EnvironmentObject private var environments: ExtensionEnvironments
@EnvironmentObject private var profile: ExtensionProfile
@StateObject private var coordinator = OverviewCoordinator()
@StateObject private var coordinator = OverviewViewModel()
@StateObject private var configuration = DashboardCardConfiguration()
@Binding private var profileList: [ProfilePreview]
@@ -4,12 +4,9 @@ import Library
import SwiftUI
@MainActor
public final class OverviewCoordinator: ObservableObject {
@Published public var alert: Alert?
public final class OverviewViewModel: BaseViewModel {
@Published public var reasserting = false
public init() {}
public func switchProfile(_ profileID: Int64, profile: ExtensionProfile, environments: ExtensionEnvironments) async {
await SharedPreferences.selectedProfileID.set(profileID)
environments.selectedProfileUpdate.send()