App builds in xcodeproj (todo widget)

This commit is contained in:
Joe Mattiello
2023-03-02 00:40:11 -05:00
parent 4c9c5b1a56
commit f49fa24743
49 changed files with 498 additions and 295 deletions

View File

@@ -10,6 +10,7 @@ import CoreData
import AltSign
import Roxas
import os.log
private extension CFNotificationName {
static let willAccessDatabase = CFNotificationName("com.rileytestut.AltStore.WillAccessDatabase" as CFString)
@@ -117,7 +118,7 @@ public extension DatabaseManager {
completionHandler(nil)
} catch {
print("Failed to save when signing out.", error)
os_log("Failed to save when signing out. %@", type: .error , error.localizedDescription )
completionHandler(error)
}
}
@@ -265,7 +266,7 @@ private extension DatabaseManager {
try FileManager.default.copyItem(at: temporaryFileURL, to: fileURL, shouldReplace: true)
} catch {
print("Failed to copy AltStore app bundle to its proper location.", error)
os_log("Failed to copy AltStore app bundle to its proper location. %@", type: .error , error.localizedDescription )
}
}
}
@@ -349,7 +350,7 @@ private extension DatabaseManager {
finish(.success(()))
} catch {
print("Failed to migrate database to app group:", error)
os_log("Failed to migrate database to app group: %@", type: .error , error.localizedDescription )
finish(.failure(error))
}
}

View File

@@ -9,6 +9,7 @@
import CoreData
import Roxas
import os.log
open class MergePolicy: RSTRelationshipPreservingMergePolicy {
override open func resolve(constraintConflicts conflicts: [NSConstraintConflict]) throws {
@@ -40,7 +41,10 @@ open class MergePolicy: RSTRelationshipPreservingMergePolicy {
if let primaryAppVersion = conflictingAppVersions.first(where: { $0.latestVersionApp?.latestVersion == $0 }),
let secondaryAppVersion = conflictingAppVersions.first(where: { $0 != primaryAppVersion }) {
secondaryAppVersion.managedObjectContext?.delete(secondaryAppVersion)
print("[ALTLog] Resolving AppVersion context-level conflict. Most likely due to migrating from pre-AppVersion model version.", primaryAppVersion)
os_log(
"[ALTLog] Resolving AppVersion context-level conflict. Most likely due to migrating from pre-AppVersion model version. %@",
type: .error ,
primaryAppVersion )
}
default:
@@ -65,7 +69,11 @@ open class MergePolicy: RSTRelationshipPreservingMergePolicy {
if let contextApp = conflict.conflictingObjects.first as? StoreApp {
let contextVersions = Set(contextApp._versions.lazy.compactMap { $0 as? AppVersion }.map { $0.version })
for case let appVersion as AppVersion in databaseObject._versions where !contextVersions.contains(appVersion.version) {
print("[ALTLog] Deleting cached app version: \(appVersion.appBundleID + "_" + appVersion.version), not in:", contextApp.versions.map { $0.appBundleID + "_" + $0.version })
os_log("[ALTLog] Deleting cached app version: %@_%@, not in: %@",
type: .info,
appVersion.appBundleID,
appVersion.version,
contextApp.versions.map { $0.appBundleID + "_" + $0.version })
appVersion.managedObjectContext?.delete(appVersion)
}
}

View File

@@ -9,6 +9,7 @@
import AuthenticationServices
import CoreData
import Foundation
import os.log
private let clientID = "ZMx0EGUWe4TVWYXNZZwK_fbIK5jHFVWoUf1Qb-sqNXmT-YzAGwDPxxq7ak3_W5Q2"
private let clientSecret = "1hktsZB89QyN69cB4R0tu55R4TCPQGXxvebYUUh7Y-5TLSnRswuxs6OUjdJ74IJt"
@@ -242,7 +243,7 @@ public extension PatreonAPI {
try account.managedObjectContext?.save()
} catch {
print("Failed to fetch Patreon account.", error)
os_log("Failed to fetch Patreon account. %@", type: .error , error.localizedDescription)
}
}
}