Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit eaa6e54

Browse files
committed
[in_app_purchase] Fix iOS build warning
1 parent 573c9ff commit eaa6e54

4 files changed

Lines changed: 13 additions & 26 deletions

File tree

packages/in_app_purchase/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 0.2.1+5
22

33
* Define clang module for iOS.
4+
* Fix iOS build warning
45

56
## 0.2.1+4
67

packages/in_app_purchase/ios/Classes/InAppPurchasePlugin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
@property(strong, nonatomic) FIAPaymentQueueHandler *paymentQueueHandler;
1212

13-
- (instancetype)initWithReceiptManager:(FIAPReceiptManager *)receiptManager;
13+
- (instancetype)initWithReceiptManager:(FIAPReceiptManager *)receiptManager NS_DESIGNATED_INITIALIZER;
14+
- (instancetype)init NS_UNAVAILABLE;
1415

1516
@end

packages/in_app_purchase/ios/Classes/InAppPurchasePlugin.m

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

script/lint_darwin_plugins.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function lint_package() {
2222
local skip_analysis_packages=(
2323
"camera.podspec" # https://github.com/flutter/flutter/issues/42673
2424
"image_picker.podspec" # https://github.com/flutter/flutter/issues/42678
25-
"in_app_purchase.podspec" # https://github.com/flutter/flutter/issues/42679
2625
)
2726
find "${package_dir}" -type f -name "*\.podspec" | while read podspec; do
2827
local podspecBasename=$(basename "${podspec}")

0 commit comments

Comments
 (0)