recreate legacy project for testing

This commit is contained in:
Joe Mattiello
2023-03-01 08:04:31 -05:00
parent 493b3783f0
commit f3a70e1e47
31 changed files with 3911 additions and 28 deletions

View File

@@ -95,7 +95,12 @@ public class AppPermission: NSManagedObject, Decodable, Fetchable {
usageDescription = try container.decode(String.self, forKey: .usageDescription)
let rawType = try container.decode(String.self, forKey: .type)
type = ALTAppPermissionType(rawValue: rawType)
guard let type = ALTAppPermissionType(rawValue: rawType) else {
throw DecodingError.dataCorrupted(
DecodingError.Context(codingPath: [CodingKeys.type],
debugDescription: "Invalid value for `ALTAppPermissionType` \"\(rawType)\""))
}
self.type = type
} catch {
if let context = managedObjectContext {
context.delete(self)

View File

@@ -172,7 +172,7 @@ public extension DatabaseManager {
private extension DatabaseManager {
func prepareDatabase(completionHandler: @escaping (Result<Void, Error>) -> Void) {
guard !Bundle.isAppExtension else { return completionHandler(.success(())) }
guard !Bundle.isAppExtension() else { return completionHandler(.success(())) }
let context = persistentContainer.newBackgroundContext()
context.performAndWait {

View File

@@ -226,7 +226,12 @@ public class Source: NSManagedObject, Fetchable, Decodable {
identifier = try container.decode(String.self, forKey: .identifier)
let userInfo = try container.decodeIfPresent([String: String].self, forKey: .userInfo)
self.userInfo = userInfo?.reduce(into: [:]) { $0[ALTSourceUserInfoKey($1.key)] = $1.value }
self.userInfo = userInfo?.reduce(into: [:]) {
guard let infoKey: ALTSourceUserInfoKey = ALTSourceUserInfoKey(rawValue: $1.key) else {
return
}
$0[infoKey] = $1.value
}
let apps = try container.decodeIfPresent([StoreApp].self, forKey: .apps) ?? []
let appsByID = Dictionary(apps.map { ($0.bundleIdentifier, $0) }, uniquingKeysWith: { a, _ in a })

View File

@@ -13,14 +13,23 @@ import AltSign
import Roxas
public extension StoreApp {
#if ALPHA
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#elseif BETA
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#else
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#endif
#if SWIFT_PACKAGE
#if ALPHA
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#elseif BETA
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#else
static let altstoreAppID = Bundle.main.Info.appbundleIdentifier
#endif
#else
#if ALPHA
static let altstoreAppID = Bundle.Info.appbundleIdentifier
#elseif BETA
static let altstoreAppID = Bundle.Info.appbundleIdentifier
#else
static let altstoreAppID = Bundle.Info.appbundleIdentifier
#endif
#endif
static let dolphinAppID = "me.oatmealdome.dolphinios-njb"
}