mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 16:23:32 +01:00
recreate legacy project for testing
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum ALTPatreonBenefitType: String, Codable, Equatable, CaseIterable, Hashable {
|
||||
case betaAccess = "7585304"
|
||||
case credits = "8490206"
|
||||
}
|
||||
|
||||
extension PatreonAPI {
|
||||
struct BenefitResponse: Decodable {
|
||||
var id: String
|
||||
|
||||
@@ -28,6 +28,29 @@ public enum ALTAppPermissionType: Int, CaseIterable {
|
||||
case siri
|
||||
case motion
|
||||
|
||||
public init?(rawValue: String) {
|
||||
switch rawValue {
|
||||
case "photos": self = .photos
|
||||
case "camera": self = .camera
|
||||
case "location": self = .location
|
||||
case "contacts": self = .contacts
|
||||
case "reminders": self = .reminders
|
||||
case "appleMusic", "music": self = .appleMusic
|
||||
case "microphone": self = .microphone
|
||||
case "speechRecognition", "speech-recognition": self = .speechRecognition
|
||||
case "backgroundAudio", "background-audio": self = .backgroundAudio
|
||||
case "backgroundFetch", "background-fetch": self = .backgroundFetch
|
||||
case "bluetooth": self = .bluetooth
|
||||
case "network": self = .network
|
||||
case "calendars": self = .calendars
|
||||
case "touchID", "touchid": self = .touchID
|
||||
case "faceID", "faceid": self = .faceID
|
||||
case "siri": self = .siri
|
||||
case "motion": self = .motion
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
|
||||
public var stringValue: String {
|
||||
switch self {
|
||||
case .photos:
|
||||
|
||||
14
Sources/SideStoreCore/Types/ALTPatreonBenefitType.swift
Normal file
14
Sources/SideStoreCore/Types/ALTPatreonBenefitType.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// ALTPatreonBenefitType.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by Joseph Mattiello on 2/28/23.
|
||||
// Copyright © 2023 Joseph Mattiello. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum ALTPatreonBenefitType: String, RawRepresentable {
|
||||
case betaAccess = "1186336"
|
||||
case credits = "1186340"
|
||||
}
|
||||
@@ -12,6 +12,13 @@ import Foundation
|
||||
public enum ALTSourceUserInfoKey: Int, CaseIterable {
|
||||
case patreonAccessToken
|
||||
|
||||
public init?(rawValue: String) {
|
||||
switch rawValue {
|
||||
case Self.patreonAccessToken.stringValue: self = .patreonAccessToken
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
|
||||
public var stringValue: String {
|
||||
switch self {
|
||||
case .patreonAccessToken:
|
||||
|
||||
Reference in New Issue
Block a user