diff --git a/CHANGELOG.md b/CHANGELOG.md index 22cc63b5..6ce61fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 2.0.0+8 +* Resolve [#100](https://github.com/dooboolab/flutter_inapp_purchase/issues/100). ## 2.0.0+7 * Resolve [#99](https://github.com/dooboolab/flutter_inapp_purchase/issues/99). ## 2.0.0+6 diff --git a/lib/flutter_inapp_purchase.dart b/lib/flutter_inapp_purchase.dart index b5fd83da..e82181ac 100644 --- a/lib/flutter_inapp_purchase.dart +++ b/lib/flutter_inapp_purchase.dart @@ -346,21 +346,16 @@ class FlutterInappPurchase { /// Acknowledge a purchase on `Android`. /// /// No effect on `iOS`, whose iap purchases are consumed at the time of purchase. - Future acknowledgePurchaseAndroid(String token, { String developerPayload }) async { + Future acknowledgePurchaseAndroid(String token, { String developerPayload }) async { if (_platform.isAndroid) { String result = await _channel.invokeMethod('acknowledgePurchase', { 'token': token, 'developerPayload': developerPayload, }); - if (result == null) { - return null; - } - - PurchaseResult decoded = json.decode(result); - return decoded; + return result; } else if (_platform.isIOS) { - return PurchaseResult(debugMessage: 'no-ops in ios'); + return 'no-ops in ios'; } throw PlatformException( code: _platform.operatingSystem, message: "platform not supported"); @@ -370,22 +365,16 @@ class FlutterInappPurchase { /// Consumes a purchase on `Android`. /// /// No effect on `iOS`, whose consumable purchases are consumed at the time of purchase. - Future consumePurchaseAndroid(String token, { String developerPayload }) async { + Future consumePurchaseAndroid(String token, { String developerPayload }) async { if (_platform.isAndroid) { String result = await _channel.invokeMethod('consumeProduct', { 'token': token, 'developerPayload': developerPayload, }); - - if (result == null) { - return null; - } - - PurchaseResult decoded = json.decode(result); - return decoded; + return result; } else if (_platform.isIOS) { - return PurchaseResult(debugMessage: 'no-ops in ios'); + return 'no-ops in ios'; } throw PlatformException( code: _platform.operatingSystem, message: "platform not supported"); @@ -430,7 +419,7 @@ class FlutterInappPurchase { /// Finish a transaction on both `android` and `iOS`. /// /// Call this after finalizing server-side validation of the reciept. - Future finishTransaction(String purchaseToken, + Future finishTransaction(String purchaseToken, { String developerPayloadAndroid, bool isConsumable }) async { if (_platform.isAndroid) { if (isConsumable) { @@ -438,22 +427,19 @@ class FlutterInappPurchase { 'token': purchaseToken, 'developerPayload': developerPayloadAndroid, }); - PurchaseResult decoded = json.decode(result); - return decoded; + return result; } else { String result = await _channel.invokeMethod('acknowledgePurchase', { 'token': purchaseToken, 'developerPayload': developerPayloadAndroid, }); - PurchaseResult decoded = json.decode(result); - return decoded; + return result; } } else if (_platform.isIOS) { String result = await _channel.invokeMethod('finishTransaction', { 'transactionIdentifier': purchaseToken, }); - PurchaseResult decoded = json.decode(result); - return decoded; + return result; } throw PlatformException( code: _platform.operatingSystem, message: "platform not supported"); diff --git a/pubspec.yaml b/pubspec.yaml index 22e6cb76..18464fb6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inapp_purchase description: In App Purchase plugin for flutter. This project has been forked by react-native-iap and we are willing to share same experience with that on react-native. -version: 2.0.0+7 +version: 2.0.0+8 author: dooboolab homepage: https://github.com/dooboolab/flutter_inapp_purchase/blob/master/pubspec.yaml environment: