@@ -17,7 +17,7 @@ @interface InAppPurchasePlugin ()
1717
1818// After querying the product, the available products will be saved in the map to be used
1919// for purchase.
20- @property (copy , nonatomic ) NSMutableDictionary *productsCache;
20+ @property (strong , nonatomic ) NSMutableDictionary *productsCache;
2121
2222// Call back channel to dart used for when a listener function is triggered.
2323@property (strong , nonatomic ) FlutterMethodChannel *callbackChannel;
@@ -40,19 +40,21 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
4040}
4141
4242- (instancetype )initWithReceiptManager : (FIAPReceiptManager *)receiptManager {
43- self = [self init ];
44- self.receiptManager = receiptManager;
43+ self = [super init ];
44+ _receiptManager = receiptManager;
45+ _requestHandlers = [NSMutableSet new ];
46+ _productsCache = [NSMutableDictionary new ];
4547 return self;
4648}
4749
4850- (instancetype )initWithRegistrar : (NSObject <FlutterPluginRegistrar> *)registrar {
4951 self = [self initWithReceiptManager: [FIAPReceiptManager new ]];
50- self. registrar = registrar;
51- self. registry = [registrar textures ];
52- self. messenger = [registrar messenger ];
52+ _registrar = registrar;
53+ _registry = [registrar textures ];
54+ _messenger = [registrar messenger ];
5355
5456 __weak typeof (self) weakSelf = self;
55- self. paymentQueueHandler =
57+ _paymentQueueHandler =
5658 [[FIAPaymentQueueHandler alloc ] initWithQueue: [SKPaymentQueue defaultQueue ]
5759 transactionsUpdated: ^(NSArray <SKPaymentTransaction *> *_Nonnull transactions) {
5860 [weakSelf handleTransactionsUpdated: transactions];
@@ -72,7 +74,7 @@ - (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar
7274 updatedDownloads: ^void (NSArray <SKDownload *> *_Nonnull downloads) {
7375 [weakSelf updatedDownloads: downloads];
7476 }];
75- self. callbackChannel =
77+ _callbackChannel =
7678 [FlutterMethodChannel methodChannelWithName: @" plugins.flutter.io/in_app_purchase_callback"
7779 binaryMessenger: [registrar messenger ]];
7880 return self;
@@ -320,20 +322,4 @@ - (SKReceiptRefreshRequest *)getRefreshReceiptRequest:(NSDictionary *)properties
320322 return [[SKReceiptRefreshRequest alloc ] initWithReceiptProperties: properties];
321323}
322324
323- #pragma mark - getter
324-
325- - (NSSet *)requestHandlers {
326- if (!_requestHandlers) {
327- _requestHandlers = [NSMutableSet new ];
328- }
329- return _requestHandlers;
330- }
331-
332- - (NSMutableDictionary *)productsCache {
333- if (!_productsCache) {
334- _productsCache = [NSMutableDictionary new ];
335- }
336- return _productsCache;
337- }
338-
339325@end
0 commit comments