diff --git a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md index cfb4faa74074..19281b518933 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md @@ -1,6 +1,7 @@ -## NEXT +## 0.3.18 * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +* Changes the `localizedDescription` field of `SKProductMessage` to allow for null values ## 0.3.17+3 diff --git a/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.h b/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.h index 79bdffc76afe..7775d8d47ba8 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.h +++ b/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.h @@ -186,7 +186,7 @@ typedef NS_ENUM(NSUInteger, SKSubscriptionPeriodUnitMessage) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithProductIdentifier:(NSString *)productIdentifier localizedTitle:(NSString *)localizedTitle - localizedDescription:(NSString *)localizedDescription + localizedDescription:(nullable NSString *)localizedDescription priceLocale:(SKPriceLocaleMessage *)priceLocale subscriptionGroupIdentifier:(nullable NSString *)subscriptionGroupIdentifier price:(NSString *)price @@ -196,7 +196,7 @@ typedef NS_ENUM(NSUInteger, SKSubscriptionPeriodUnitMessage) { discounts:(nullable NSArray *)discounts; @property(nonatomic, copy) NSString *productIdentifier; @property(nonatomic, copy) NSString *localizedTitle; -@property(nonatomic, copy) NSString *localizedDescription; +@property(nonatomic, copy, nullable) NSString *localizedDescription; @property(nonatomic, strong) SKPriceLocaleMessage *priceLocale; @property(nonatomic, copy, nullable) NSString *subscriptionGroupIdentifier; @property(nonatomic, copy) NSString *price; diff --git a/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.m b/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.m index f013f720511c..50a358479fa3 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.m +++ b/packages/in_app_purchase/in_app_purchase_storekit/darwin/Classes/messages.g.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v16.0.4), do not edit directly. +// Autogenerated from Pigeon (v16.0.5), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "messages.g.h" @@ -333,7 +333,7 @@ @implementation SKProductMessage + (instancetype) makeWithProductIdentifier:(NSString *)productIdentifier localizedTitle:(NSString *)localizedTitle - localizedDescription:(NSString *)localizedDescription + localizedDescription:(nullable NSString *)localizedDescription priceLocale:(SKPriceLocaleMessage *)priceLocale subscriptionGroupIdentifier:(nullable NSString *)subscriptionGroupIdentifier price:(NSString *)price diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/messages.g.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/messages.g.dart index e136e05b5d1e..a53187575e1d 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/messages.g.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/messages.g.dart @@ -322,7 +322,7 @@ class SKProductMessage { SKProductMessage({ required this.productIdentifier, required this.localizedTitle, - required this.localizedDescription, + this.localizedDescription, required this.priceLocale, this.subscriptionGroupIdentifier, required this.price, @@ -335,7 +335,7 @@ class SKProductMessage { String localizedTitle; - String localizedDescription; + String? localizedDescription; SKPriceLocaleMessage priceLocale; @@ -368,7 +368,7 @@ class SKProductMessage { return SKProductMessage( productIdentifier: result[0]! as String, localizedTitle: result[1]! as String, - localizedDescription: result[2]! as String, + localizedDescription: result[2] as String?, priceLocale: SKPriceLocaleMessage.decode(result[3]! as List), subscriptionGroupIdentifier: result[4] as String?, price: result[5]! as String, diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_product_wrapper.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_product_wrapper.dart index dfd8c3083fac..ff49758107dc 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_product_wrapper.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/store_kit_wrappers/sk_product_wrapper.dart @@ -550,7 +550,7 @@ class SKProductWrapper { return SKProductWrapper( productIdentifier: msg.productIdentifier, localizedTitle: msg.localizedTitle, - localizedDescription: msg.localizedDescription, + localizedDescription: msg.localizedDescription ?? '', priceLocale: SKPriceLocaleWrapper.convertFromPigeon(msg.priceLocale), price: msg.price, subscriptionGroupIdentifier: msg.subscriptionGroupIdentifier, diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pigeons/messages.dart b/packages/in_app_purchase/in_app_purchase_storekit/pigeons/messages.dart index 6351c889cc38..07c1c3d2d3b6 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pigeons/messages.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/pigeons/messages.dart @@ -131,9 +131,9 @@ class SKProductMessage { const SKProductMessage( {required this.productIdentifier, required this.localizedTitle, - required this.localizedDescription, required this.priceLocale, required this.price, + this.localizedDescription, this.subscriptionGroupIdentifier, this.subscriptionPeriod, this.introductoryPrice, @@ -141,7 +141,10 @@ class SKProductMessage { final String productIdentifier; final String localizedTitle; - final String localizedDescription; + // This field should be nullable to handle occasional nulls in the StoreKit + // object despite the the StoreKit header showing that it is nonnullable + // https://github.com/flutter/flutter/issues/154047 + final String? localizedDescription; final SKPriceLocaleMessage priceLocale; final String? subscriptionGroupIdentifier; final String price; diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index 3c2affcdb7e4..2dad81edd9e1 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -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.17+3 +version: 0.3.18 environment: sdk: ^3.3.0 diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 082d62939d90..973d9df5fe73 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -33,7 +33,7 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { void reset() { transactionList = []; receiptData = 'dummy base64data'; - validProductIDs = {'123', '456'}; + validProductIDs = {'123', '456', '789'}; validProducts = {}; for (final String validID in validProductIDs) { final Map productWrapperMap = @@ -42,6 +42,9 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { if (validID == '456') { productWrapperMap['priceLocale'] = buildLocaleMap(noSymbolLocale); } + if (validID == '789') { + productWrapperMap['localizedDescription'] = null; + } validProducts[validID] = SKProductWrapper.fromJson(productWrapperMap); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart index 56dc89fb190c..2da0e47070ac 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart @@ -44,12 +44,14 @@ void main() { test('should get product list and correct invalid identifiers', () async { final InAppPurchaseStoreKitPlatform connection = InAppPurchaseStoreKitPlatform(); - final ProductDetailsResponse response = - await connection.queryProductDetails({'123', '456', '789'}); + final ProductDetailsResponse response = await connection + .queryProductDetails({'123', '456', '789', '999'}); final List products = response.productDetails; expect(products.first.id, '123'); expect(products[1].id, '456'); - expect(response.notFoundIDs, ['789']); + expect(products[2].id, '789'); + expect(products[2].description, ''); + expect(response.notFoundIDs, ['999']); expect(response.error, isNull); expect(response.productDetails.first.currencySymbol, r'$'); expect(response.productDetails[1].currencySymbol, 'EUR');