mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[in_app_purchase] fix skerror nullability (#6139)
Should fix https://github.com/flutter/flutter/issues/143177
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 0.3.11
|
||||||
|
|
||||||
|
* Fixes SKError.userInfo not being nullable.
|
||||||
|
|
||||||
## 0.3.10
|
## 0.3.10
|
||||||
|
|
||||||
* Converts `startProductRequest()`, `finishTransaction()`, `restoreTransactions()`, `presentCodeRedemptionSheet()` to pigeon.
|
* Converts `startProductRequest()`, `finishTransaction()`, `restoreTransactions()`, `presentCodeRedemptionSheet()` to pigeon.
|
||||||
|
@ -146,10 +146,10 @@ typedef NS_ENUM(NSUInteger, SKSubscriptionPeriodUnitMessage) {
|
|||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
+ (instancetype)makeWithCode:(NSInteger)code
|
+ (instancetype)makeWithCode:(NSInteger)code
|
||||||
domain:(NSString *)domain
|
domain:(NSString *)domain
|
||||||
userInfo:(NSDictionary<NSString *, id> *)userInfo;
|
userInfo:(nullable NSDictionary<NSString *, id> *)userInfo;
|
||||||
@property(nonatomic, assign) NSInteger code;
|
@property(nonatomic, assign) NSInteger code;
|
||||||
@property(nonatomic, copy) NSString *domain;
|
@property(nonatomic, copy) NSString *domain;
|
||||||
@property(nonatomic, copy) NSDictionary<NSString *, id> *userInfo;
|
@property(nonatomic, copy, nullable) NSDictionary<NSString *, id> *userInfo;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SKPaymentDiscountMessage : NSObject
|
@interface SKPaymentDiscountMessage : NSObject
|
||||||
|
@ -218,7 +218,7 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
|
|||||||
@implementation SKErrorMessage
|
@implementation SKErrorMessage
|
||||||
+ (instancetype)makeWithCode:(NSInteger)code
|
+ (instancetype)makeWithCode:(NSInteger)code
|
||||||
domain:(NSString *)domain
|
domain:(NSString *)domain
|
||||||
userInfo:(NSDictionary<NSString *, id> *)userInfo {
|
userInfo:(nullable NSDictionary<NSString *, id> *)userInfo {
|
||||||
SKErrorMessage *pigeonResult = [[SKErrorMessage alloc] init];
|
SKErrorMessage *pigeonResult = [[SKErrorMessage alloc] init];
|
||||||
pigeonResult.code = code;
|
pigeonResult.code = code;
|
||||||
pigeonResult.domain = domain;
|
pigeonResult.domain = domain;
|
||||||
|
@ -195,14 +195,14 @@ class SKErrorMessage {
|
|||||||
SKErrorMessage({
|
SKErrorMessage({
|
||||||
required this.code,
|
required this.code,
|
||||||
required this.domain,
|
required this.domain,
|
||||||
required this.userInfo,
|
this.userInfo,
|
||||||
});
|
});
|
||||||
|
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
String domain;
|
String domain;
|
||||||
|
|
||||||
Map<String?, Object?> userInfo;
|
Map<String?, Object?>? userInfo;
|
||||||
|
|
||||||
Object encode() {
|
Object encode() {
|
||||||
return <Object?>[
|
return <Object?>[
|
||||||
@ -217,7 +217,7 @@ class SKErrorMessage {
|
|||||||
return SKErrorMessage(
|
return SKErrorMessage(
|
||||||
code: result[0]! as int,
|
code: result[0]! as int,
|
||||||
domain: result[1]! as String,
|
domain: result[1]! as String,
|
||||||
userInfo: (result[2] as Map<Object?, Object?>?)!.cast<String?, Object?>(),
|
userInfo: (result[2] as Map<Object?, Object?>?)?.cast<String?, Object?>(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,10 @@ class SKError {
|
|||||||
|
|
||||||
/// Converts [SKErrorMessage] into the dart equivalent
|
/// Converts [SKErrorMessage] into the dart equivalent
|
||||||
static SKError convertFromPigeon(SKErrorMessage msg) {
|
static SKError convertFromPigeon(SKErrorMessage msg) {
|
||||||
return SKError(code: msg.code, domain: msg.domain, userInfo: msg.userInfo);
|
return SKError(
|
||||||
|
code: msg.code,
|
||||||
|
domain: msg.domain,
|
||||||
|
userInfo: msg.userInfo ?? <String, Object>{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class SKErrorMessage {
|
|||||||
|
|
||||||
final int code;
|
final int code;
|
||||||
final String domain;
|
final String domain;
|
||||||
final Map<String?, Object?> userInfo;
|
final Map<String?, Object?>? userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SKPaymentDiscountMessage {
|
class SKPaymentDiscountMessage {
|
||||||
|
@ -2,7 +2,7 @@ name: in_app_purchase_storekit
|
|||||||
description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework.
|
description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework.
|
||||||
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit
|
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
|
||||||
version: 0.3.10
|
version: 0.3.11
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.2.3
|
sdk: ^3.2.3
|
||||||
|
@ -95,4 +95,13 @@ void main() {
|
|||||||
SkProductResponseWrapper.convertFromPigeon(msg);
|
SkProductResponseWrapper.convertFromPigeon(msg);
|
||||||
expect(convertedWrapper, productResponse);
|
expect(convertedWrapper, productResponse);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test SKerror pigeon converter', () {
|
||||||
|
final SKErrorMessage msg = SKErrorMessage(code: 99, domain: 'domain');
|
||||||
|
final SKError wrapper = SKError.convertFromPigeon(msg);
|
||||||
|
|
||||||
|
expect(wrapper.code, 99);
|
||||||
|
expect(wrapper.domain, 'domain');
|
||||||
|
expect(wrapper.userInfo, <String, Object>{});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user