Skip to content

Commit

Permalink
Ios promocodes (#325)
Browse files Browse the repository at this point in the history
* updated dependecies:
  http: ^0.13.4
  meta: ^1.7.0
for ios: added presentCodeRedemptionSheet

* upgraded dependecies
  http: ^0.13.4
  meta: ^1.7.0
ios:
  added presentCodeRedemptionSheet

* Update FlutterInappPurchasePlugin.m

* Rename showPromoCodes to iOS specific

Co-authored-by: hyochan <dooboolab@gmail.com>
  • Loading branch information
tylyo and hyochan authored Nov 14, 2021
1 parent 12a7ccb commit 7f0036a
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 203 deletions.
331 changes: 211 additions & 120 deletions CHANGELOG.md

Large diffs are not rendered by default.

178 changes: 103 additions & 75 deletions README.md

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android_</name>
<comment>Project android_ created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1636786187292</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
13 changes: 13 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.0-rc-1))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
28 changes: 28 additions & 0 deletions example/android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1636786187287</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
13 changes: 13 additions & 0 deletions example/android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
10 changes: 10 additions & 0 deletions ios/Classes/FlutterInappPurchasePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
[self getAvailableItems:result];
} else if ([@"getAppStoreInitiatedProducts" isEqualToString:call.method]) {
[self getAppStoreInitiatedProducts:result];
} else if ([@"showRedeemCodesIOS" isEqualToString:call.method]) {
#if __IPHONE_12_2
if (@available(iOS 14.0, *)) {
[[SKPaymentQueue defaultQueue] presentCodeRedemptionSheet];
result(@"present PromoCodes");
return;
}
#endif
result(@"the functionality is available starting from ios 14.0");

} else {
result(FlutterMethodNotImplemented);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/flutter_inapp_purchase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,14 @@ class FlutterInappPurchase {
_purchaseErrorController = null;
}
}

Future<String> showPromoCodesIOS() async {
if (_platform.isIOS) {
return await _channel.invokeMethod('showRedeemCodesIOS');
}
throw PlatformException(
code: _platform.operatingSystem, message: "platform not supported");
}
}

/// A list of valid values for ProrationMode parameter
Expand Down
16 changes: 8 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
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: 5.0.3
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: 5.0.4
homepage: https://github.com/dooboolab/flutter_inapp_purchase/blob/master/pubspec.yaml
environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"

dependencies:
http: ^0.13.0
meta: ^1.3.0
flutter:
sdk: flutter

http: ^0.13.4
meta: ^1.7.0
platform: ^3.0.0

dev_dependencies:
test: ^1.16.5
mockito: ^5.0.1
flutter_test:
sdk: flutter
mockito: ^5.0.1
test: ^1.16.5

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
plugin:
Expand Down

0 comments on commit 7f0036a

Please sign in to comment.