|
|
|
|
@ -115,7 +115,7 @@ import LeStorage |
|
|
|
|
fileprivate func _addPurchaseIfPossible(transaction: StoreKit.Transaction) throws { |
|
|
|
|
if self.purchases.hasLoadedFromServer { |
|
|
|
|
if self._purchaseById(transaction.originalID) == nil { |
|
|
|
|
let purchase: Purchase = transaction.purchase() |
|
|
|
|
let purchase: Purchase = try transaction.purchase() |
|
|
|
|
try self.purchases.addOrUpdate(instance: purchase) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -157,7 +157,7 @@ import LeStorage |
|
|
|
|
|
|
|
|
|
func userFilteredPurchases() -> [StoreKit.Transaction] { |
|
|
|
|
// Logger.log("self.purchasedTransactions = \(self.purchasedTransactions.count)") |
|
|
|
|
guard let currentUserUUID: UUID = Store.main.currentUserUUID else { |
|
|
|
|
guard let userId = Store.main.userId, let currentUserUUID: UUID = UUID(uuidString: userId) else { |
|
|
|
|
return [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -253,8 +253,10 @@ struct PurchaseRow: Identifiable { |
|
|
|
|
|
|
|
|
|
fileprivate extension StoreKit.Transaction { |
|
|
|
|
|
|
|
|
|
func purchase() -> Purchase { |
|
|
|
|
let userId = Store.main.mandatoryUserUUID().uuidString |
|
|
|
|
func purchase() throws -> Purchase { |
|
|
|
|
guard let userId = Store.main.userId else { |
|
|
|
|
throw StoreError.missingUserId |
|
|
|
|
} |
|
|
|
|
return Purchase(user: userId, |
|
|
|
|
identifier: self.originalID, |
|
|
|
|
purchaseDate: self.purchaseDate, |
|
|
|
|
|