File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 3434 */
3535- (void )removeTransactions ;
3636
37+ /* * Remove transactions from user defaults via specific ProductIdentifier.
38+ */
39+ - (void )removeTransactionsForProductIdentifier : (NSString *)productIdentifier ;
40+
3741/* * Consume the given product if available. Intended for consumable products.
3842 @param productIdentifier Identifier of the product to be consumed.
3943 @return YES if the product was consumed, NO otherwise.
Original file line number Diff line number Diff line change @@ -53,6 +53,15 @@ - (void)removeTransactions
5353 [defaults synchronize ];
5454}
5555
56+ - (void )removeTransactionsForProductIdentifier : (NSString *)productIdentifier {
57+ NSUserDefaults *defaults = [self userDefaults ];
58+ NSDictionary *purchases = [defaults objectForKey: RMStoreTransactionsUserDefaultsKey] ? : @{};
59+ NSMutableDictionary *updatedPurchases = [NSMutableDictionary dictionaryWithDictionary: purchases];
60+ [updatedPurchases removeObjectForKey: productIdentifier];
61+ [defaults setObject: updatedPurchases forKey: RMStoreTransactionsUserDefaultsKey];
62+ [defaults synchronize ];
63+ }
64+
5665- (BOOL )consumeProductOfIdentifier : (NSString *)productIdentifier
5766{
5867 NSUserDefaults *defaults = [self userDefaults ];
You can’t perform that action at this time.
0 commit comments