| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import Combine
- import Foundation
- @MainActor
- final class MainViewModel: ObservableObject {
- @Published var selectedDestination: NavigationDestination = .grammarChecker
- @Published var isShowingPaywall = false
- @Published var isShowingSettings = false
- @Published var pendingHistoryEntry: HistoryEntry?
- func showPaywall() {
- isShowingPaywall = true
- }
- func hidePaywall() {
- isShowingPaywall = false
- }
- func selectDestination(_ destination: NavigationDestination) {
- selectedDestination = destination
- hideSettings()
- }
- func showSettings() {
- isShowingSettings = true
- }
- func hideSettings() {
- isShowingSettings = false
- }
- func openHistoryEntry(_ entry: HistoryEntry) {
- pendingHistoryEntry = entry
- selectedDestination = entry.tool.navigationDestination
- hideSettings()
- }
- func clearPendingHistoryEntry() {
- pendingHistoryEntry = nil
- }
- }
|