mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Adds (Managed)Patron Core Data entity
Will be used to cache Friend Zone patrons separately than the existing PatreonAccount entity.
This commit is contained in:
@@ -96,6 +96,15 @@
|
||||
</uniquenessConstraint>
|
||||
</uniquenessConstraints>
|
||||
</entity>
|
||||
<entity name="Patron" representedClassName="ManagedPatron" syncable="YES">
|
||||
<attribute name="identifier" attributeType="String"/>
|
||||
<attribute name="name" attributeType="String"/>
|
||||
<uniquenessConstraints>
|
||||
<uniquenessConstraint>
|
||||
<constraint value="identifier"/>
|
||||
</uniquenessConstraint>
|
||||
</uniquenessConstraints>
|
||||
</entity>
|
||||
<entity name="RefreshAttempt" representedClassName="RefreshAttempt" syncable="YES">
|
||||
<attribute name="date" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="errorDescription" optional="YES" attributeType="String"/>
|
||||
@@ -174,5 +183,6 @@
|
||||
<element name="Source" positionX="-45" positionY="99" width="128" height="133"/>
|
||||
<element name="StoreApp" positionX="-63" positionY="-18" width="128" height="343"/>
|
||||
<element name="Team" positionX="-45" positionY="81" width="128" height="148"/>
|
||||
<element name="Patron" positionX="-36" positionY="153" width="128" height="59"/>
|
||||
</elements>
|
||||
</model>
|
||||
37
AltStoreCore/Model/ManagedPatron.swift
Normal file
37
AltStoreCore/Model/ManagedPatron.swift
Normal file
@@ -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<ManagedPatron>
|
||||
{
|
||||
return NSFetchRequest<ManagedPatron>(entityName: "Patron")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user