Bookmarks are added through search results and can be accessed through the library. These can be moved and deleted within the list. Add a RealDebrid instant availability cache for bookmark IA status to not overwhelm the API. Instant availability results are fresh on every search results since the cache is cleared. Also don't require a source API object to be present for the API parser button in source settings. If a JSON parser exists for a source, allow the option to be presented. Signed-off-by: kingbri <bdashore3@proton.me>
39 lines
1 KiB
Swift
39 lines
1 KiB
Swift
//
|
|
// ConditionalContextMenu.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 9/3/22.
|
|
//
|
|
// Used as a workaround for iOS 15 not updating context views with conditional variables
|
|
// A stateful ID is required for the contextMenu to update itself.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ConditionalContextMenu<InternalContent: View, ID: Hashable>: ViewModifier {
|
|
let internalContent: () -> InternalContent
|
|
let id: ID
|
|
|
|
init(@ViewBuilder _ internalContent: @escaping () -> InternalContent, id: ID) {
|
|
self.internalContent = internalContent
|
|
self.id = id
|
|
}
|
|
|
|
func body(content: Content) -> some View {
|
|
if #available(iOS 16, *) {
|
|
content
|
|
.contextMenu {
|
|
internalContent()
|
|
}
|
|
} else {
|
|
content
|
|
.background {
|
|
Color.clear
|
|
.contextMenu {
|
|
internalContent()
|
|
}
|
|
.id(id)
|
|
}
|
|
}
|
|
}
|
|
}
|