Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir committed Mar 20, 2018
1 parent 337fa78 commit b7d7fc3
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
25 changes: 15 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
## [0.1.3] - iOS Product Price Bug
On iOS product price was passed as double to Dart code.
## 0.2.0
* **Breaking change**. Dart 2 support

## [0.1.2] - iOS Simulator Support
Skip a product if information is not fullfiled properly
## 0.1.3
* On iOS product price was passed as double to Dart code

## [0.1.1] - iOS Support
Library is tested on iOS. Feature parity for both iOS and Android.
## 0.1.2
* Skip a product if information is not fulfilled properly

## [0.1.0] - Billing
New breaking API to address caching of products and purchases.
## 0.1.1
* iOS Support. Library is tested on iOS. Feature parity for both iOS and Android.

## [0.0.2] - Basic documented API.
## 0.1.0
* New breaking API to address caching of products and purchases.

## [0.0.1] - Initial Release.
## 0.0.2
* Basic documented API

## 0.0.1
* Initial Release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ testing has been limited.
[Pull Requests](https://github.com/VolodymyrLykhonis/flutter_billing/pulls) are welcome.

## Using
Add `flutter_billing: 0.1.3` as a dependency in `pubspec.yaml`.
Add `flutter_billing: 0.2.0` as a dependency in `pubspec.yaml`.

Create an instance of the plugin:
```dart
Expand Down
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Version format is `v{major}.{minor}.{patch}`. e.g. `v0.1.1`.
6. Do `git tag {version}`.
7. Do `flutter packages pub publish --dry-run`. Check to ensure there are no warnings!
8. Do `flutter packages pub publish` to publish new version.
9. Push changes `git push && git push --tags`
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ EXTERNAL SOURCES:
:path: /Users/Vladimir/Projects/github.com/flutter_billing/ios

SPEC CHECKSUMS:
Flutter: d674e78c937094a75ac71dd77e921e840bea3dbf
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
flutter_billing: 9f246559b5b788780dff78abe5c5998b8da2dae6

PODFILE CHECKSUM: af9e3c39454c5c0747a209b7dc05c442964e0051
Expand Down
20 changes: 6 additions & 14 deletions lib/flutter_billing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class BillingProduct {
this.description,
this.currency,
this.amount,
})
: assert(identifier != null),
}) : assert(identifier != null),
assert(price != null),
assert(title != null),
assert(description != null),
Expand Down Expand Up @@ -67,7 +66,7 @@ class BillingProduct {
}

/// A billing error callback to be called when any of billing operations fail.
typedef void BillingErrorCallback(Exception e);
typedef void BillingErrorCallback(Error e);

/// Billing plugin to enable communication with billing API in iOS and Android.
class Billing {
Expand All @@ -89,12 +88,10 @@ class Billing {
/// error, it would return simply empty list.
Future<List<BillingProduct>> getProducts(List<String> identifiers) {
assert(identifiers != null);

if (_cachedProducts.keys.toSet().containsAll(identifiers)) {
return new Future.value(
identifiers.map((identifier) => _cachedProducts[identifier]).toList());
}

return synchronized(this, () async {
try {
final Map<String, BillingProduct> products = new Map.fromIterable(
Expand Down Expand Up @@ -133,11 +130,10 @@ class Billing {
if (_purchasesFetched) {
return new Future.value(new Set.from(_purchasedProducts));
}

return synchronized(this, () async {
try {
final List<String> purchases = await _channel.invokeMethod('fetchPurchases');
_purchasedProducts.addAll(purchases);
final List purchases = await _channel.invokeMethod('fetchPurchases');
_purchasedProducts.addAll(purchases.cast());
_purchasesFetched = true;
return _purchasedProducts;
} catch (e) {
Expand All @@ -152,7 +148,6 @@ class Billing {
/// Returns true if a product is purchased, otherwise false.
Future<bool> isPurchased(String identifier) async {
assert(identifier != null);

final Set<String> purchases = await getPurchases();
return purchases.contains(identifier);
}
Expand All @@ -163,16 +158,13 @@ class Billing {
/// Returns updated list of product identifiers that have been purchased.
Future<bool> purchase(String identifier) {
assert(identifier != null);

if (_purchasedProducts.contains(identifier)) {
return new Future.value(true);
}

return synchronized(this, () async {
try {
final List<String> purchases =
await _channel.invokeMethod('purchase', {'identifier': identifier});
_purchasedProducts.addAll(purchases);
final List purchases = await _channel.invokeMethod('purchase', {'identifier': identifier});
_purchasedProducts.addAll(purchases.cast());
return purchases.contains(identifier);
} catch (e) {
if (_onError != null) _onError(e);
Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_billing
description: A flutter plugin to communicate with billing on iOS and Android.
version: 0.1.3
version: 0.2.0
author: Volodymyr Lykhonis <[email protected]>
homepage: http://vladimirlichonos.com

Expand All @@ -15,4 +15,5 @@ flutter:
pluginClass: BillingPlugin

environment:
sdk: ">=1.8.0 <2.0.0"
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=0.1.4 <2.0.0"

0 comments on commit b7d7fc3

Please sign in to comment.