mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-03-11 17:45:40 +00:00
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
|
||||
|
||||
extension Color {
|
||||
public init(hex: String) {
|
||||
public extension Color {
|
||||
init(hex: String) {
|
||||
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
var int: UInt64 = 0
|
||||
Scanner(string: hex).scanHexInt64(&int)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ import UIKit
|
|||
extension UIApplication {
|
||||
// From https://stackoverflow.com/questions/69650504/how-to-get-rid-of-message-windows-was-deprecated-in-ios-15-0-use-uiwindowsc
|
||||
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
|
||||
if let regexString,
|
||||
let parsedValue {
|
||||
let parsedValue
|
||||
{
|
||||
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
||||
} else {
|
||||
return parsedValue
|
||||
|
|
@ -922,7 +923,8 @@ class ScrapingViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
if let parsedValue,
|
||||
let regexString {
|
||||
let regexString
|
||||
{
|
||||
return runRegex(parsedValue: parsedValue, regexString: regexString)
|
||||
} else {
|
||||
return parsedValue
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ struct PluginCatalogButtonView<PJ: PluginJson>: View {
|
|||
)
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 5)
|
||||
.background(Color.init(uiColor: .tertiarySystemBackground))
|
||||
.background(Color(uiColor: .tertiarySystemBackground))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ struct PluginAggregateView<P: Plugin, PJ: PluginJson>: View {
|
|||
installedPlugins: installedPlugins,
|
||||
searchText: searchText
|
||||
)
|
||||
if !filteredUpdatedPlugins.isEmpty
|
||||
{
|
||||
if !filteredUpdatedPlugins.isEmpty {
|
||||
Section(header: InlineHeader("Updates")) {
|
||||
ForEach(filteredUpdatedPlugins, id: \.self) { (updatedPlugin: PJ) in
|
||||
PluginCatalogButtonView(availablePlugin: updatedPlugin, needsUpdate: true)
|
||||
|
|
@ -59,14 +58,12 @@ struct PluginAggregateView<P: Plugin, PJ: PluginJson>: View {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
let filteredAvailablePlugins = pluginManager.fetchFilteredPlugins(
|
||||
forType: PJ.self,
|
||||
installedPlugins: installedPlugins,
|
||||
searchText: searchText
|
||||
)
|
||||
if !filteredAvailablePlugins.isEmpty
|
||||
{
|
||||
if !filteredAvailablePlugins.isEmpty {
|
||||
Section(header: InlineHeader("Catalog")) {
|
||||
ForEach(filteredAvailablePlugins, id: \.self) { availablePlugin in
|
||||
PluginCatalogButtonView(availablePlugin: availablePlugin, needsUpdate: false)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ struct ContentView: View {
|
|||
@AppStorage("Behavior.AutocorrectSearch") var autocorrectSearch: Bool = false
|
||||
|
||||
@State private var isSearching = false
|
||||
@State private var dismissAction: () -> () = {}
|
||||
@State private var dismissAction: () -> Void = {}
|
||||
|
||||
var body: some View {
|
||||
NavView {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ struct MainView: View {
|
|||
Application.shared.osVersion.toString() >= Application.shared.minVersion
|
||||
{
|
||||
// MARK: If scope bar duplication happens, this may be the problem
|
||||
|
||||
// Sleep for 2 seconds to allow for view layout and app init
|
||||
try? await Task.sleep(seconds: 2)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,19 +9,17 @@ import SwiftUI
|
|||
|
||||
public extension View {
|
||||
// A dismissAction must be added in the parent view struct due to lifecycle issues
|
||||
func expandedSearchable<Content: View>(
|
||||
text: Binding<String>,
|
||||
func expandedSearchable(text: Binding<String>,
|
||||
isSearching: Binding<Bool>? = nil,
|
||||
prompt: String? = nil,
|
||||
dismiss: Binding<(() -> ())>? = nil,
|
||||
scopeBarContent: @escaping () -> Content = {
|
||||
dismiss: Binding<() -> Void>? = nil,
|
||||
scopeBarContent: @escaping () -> some View = {
|
||||
EmptyView()
|
||||
},
|
||||
onSubmit: (() -> ())? = nil,
|
||||
onCancel: (() -> ())? = nil
|
||||
) -> some View {
|
||||
self
|
||||
.overlay(
|
||||
onSubmit: (() -> Void)? = nil,
|
||||
onCancel: (() -> Void)? = nil) -> some View
|
||||
{
|
||||
overlay(
|
||||
SearchBar(
|
||||
searchText: text,
|
||||
isSearching: isSearching ?? Binding(get: { true }, set: { _, _ in }),
|
||||
|
|
@ -47,9 +45,9 @@ struct ESIsSearching: EnvironmentKey {
|
|||
}
|
||||
|
||||
struct ESDismissSearchAction: EnvironmentKey {
|
||||
static var defaultValue: ESDismissSearchAction = ESDismissSearchAction(action: {})
|
||||
static var defaultValue: ESDismissSearchAction = .init(action: {})
|
||||
|
||||
let action: () -> ()
|
||||
let action: () -> Void
|
||||
|
||||
func callAsFunction() {
|
||||
action()
|
||||
|
|
@ -78,7 +76,7 @@ extension EnvironmentValues {
|
|||
}
|
||||
|
||||
struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
||||
var searchController: UISearchController = UISearchController(searchResultsController: nil)
|
||||
var searchController: UISearchController = .init(searchResultsController: nil)
|
||||
|
||||
@Environment(\.autocorrectionDisabled) var autocorrectionDisabled
|
||||
@Environment(\.esAutocapitalizationType) var autocapitalization
|
||||
|
|
@ -87,10 +85,10 @@ struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
|||
@Binding var searchText: String
|
||||
@Binding var isSearching: Bool
|
||||
var prompt: String
|
||||
@Binding var dismiss: (() -> ())
|
||||
@Binding var dismiss: () -> Void
|
||||
let scopeBarContent: () -> ScopeContent
|
||||
let onSubmit: (() -> ())?
|
||||
let onCancel: (() -> ())?
|
||||
let onSubmit: (() -> Void)?
|
||||
let onCancel: (() -> Void)?
|
||||
|
||||
class Coordinator: NSObject, UISearchBarDelegate, UISearchResultsUpdating {
|
||||
let parent: SearchBar
|
||||
|
|
@ -123,7 +121,7 @@ struct SearchBar<ScopeContent: View>: UIViewControllerRepresentable {
|
|||
}
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
return Coordinator(self)
|
||||
Coordinator(self)
|
||||
}
|
||||
|
||||
func makeUIViewController(context: Context) -> NavSearchBarWrapper {
|
||||
|
|
|
|||
Loading…
Reference in a new issue