Backups in Ferrite archive a user's bookmarks, history, source lists, and source names. Sources are not archived due to the size of the backup increasing exponentially. These files use the .feb format to avoid JSON conflicts when opening the file in Ferrite. The backup file can be renamed to JSON for editing at any time. Add the Backport namespace to be used for ported features rather than making a file for every iOS 14 adaptation. Move history and bookmark creation to the PersistenceController rather than individual functions. Signed-off-by: kingbri <bdashore3@proton.me>
90 lines
2.7 KiB
Swift
90 lines
2.7 KiB
Swift
//
|
|
// DefaultActionsPickerViews.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 8/11/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct MagnetActionPickerView: View {
|
|
@AppStorage("Actions.DefaultMagnet") var defaultMagnetAction: DefaultMagnetActionType = .none
|
|
|
|
var body: some View {
|
|
List {
|
|
ForEach(DefaultMagnetActionType.allCases, id: \.self) { action in
|
|
Button {
|
|
defaultMagnetAction = action
|
|
} label: {
|
|
HStack {
|
|
Text(fetchPickerChoiceName(choice: action))
|
|
Spacer()
|
|
if action == defaultMagnetAction {
|
|
Image(systemName: "checkmark")
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|
|
}
|
|
.backport.tint(.primary)
|
|
}
|
|
}
|
|
.listStyle(.insetGrouped)
|
|
.inlinedList()
|
|
.navigationTitle("Default magnet action")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
|
|
func fetchPickerChoiceName(choice: DefaultMagnetActionType) -> String {
|
|
switch choice {
|
|
case .none:
|
|
return "Let me choose"
|
|
case .webtor:
|
|
return "Open in Webtor"
|
|
case .shareMagnet:
|
|
return "Share magnet link"
|
|
}
|
|
}
|
|
}
|
|
|
|
struct DebridActionPickerView: View {
|
|
@AppStorage("Actions.DefaultDebrid") var defaultDebridAction: DefaultDebridActionType = .none
|
|
|
|
var body: some View {
|
|
List {
|
|
ForEach(DefaultDebridActionType.allCases, id: \.self) { action in
|
|
Button {
|
|
defaultDebridAction = action
|
|
} label: {
|
|
HStack {
|
|
Text(fetchPickerChoiceName(choice: action))
|
|
Spacer()
|
|
if action == defaultDebridAction {
|
|
Image(systemName: "checkmark")
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|
|
}
|
|
.backport.tint(.primary)
|
|
}
|
|
}
|
|
.listStyle(.insetGrouped)
|
|
.inlinedList()
|
|
.navigationTitle("Default debrid action")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
|
|
func fetchPickerChoiceName(choice: DefaultDebridActionType) -> String {
|
|
switch choice {
|
|
case .none:
|
|
return "Let me choose"
|
|
case .outplayer:
|
|
return "Open in Outplayer"
|
|
case .vlc:
|
|
return "Open in VLC"
|
|
case .infuse:
|
|
return "Open in Infuse"
|
|
case .shareDownload:
|
|
return "Share download link"
|
|
}
|
|
}
|
|
}
|