[in_app_purchase] Added serviceTimeout code (#3287)
diff --git a/packages/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/CHANGELOG.md
index 0a5794f..d712440 100644
--- a/packages/in_app_purchase/CHANGELOG.md
+++ b/packages/in_app_purchase/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.3.5
+
+* [Android] Fixed: added support for the SERVICE_TIMEOUT (-3) response code.
+
## 0.3.4+18
* Fix outdated links across a number of markdown files ([#3276](https://github.com/flutter/plugins/pull/3276))
diff --git a/packages/in_app_purchase/lib/src/billing_client_wrappers/billing_client_wrapper.dart b/packages/in_app_purchase/lib/src/billing_client_wrappers/billing_client_wrapper.dart
index 0c8b348..2aa91d9 100644
--- a/packages/in_app_purchase/lib/src/billing_client_wrappers/billing_client_wrapper.dart
+++ b/packages/in_app_purchase/lib/src/billing_client_wrappers/billing_client_wrapper.dart
@@ -314,6 +314,11 @@
// WARNING: Changes to this class need to be reflected in our generated code.
// Run `flutter packages pub run build_runner watch` to rebuild and watch for
// further changes.
+
+ /// The request has reached the maximum timeout before Google Play responds.
+ @JsonValue(-3)
+ serviceTimeout,
+
/// The requested feature is not supported by Play Store on the current device.
@JsonValue(-2)
featureNotSupported,
diff --git a/packages/in_app_purchase/lib/src/billing_client_wrappers/enum_converters.g.dart b/packages/in_app_purchase/lib/src/billing_client_wrappers/enum_converters.g.dart
index 899304b..947700d 100644
--- a/packages/in_app_purchase/lib/src/billing_client_wrappers/enum_converters.g.dart
+++ b/packages/in_app_purchase/lib/src/billing_client_wrappers/enum_converters.g.dart
@@ -43,6 +43,7 @@
}
const _$BillingResponseEnumMap = {
+ BillingResponse.serviceTimeout: -3,
BillingResponse.featureNotSupported: -2,
BillingResponse.serviceDisconnected: -1,
BillingResponse.ok: 0,
diff --git a/packages/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/pubspec.yaml
index 5e5ef24..883f8c3 100644
--- a/packages/in_app_purchase/pubspec.yaml
+++ b/packages/in_app_purchase/pubspec.yaml
@@ -1,7 +1,7 @@
name: in_app_purchase
description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.
homepage: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase
-version: 0.3.4+18
+version: 0.3.5
dependencies:
async: ^2.0.8
diff --git a/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart b/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart
index 54f7c3e..eee33a6 100644
--- a/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart
+++ b/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart
@@ -39,6 +39,24 @@
});
});
+ // Make sure that the enum values are supported and that the converter call
+ // does not fail
+ test('response states', () async {
+ BillingResponseConverter converter = BillingResponseConverter();
+ converter.fromJson(-3);
+ converter.fromJson(-2);
+ converter.fromJson(-1);
+ converter.fromJson(0);
+ converter.fromJson(1);
+ converter.fromJson(2);
+ converter.fromJson(3);
+ converter.fromJson(4);
+ converter.fromJson(5);
+ converter.fromJson(6);
+ converter.fromJson(7);
+ converter.fromJson(8);
+ });
+
group('startConnection', () {
final String methodName =
'BillingClient#startConnection(BillingClientStateListener)';