Ferrite-backup/Ferrite/ViewModels/NavigationViewModel.swift
kingbri f622b7af05 Actions: Fix default action settings
Since actions use a new API, update default actions to use the
same API rather than the legacy models. If an action is removed,
a prompt will tell the user to change their default debrid/magnet
action and default to the choice sheet.

Also add extra UI fixes and cleanup.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-03-01 18:31:29 -05:00

69 lines
1.7 KiB
Swift

//
// NavigationViewModel.swift
// Ferrite
//
// Created by Brian Dashore on 7/24/22.
//
import SwiftUI
@MainActor
public class NavigationViewModel: ObservableObject {
var toastModel: ToastViewModel?
// Used between SearchResultsView and MagnetChoiceView
public enum ChoiceSheetType: Identifiable {
public var id: Int {
hashValue
}
case action
case batch
case activity
}
enum ViewTab {
case search
case plugins
case settings
case library
}
enum LibraryPickerSegment {
case bookmarks
case history
case debridCloud
}
enum PluginPickerSegment {
case sources
case actions
}
@Published var selectedMagnet: Magnet?
@Published var selectedHistoryInfo: HistoryEntryJson?
@Published var resultFromCloud: Bool = false
// For giving information in magnet choice sheet
@Published var selectedTitle: String = ""
@Published var selectedBatchTitle: String = ""
@Published var hideNavigationBar = false
@Published var currentChoiceSheet: ChoiceSheetType?
var activityItems: [Any] = []
// Used to show the activity sheet in the share menu
@Published var showLocalActivitySheet = false
@Published var selectedTab: ViewTab = .search
// Used between SourceListView and SourceSettingsView
@Published var showSourceSettings: Bool = false
var selectedSource: Source?
@Published var showSourceListEditor: Bool = false
@Published var libraryPickerSelection: LibraryPickerSegment = .bookmarks
@Published var pluginPickerSelection: PluginPickerSegment = .sources
}