Ferrite: Format
Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
eacccf36ff
commit
9427ca271b
14 changed files with 62 additions and 64 deletions
|
|
@ -1 +1 @@
|
||||||
5.7
|
5.8
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
extension Color {
|
public extension Color {
|
||||||
public init(hex: String) {
|
init(hex: String) {
|
||||||
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||||
var int: UInt64 = 0
|
var int: UInt64 = 0
|
||||||
Scanner(string: hex).scanHexInt64(&int)
|
Scanner(string: hex).scanHexInt64(&int)
|
||||||
|
|
@ -28,7 +28,7 @@ extension Color {
|
||||||
.sRGB,
|
.sRGB,
|
||||||
red: Double(r) / 255,
|
red: Double(r) / 255,
|
||||||
green: Double(g) / 255,
|
green: Double(g) / 255,
|
||||||
blue: Double(b) / 255,
|
blue: Double(b) / 255,
|
||||||
opacity: Double(a) / 255
|
opacity: Double(a) / 255
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@ import UIKit
|
||||||
extension UIApplication {
|
extension UIApplication {
|
||||||
// From https://stackoverflow.com/questions/69650504/how-to-get-rid-of-message-windows-was-deprecated-in-ios-15-0-use-uiwindowsc
|
// From https://stackoverflow.com/questions/69650504/how-to-get-rid-of-message-windows-was-deprecated-in-ios-15-0-use-uiwindowsc
|
||||||
var currentUIWindow: UIWindow? {
|
var currentUIWindow: UIWindow? {
|
||||||
return UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }.first { $0.isKeyWindow }
|
UIApplication.shared.connectedScenes.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }.first { $0.isKeyWindow }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,8 @@ class ScrapingViewModel: ObservableObject {
|
||||||
|
|
||||||
// A capture group must be used in the provided regex
|
// A capture group must be used in the provided regex
|
||||||
if let regexString,
|
if let regexString,
|
||||||
let parsedValue {
|
let parsedValue
|
||||||
|
{
|
||||||
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
||||||
} else {
|
} else {
|
||||||
return parsedValue
|
return parsedValue
|
||||||
|
|
@ -922,7 +923,8 @@ class ScrapingViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let parsedValue,
|
if let parsedValue,
|
||||||
let regexString {
|
let regexString
|
||||||
|
{
|
||||||
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
||||||
} else {
|
} else {
|
||||||
return parsedValue
|
return parsedValue
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,16 @@ struct NavView<Content: View>: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
// Uncomment once NavigationStack issues are fixed
|
// Uncomment once NavigationStack issues are fixed
|
||||||
/*
|
/*
|
||||||
if #available(iOS 16, *) {
|
if #available(iOS 16, *) {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*/
|
*/
|
||||||
NavigationView {
|
NavigationView {
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
.navigationViewStyle(.stack)
|
.navigationViewStyle(.stack)
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ struct PluginCatalogButtonView<PJ: PluginJson>: View {
|
||||||
)
|
)
|
||||||
.padding(.horizontal, 7)
|
.padding(.horizontal, 7)
|
||||||
.padding(.vertical, 5)
|
.padding(.vertical, 5)
|
||||||
.background(Color.init(uiColor: .tertiarySystemBackground))
|
.background(Color(uiColor: .tertiarySystemBackground))
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||||
}
|
}
|
||||||
.buttonStyle(.borderless)
|
.buttonStyle(.borderless)
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,7 @@ struct PluginAggregateView<P: Plugin, PJ: PluginJson>: View {
|
||||||
installedPlugins: installedPlugins,
|
installedPlugins: installedPlugins,
|
||||||
searchText: searchText
|
searchText: searchText
|
||||||
)
|
)
|
||||||
if !filteredUpdatedPlugins.isEmpty
|
if !filteredUpdatedPlugins.isEmpty {
|
||||||
{
|
|
||||||
Section(header: InlineHeader("Updates")) {
|
Section(header: InlineHeader("Updates")) {
|
||||||
ForEach(filteredUpdatedPlugins, id: \.self) { (updatedPlugin: PJ) in
|
ForEach(filteredUpdatedPlugins, id: \.self) { (updatedPlugin: PJ) in
|
||||||
PluginCatalogButtonView(availablePlugin: updatedPlugin, needsUpdate: true)
|
PluginCatalogButtonView(availablePlugin: updatedPlugin, needsUpdate: true)
|
||||||
|
|
@ -59,14 +58,12 @@ struct PluginAggregateView<P: Plugin, PJ: PluginJson>: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let filteredAvailablePlugins = pluginManager.fetchFilteredPlugins(
|
let filteredAvailablePlugins = pluginManager.fetchFilteredPlugins(
|
||||||
forType: PJ.self,
|
forType: PJ.self,
|
||||||
installedPlugins: installedPlugins,
|
installedPlugins: installedPlugins,
|
||||||
searchText: searchText
|
searchText: searchText
|
||||||
)
|
)
|
||||||
if !filteredAvailablePlugins.isEmpty
|
if !filteredAvailablePlugins.isEmpty {
|
||||||
{
|
|
||||||
Section(header: InlineHeader("Catalog")) {
|
Section(header: InlineHeader("Catalog")) {
|
||||||
ForEach(filteredAvailablePlugins, id: \.self) { availablePlugin in
|
ForEach(filteredAvailablePlugins, id: \.self) { availablePlugin in
|
||||||
PluginCatalogButtonView(availablePlugin: availablePlugin, needsUpdate: false)
|
PluginCatalogButtonView(availablePlugin: availablePlugin, needsUpdate: false)
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ struct SearchResultButtonView: View {
|
||||||
} message: {
|
} message: {
|
||||||
Text(
|
Text(
|
||||||
"RealDebrid is currently caching this file. Would you like to delete it? \n\n" +
|
"RealDebrid is currently caching this file. Would you like to delete it? \n\n" +
|
||||||
"Progress can be checked on the RealDebrid website."
|
"Progress can be checked on the RealDebrid website."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.onReceive(NotificationCenter.default.publisher(for: .didDeleteBookmark)) { notification in
|
.onReceive(NotificationCenter.default.publisher(for: .didDeleteBookmark)) { notification in
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ struct ContentView: View {
|
||||||
@AppStorage("Behavior.AutocorrectSearch") var autocorrectSearch: Bool = false
|
@AppStorage("Behavior.AutocorrectSearch") var autocorrectSearch: Bool = false
|
||||||
|
|
||||||
@State private var isSearching = false
|
@State private var isSearching = false
|
||||||
@State private var dismissAction: () -> () = {}
|
@State private var dismissAction: () -> Void = {}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavView {
|
NavView {
|
||||||
|
|
@ -47,7 +47,7 @@ struct ContentView: View {
|
||||||
sources: sources,
|
sources: sources,
|
||||||
debridManager: debridManager
|
debridManager: debridManager
|
||||||
)
|
)
|
||||||
|
|
||||||
logManager.hideIndeterminateToast()
|
logManager.hideIndeterminateToast()
|
||||||
scrapingModel.runningSearchTask = nil
|
scrapingModel.runningSearchTask = nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ struct MainView: View {
|
||||||
Application.shared.osVersion.toString() >= Application.shared.minVersion
|
Application.shared.osVersion.toString() >= Application.shared.minVersion
|
||||||
{
|
{
|
||||||
// MARK: If scope bar duplication happens, this may be the problem
|
// MARK: If scope bar duplication happens, this may be the problem
|
||||||
|
|
||||||
// Sleep for 2 seconds to allow for view layout and app init
|
// Sleep for 2 seconds to allow for view layout and app init
|
||||||
try? await Task.sleep(seconds: 2)
|
try? await Task.sleep(seconds: 2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,32 +9,30 @@ import SwiftUI
|
||||||
|
|
||||||
public extension View {
|
public extension View {
|
||||||
// A dismissAction must be added in the parent view struct due to lifecycle issues
|
// A dismissAction must be added in the parent view struct due to lifecycle issues
|
||||||
func expandedSearchable<Content: View>(
|
func expandedSearchable(text: Binding<String>,
|
||||||
text: Binding<String>,
|
isSearching: Binding<Bool>? = nil,
|
||||||
isSearching: Binding<Bool>? = nil,
|
prompt: String? = nil,
|
||||||
prompt: String? = nil,
|
dismiss: Binding<() -> Void>? = nil,
|
||||||
dismiss: Binding<(() -> ())>? = nil,
|
scopeBarContent: @escaping () -> some View = {
|
||||||
scopeBarContent: @escaping () -> Content = {
|
EmptyView()
|
||||||
EmptyView()
|
},
|
||||||
},
|
onSubmit: (() -> Void)? = nil,
|
||||||
onSubmit: (() -> ())? = nil,
|
onCancel: (() -> Void)? = nil) -> some View
|
||||||
onCancel: (() -> ())? = nil
|
{
|
||||||
) -> some View {
|
overlay(
|
||||||
self
|
SearchBar(
|
||||||
.overlay(
|
searchText: text,
|
||||||
SearchBar(
|
isSearching: isSearching ?? Binding(get: { true }, set: { _, _ in }),
|
||||||
searchText: text,
|
prompt: prompt ?? "Search",
|
||||||
isSearching: isSearching ?? Binding(get: { true }, set: { _, _ in }),
|
dismiss: dismiss ?? Binding(get: { {} }, set: { _, _ in }),
|
||||||
prompt: prompt ?? "Search",
|
scopeBarContent: scopeBarContent,
|
||||||
dismiss: dismiss ?? Binding(get: { {} }, set: { _, _ in }),
|
onSubmit: onSubmit,
|
||||||
scopeBarContent: scopeBarContent,
|
onCancel: onCancel
|
||||||
onSubmit: onSubmit,
|
|
||||||
onCancel: onCancel
|
|
||||||
)
|
|
||||||
.frame(width: 0, height: 0)
|
|
||||||
)
|
)
|
||||||
.environment(\.esIsSearching, isSearching?.wrappedValue ?? false)
|
.frame(width: 0, height: 0)
|
||||||
.environment(\.esDismissSearch, ESDismissSearchAction(action: dismiss?.wrappedValue ?? { }))
|
)
|
||||||
|
.environment(\.esIsSearching, isSearching?.wrappedValue ?? false)
|
||||||
|
.environment(\.esDismissSearch, ESDismissSearchAction(action: dismiss?.wrappedValue ?? {}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func esAutocapitalization(_ autocapitalizationType: UITextAutocapitalizationType) -> some View {
|
func esAutocapitalization(_ autocapitalizationType: UITextAutocapitalizationType) -> some View {
|
||||||
|
|
@ -47,9 +45,9 @@ struct ESIsSearching: EnvironmentKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ESDismissSearchAction: EnvironmentKey {
|
struct ESDismissSearchAction: EnvironmentKey {
|
||||||
static var defaultValue: ESDismissSearchAction = ESDismissSearchAction(action: {})
|
static var defaultValue: ESDismissSearchAction = .init(action: {})
|
||||||
|
|
||||||
let action: () -> ()
|
let action: () -> Void
|
||||||
|
|
||||||
func callAsFunction() {
|
func callAsFunction() {
|
||||||
action()
|
action()
|
||||||
|
|
@ -78,7 +76,7 @@ extension EnvironmentValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
||||||
var searchController: UISearchController = UISearchController(searchResultsController: nil)
|
var searchController: UISearchController = .init(searchResultsController: nil)
|
||||||
|
|
||||||
@Environment(\.autocorrectionDisabled) var autocorrectionDisabled
|
@Environment(\.autocorrectionDisabled) var autocorrectionDisabled
|
||||||
@Environment(\.esAutocapitalizationType) var autocapitalization
|
@Environment(\.esAutocapitalizationType) var autocapitalization
|
||||||
|
|
@ -87,10 +85,10 @@ struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
||||||
@Binding var searchText: String
|
@Binding var searchText: String
|
||||||
@Binding var isSearching: Bool
|
@Binding var isSearching: Bool
|
||||||
var prompt: String
|
var prompt: String
|
||||||
@Binding var dismiss: (() -> ())
|
@Binding var dismiss: () -> Void
|
||||||
let scopeBarContent: () -> ScopeContent
|
let scopeBarContent: () -> ScopeContent
|
||||||
let onSubmit: (() -> ())?
|
let onSubmit: (() -> Void)?
|
||||||
let onCancel: (() -> ())?
|
let onCancel: (() -> Void)?
|
||||||
|
|
||||||
class Coordinator: NSObject, UISearchBarDelegate, UISearchResultsUpdating {
|
class Coordinator: NSObject, UISearchBarDelegate, UISearchResultsUpdating {
|
||||||
let parent: SearchBar
|
let parent: SearchBar
|
||||||
|
|
@ -123,7 +121,7 @@ struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeCoordinator() -> Coordinator {
|
func makeCoordinator() -> Coordinator {
|
||||||
return Coordinator(self)
|
Coordinator(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeUIViewController(context: Context) -> NavSearchBarWrapper {
|
func makeUIViewController(context: Context) -> NavSearchBarWrapper {
|
||||||
|
|
@ -186,7 +184,7 @@ struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
setup()
|
setup()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ struct ShareSheet: UIViewControllerRepresentable {
|
||||||
func makeUIViewController(context: Context) -> UIActivityViewController {
|
func makeUIViewController(context: Context) -> UIActivityViewController {
|
||||||
UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
|
UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {}
|
func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ struct SettingsView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Playback services")) {
|
Section(header: InlineHeader("Playback services")) {
|
||||||
NavigationLink{
|
NavigationLink {
|
||||||
SettingsKodiView(kodiServers: kodiServers)
|
SettingsKodiView(kodiServers: kodiServers)
|
||||||
} label: {
|
} label: {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ struct BatchChoiceView: View {
|
||||||
if file.fileName.lowercased().contains(searchText.lowercased()) || searchText.isEmpty {
|
if file.fileName.lowercased().contains(searchText.lowercased()) || searchText.isEmpty {
|
||||||
Button(file.fileName) {
|
Button(file.fileName) {
|
||||||
debridManager.selectedAllDebridFile = file
|
debridManager.selectedAllDebridFile = file
|
||||||
|
|
||||||
queueCommonDownload(fileName: file.fileName)
|
queueCommonDownload(fileName: file.fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ struct BatchChoiceView: View {
|
||||||
if file.name.lowercased().contains(searchText.lowercased()) || searchText.isEmpty {
|
if file.name.lowercased().contains(searchText.lowercased()) || searchText.isEmpty {
|
||||||
Button(file.name) {
|
Button(file.name) {
|
||||||
debridManager.selectedPremiumizeFile = file
|
debridManager.selectedPremiumizeFile = file
|
||||||
|
|
||||||
queueCommonDownload(fileName: file.name)
|
queueCommonDownload(fileName: file.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue