From aa8dd80e5459d5469bebe46e69d7ddce7929ed0f Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 18 Apr 2022 15:25:27 -0700 Subject: [PATCH] Adds (Managed)Patron Core Data entity Will be used to cache Friend Zone patrons separately than the existing PatreonAccount entity. --- AltStore.xcodeproj/project.pbxproj | 4 ++ .../AltStore 9.xcdatamodel/contents | 10 +++++ AltStoreCore/Model/ManagedPatron.swift | 37 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 AltStoreCore/Model/ManagedPatron.swift diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 49d88e79..e187cb4b 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -357,6 +357,7 @@ D57F2C9426E01BC700B9FA39 /* UIDevice+Vibration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */; }; D58D5F2E26DFE68E00E55E38 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = D58D5F2D26DFE68E00E55E38 /* LaunchAtLogin */; }; D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D593F1932717749A006E82DE /* PatchAppOperation.swift */; }; + D5CA0C4B280E141900469595 /* ManagedPatron.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA0C4A280E141900469595 /* ManagedPatron.swift */; }; D5DAE0942804B0B80034D8D4 /* ScreenshotProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DAE0932804B0B80034D8D4 /* ScreenshotProcessor.swift */; }; D5DAE0962804DF430034D8D4 /* UpdatePatronsOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5DAE0952804DF430034D8D4 /* UpdatePatronsOperation.swift */; }; D5E1E7C128077DE90016FC96 /* FetchTrustedSourcesOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5E1E7C028077DE90016FC96 /* FetchTrustedSourcesOperation.swift */; }; @@ -819,6 +820,7 @@ D57F2C9026E0070200B9FA39 /* EnableJITOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnableJITOperation.swift; sourceTree = ""; }; D57F2C9326E01BC700B9FA39 /* UIDevice+Vibration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDevice+Vibration.swift"; sourceTree = ""; }; D593F1932717749A006E82DE /* PatchAppOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchAppOperation.swift; sourceTree = ""; }; + D5CA0C4A280E141900469595 /* ManagedPatron.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManagedPatron.swift; sourceTree = ""; }; D5DAE0932804B0B80034D8D4 /* ScreenshotProcessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenshotProcessor.swift; sourceTree = ""; }; D5DAE0952804DF430034D8D4 /* UpdatePatronsOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatePatronsOperation.swift; sourceTree = ""; }; D5E1E7C028077DE90016FC96 /* FetchTrustedSourcesOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchTrustedSourcesOperation.swift; sourceTree = ""; }; @@ -1267,6 +1269,7 @@ BF66EEC52501AECA007EE018 /* MergePolicy.swift */, BF66EEBF2501AECA007EE018 /* NewsItem.swift */, BF66EEC82501AECA007EE018 /* PatreonAccount.swift */, + D5CA0C4A280E141900469595 /* ManagedPatron.swift */, BF66EEC32501AECA007EE018 /* RefreshAttempt.swift */, BF66EEC12501AECA007EE018 /* SecureValueTransformer.swift */, BF66EEAB2501AECA007EE018 /* Source.swift */, @@ -2483,6 +2486,7 @@ BFAECC572501B0A400528F27 /* ConnectionManager.swift in Sources */, BF66EE9D2501AEC1007EE018 /* AppProtocol.swift in Sources */, BFC712C42512D5F100AB5EBE /* XPCConnection.swift in Sources */, + D5CA0C4B280E141900469595 /* ManagedPatron.swift in Sources */, BF66EE8C2501AEB2007EE018 /* Keychain.swift in Sources */, BF66EED42501AECA007EE018 /* AltStore5ToAltStore6.xcmappingmodel in Sources */, BF66EE972501AEBC007EE018 /* ALTAppPermission.m in Sources */, diff --git a/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 9.xcdatamodel/contents b/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 9.xcdatamodel/contents index aa47e2ac..7589e6f7 100644 --- a/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 9.xcdatamodel/contents +++ b/AltStoreCore/Model/AltStore.xcdatamodeld/AltStore 9.xcdatamodel/contents @@ -96,6 +96,15 @@ + + + + + + + + + @@ -174,5 +183,6 @@ + \ No newline at end of file diff --git a/AltStoreCore/Model/ManagedPatron.swift b/AltStoreCore/Model/ManagedPatron.swift new file mode 100644 index 00000000..a482853a --- /dev/null +++ b/AltStoreCore/Model/ManagedPatron.swift @@ -0,0 +1,37 @@ +// +// ManagedPatron.swift +// AltStoreCore +// +// Created by Riley Testut on 4/18/22. +// Copyright © 2022 Riley Testut. All rights reserved. +// + +import CoreData + +@objc(ManagedPatron) +public class ManagedPatron: NSManagedObject, Fetchable +{ + @NSManaged public var name: String + @NSManaged public var identifier: String + + private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?) + { + super.init(entity: entity, insertInto: context) + } + + public init(patron: Patron, context: NSManagedObjectContext) + { + super.init(entity: ManagedPatron.entity(), insertInto: context) + + self.name = patron.name + self.identifier = patron.identifier + } +} + +public extension ManagedPatron +{ + @nonobjc class func fetchRequest() -> NSFetchRequest + { + return NSFetchRequest(entityName: "Patron") + } +}