Ferrite: Format and cleanup

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2022-08-31 12:06:13 -04:00
parent 664c57b751
commit 400242690b
5 changed files with 13 additions and 17 deletions

View file

@ -32,24 +32,20 @@ struct PersistenceController {
description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
try? container.viewContext.setQueryGenerationFrom(.current)
container.loadPersistentStores { _, error in container.loadPersistentStores { _, error in
if let error = error { if let error = error {
fatalError("CoreData init error: \(error)") fatalError("CoreData init error: \(error)")
} }
} }
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
try? container.viewContext.setQueryGenerationFrom(.current)
backgroundContext = container.newBackgroundContext() backgroundContext = container.newBackgroundContext()
backgroundContext.automaticallyMergesChangesFromParent = true backgroundContext.automaticallyMergesChangesFromParent = true
backgroundContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy backgroundContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
try? backgroundContext.setQueryGenerationFrom(.current) try? backgroundContext.setQueryGenerationFrom(.current)
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
try? container.viewContext.setQueryGenerationFrom(.current)
} }
func save(_ context: NSManagedObjectContext? = nil) { func save(_ context: NSManagedObjectContext? = nil) {

View file

@ -34,9 +34,9 @@ extension String {
return result return result
} }
static func ==(lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedSame } static func == (lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedSame }
static func <(lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedAscending } static func < (lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedAscending }
static func <=(lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) != .orderedDescending } static func <= (lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) != .orderedDescending }
static func >(lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedDescending } static func > (lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) == .orderedDescending }
static func >=(lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) != .orderedAscending } static func >= (lhs: String, rhs: String) -> Bool { lhs.compare(toVersion: rhs) != .orderedAscending }
} }

View file

@ -22,7 +22,6 @@ struct AboutView: View {
ListRowTextView(leftText: "Version", rightText: UIApplication.shared.appVersion) ListRowTextView(leftText: "Version", rightText: UIApplication.shared.appVersion)
ListRowTextView(leftText: "Build number", rightText: UIApplication.shared.appBuild) ListRowTextView(leftText: "Build number", rightText: UIApplication.shared.appBuild)
ListRowTextView(leftText: "Build type", rightText: UIApplication.shared.buildType) ListRowTextView(leftText: "Build type", rightText: UIApplication.shared.buildType)
ListRowLinkView(text: "Donate!", link: "https://ko-fi.com/kingbri")
ListRowLinkView(text: "Discord server", link: "https://discord.gg/sYQxnuD7Fj") ListRowLinkView(text: "Discord server", link: "https://discord.gg/sYQxnuD7Fj")
ListRowLinkView(text: "GitHub repository", link: "https://github.com/bdashore3/Ferrite") ListRowLinkView(text: "GitHub repository", link: "https://github.com/bdashore3/Ferrite")
} }

View file

@ -21,11 +21,11 @@ struct IndeterminateProgressView: View {
.foregroundColor(Color.accentColor) .foregroundColor(Color.accentColor)
.frame(width: reader.size.width * 0.26, height: 6) .frame(width: reader.size.width * 0.26, height: 6)
.clipShape(Capsule()) .clipShape(Capsule())
.offset(x: -reader.size.width * 0.6, y: 0) .offset(x: -reader.size.width * 0.6, y: 0)
.offset(x: reader.size.width * 1.2 * self.offset, y: 0) .offset(x: reader.size.width * 1.2 * self.offset, y: 0)
.animation(.default.repeatForever().speed(0.5), value: self.offset) .animation(.default.repeatForever().speed(0.5), value: self.offset)
.onAppear{ .onAppear {
withAnimation { withAnimation {
self.offset = 1 self.offset = 1
} }

View file

@ -101,7 +101,8 @@ struct SettingsView: View {
NavigationLink("Version history", destination: SettingsAppVersionView()) NavigationLink("Version history", destination: SettingsAppVersionView())
} }
Section { Section(header: Text("Information")) {
ListRowLinkView(text: "Donate", link: "https://ko-fi.com/kingbri")
ListRowLinkView(text: "Report issues", link: "https://github.com/bdashore3/Ferrite/issues") ListRowLinkView(text: "Report issues", link: "https://github.com/bdashore3/Ferrite/issues")
NavigationLink("About", destination: AboutView()) NavigationLink("About", destination: AboutView())
} }