Verifies StoreApp.isPledged status when updating source

This commit is contained in:
Riley Testut
2023-11-20 14:06:04 -06:00
committed by Magesh K
parent 47b69b40aa
commit 91ea34110b
3 changed files with 71 additions and 1 deletions

View File

@@ -182,6 +182,12 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
@NSManaged public private(set) var loggedErrors: NSSet /* Set<LoggedError> */ // Use NSSet to avoid eagerly fetching values.
/* Non-Core Data Properties */
// Used to set isPledged after fetching source.
public var _tierIDs: Set<String>?
public var _rewardID: String?
@nonobjc public var source: Source? {
set {
self._source = newValue
@@ -420,6 +426,9 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
// No conditions, so default to pledgeAmount of 0 to simplify logic.
self._pledgeAmount = 0 as NSDecimalNumber
}
self._tierIDs = patreon.tiers
self._rewardID = patreon.benefit
}
else
{
@@ -427,6 +436,9 @@ public class StoreApp: NSManagedObject, Decodable, Fetchable
self.isHiddenWithoutPledge = false
self._pledgeAmount = nil
self.pledgeCurrency = nil
self._tierIDs = nil
self._rewardID = nil
}
}
catch