Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.11

* Fixes SKError.userInfo not being nullable.

## 0.3.10

* Converts `startProductRequest()`, `finishTransaction()`, `restoreTransactions()`, `presentCodeRedemptionSheet()` to pigeon.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ typedef NS_ENUM(NSUInteger, SKSubscriptionPeriodUnitMessage) {
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithCode:(NSInteger)code
domain:(NSString *)domain
userInfo:(NSDictionary<NSString *, id> *)userInfo;
userInfo:(nullable NSDictionary<NSString *, id> *)userInfo;
@property(nonatomic, assign) NSInteger code;
@property(nonatomic, copy) NSString *domain;
@property(nonatomic, copy) NSDictionary<NSString *, id> *userInfo;
@property(nonatomic, copy, nullable) NSDictionary<NSString *, id> *userInfo;
@end

@interface SKPaymentDiscountMessage : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ - (NSArray *)toList {
@implementation SKErrorMessage
+ (instancetype)makeWithCode:(NSInteger)code
domain:(NSString *)domain
userInfo:(NSDictionary<NSString *, id> *)userInfo {
userInfo:(nullable NSDictionary<NSString *, id> *)userInfo {
SKErrorMessage *pigeonResult = [[SKErrorMessage alloc] init];
pigeonResult.code = code;
pigeonResult.domain = domain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,14 @@ class SKErrorMessage {
SKErrorMessage({
required this.code,
required this.domain,
required this.userInfo,
this.userInfo,
});

int code;

String domain;

Map<String?, Object?> userInfo;
Map<String?, Object?>? userInfo;

Object encode() {
return <Object?>[
Expand All @@ -217,7 +217,7 @@ class SKErrorMessage {
return SKErrorMessage(
code: result[0]! as int,
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?>(),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ class SKError {

/// Converts [SKErrorMessage] into the dart equivalent
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>{});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SKErrorMessage {

final int code;
final String domain;
final Map<String?, Object?> userInfo;
final Map<String?, Object?>? userInfo;
}

class SKPaymentDiscountMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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
version: 0.3.10
version: 0.3.11

environment:
sdk: ^3.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,13 @@ void main() {
SkProductResponseWrapper.convertFromPigeon(msg);
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>{});
});
}