Ferrite: Format

Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
kingbri 2022-07-26 11:07:01 -04:00
parent 119a3a18b1
commit 9d5a0d0120
10 changed files with 35 additions and 50 deletions

View file

@ -146,7 +146,7 @@ public class RealDebrid: ObservableObject {
keychain.set(rawResponse.accessToken, forKey: "RealDebrid.AccessToken") keychain.set(rawResponse.accessToken, forKey: "RealDebrid.AccessToken")
keychain.set(rawResponse.refreshToken, forKey: "RealDebrid.RefreshToken") keychain.set(rawResponse.refreshToken, forKey: "RealDebrid.RefreshToken")
let accessTimestamp = Date().timeIntervalSince1970 + (Double(rawResponse.expiresIn)) let accessTimestamp = Date().timeIntervalSince1970 + Double(rawResponse.expiresIn)
UserDefaults.standard.set(accessTimestamp, forKey: "RealDebrid.AccessTokenStamp") UserDefaults.standard.set(accessTimestamp, forKey: "RealDebrid.AccessTokenStamp")
// Set AppStorage variable // Set AppStorage variable

View file

@ -6,10 +6,8 @@
// //
// //
import Foundation
import CoreData import CoreData
import Foundation
@objc(TorrentSource) @objc(TorrentSource)
public class TorrentSource: NSManagedObject { public class TorrentSource: NSManagedObject {}
}

View file

@ -6,26 +6,21 @@
// //
// //
import Foundation
import CoreData import CoreData
import Foundation
public extension TorrentSource {
extension TorrentSource { @nonobjc class func fetchRequest() -> NSFetchRequest<TorrentSource> {
NSFetchRequest<TorrentSource>(entityName: "TorrentSource")
@nonobjc public class func fetchRequest() -> NSFetchRequest<TorrentSource> {
return NSFetchRequest<TorrentSource>(entityName: "TorrentSource")
} }
@NSManaged public var enabled: Bool @NSManaged var enabled: Bool
@NSManaged public var linkQuery: String @NSManaged var linkQuery: String
@NSManaged public var name: String? @NSManaged var name: String?
@NSManaged public var rowQuery: String @NSManaged var rowQuery: String
@NSManaged public var sizeQuery: String? @NSManaged var sizeQuery: String?
@NSManaged public var titleQuery: String? @NSManaged var titleQuery: String?
@NSManaged public var url: String @NSManaged var url: String
} }
extension TorrentSource : Identifiable { extension TorrentSource: Identifiable {}
}

View file

@ -6,10 +6,8 @@
// //
// //
import Foundation
import CoreData import CoreData
import Foundation
@objc(TorrentSourceUrl) @objc(TorrentSourceUrl)
public class TorrentSourceUrl: NSManagedObject { public class TorrentSourceUrl: NSManagedObject {}
}

View file

@ -6,22 +6,17 @@
// //
// //
import Foundation
import CoreData import CoreData
import Foundation
public extension TorrentSourceUrl {
extension TorrentSourceUrl { @nonobjc class func fetchRequest() -> NSFetchRequest<TorrentSourceUrl> {
NSFetchRequest<TorrentSourceUrl>(entityName: "TorrentSourceUrl")
@nonobjc public class func fetchRequest() -> NSFetchRequest<TorrentSourceUrl> {
return NSFetchRequest<TorrentSourceUrl>(entityName: "TorrentSourceUrl")
} }
@NSManaged public var urlString: String @NSManaged var urlString: String
@NSManaged public var repoName: String? @NSManaged var repoName: String?
@NSManaged public var repoAuthor: String? @NSManaged var repoAuthor: String?
} }
extension TorrentSourceUrl : Identifiable { extension TorrentSourceUrl: Identifiable {}
}

View file

@ -15,7 +15,7 @@ public struct SourceJson: Codable {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case repoName = "name" case repoName = "name"
case repoAuthor = "author" case repoAuthor = "author"
case sources = "sources" case sources
} }
} }

View file

@ -68,7 +68,7 @@ public class SourceManager: ObservableObject {
do { do {
try backgroundContext.save() try backgroundContext.save()
} catch { } catch {
Task{ @MainActor in Task { @MainActor in
toastModel?.toastDescription = error.localizedDescription toastModel?.toastDescription = error.localizedDescription
} }
} }

View file

@ -37,7 +37,7 @@ struct ContentView: View {
} label: { } label: {
Text("None") Text("None")
if (selectedSource == nil) { if selectedSource == nil {
Image(systemName: "checkmark") Image(systemName: "checkmark")
} }
} }
@ -79,9 +79,7 @@ struct ContentView: View {
} }
} }
func performSearch() { func performSearch() {}
}
} }
struct ContentView_Previews: PreviewProvider { struct ContentView_Previews: PreviewProvider {

View file

@ -52,7 +52,7 @@ struct SearchResultsView: View {
} }
.tint(.primary) .tint(.primary)
.padding(.bottom, 5) .padding(.bottom, 5)
SearchResultRDView(result: result) SearchResultRDView(result: result)
} }
} }

View file

@ -30,8 +30,9 @@ struct SourceListView: View {
set: { set: {
source.enabled = $0 source.enabled = $0
PersistenceController.shared.save() PersistenceController.shared.save()
})) { }
Text(source.name ?? "Unknown Source") )) {
Text(source.name ?? "Unknown Source")
} }
} }
.onDelete { offsets in .onDelete { offsets in
@ -52,9 +53,9 @@ struct SourceListView: View {
if !sources.contains(where: { availableSource.name == $0.name }) { if !sources.contains(where: { availableSource.name == $0.name }) {
HStack { HStack {
Text(availableSource.name ?? "Unnamed source") Text(availableSource.name ?? "Unnamed source")
Spacer() Spacer()
Button("Install") { Button("Install") {
sourceManager.installSource(sourceJson: availableSource) sourceManager.installSource(sourceJson: availableSource)
} }