Skip to content

Commit cbb1262

Browse files
authored
Merge pull request #174 from qonversion/release/4.6.0
Release 4.6.0
2 parents acbdd22 + 15db0bf commit cbb1262

File tree

13 files changed

+167
-8
lines changed

13 files changed

+167
-8
lines changed

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
name: Upload flutter SDK
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Setup Flutter
16+
uses: subosito/flutter-action@v2
17+
with:
18+
channel: 'stable'
19+
20+
- name: Flutter version
21+
run: flutter --version
22+
23+
- name: Cache pub dependencies
24+
uses: actions/cache@v2
25+
with:
26+
path: ${{ env.FLUTTER_HOME }}/.pub-cache
27+
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
28+
restore-keys: ${{ runner.os }}-pub-
29+
30+
- name: Download pub dependencies
31+
run: flutter pub get
32+
33+
- name: Setup Pub Credentials
34+
run: |
35+
mkdir -p $HOME/.config/dart
36+
cat <<EOF > $HOME/.config/dart/pub-credentials.json
37+
{
38+
"accessToken": "${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}",
39+
"refreshToken": "${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}",
40+
"idToken": "${{ secrets.PUB_DEV_PUBLISH_ID_TOKEN }}",
41+
"tokenEndpoint": "${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }}",
42+
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
43+
"expiration": ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
44+
}
45+
EOF
46+
47+
- name: Check Publish Warnings
48+
run: flutter pub publish --dry-run
49+
50+
- name: Publish SDK
51+
run: flutter pub publish -f

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.6.0
2+
* Added a `source` property to the `Permission` object - use it to know where this permission is originally from - App Store, Play Store, Stripe, etc.
3+
* Added a method `getNotificationCustomPayload` to get the extra data you've added to automation notifications.
4+
* Added a method `presentCodeRedemptionSheet` to show up a sheet for users to redeem AppStore offer codes (iOS 14+ only).
5+
* Purchase tracking error handling improved to guarantee delivery.
6+
17
## 4.5.2
28
* Added a new user property `AppSetId` - a unique user identifier for all the developer's applications. May be used for some integrations.
39

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.qonversion.flutter.sdk.qonversion_flutter_sdk'
2-
version '4.4.0'
2+
version '4.6.0'
33

44
buildscript {
55
ext.kotlin_version = '1.3.50'
@@ -41,6 +41,6 @@ android {
4141

4242
dependencies {
4343
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
44-
implementation 'io.qonversion.sandwich:sandwich:0.1.2'
44+
implementation 'io.qonversion.sandwich:sandwich:0.2.0'
4545
implementation 'com.google.code.gson:gson:2.8.6'
4646
}

android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionFlutterSdkPlugin.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class QonversionFlutterSdkPlugin : MethodCallHandler, FlutterPlugin, ActivityAwa
129129
"setPermissionsCacheLifetime" -> setPermissionsCacheLifetime(args, result)
130130
"setNotificationsToken" -> setNotificationsToken(args["notificationsToken"] as? String, result)
131131
"handleNotification" -> handleNotification(args, result)
132+
"getNotificationCustomPayload" -> getNotificationCustomPayload(args, result)
132133
else -> result.notImplemented()
133134
}
134135
}
@@ -286,6 +287,18 @@ class QonversionFlutterSdkPlugin : MethodCallHandler, FlutterPlugin, ActivityAwa
286287
result.success(isQonversionNotification)
287288
}
288289

290+
private fun getNotificationCustomPayload(args: Map<String, Any>, result: Result) {
291+
val data = args["notificationData"] as? Map<String, Any> ?: return result.noDataError()
292+
293+
if (data.isEmpty()) {
294+
return result.noDataError()
295+
}
296+
297+
val payload = qonversionSandwich.getNotificationCustomPayload(data)
298+
val payloadJson = Gson().toJson(payload)
299+
result.success(payloadJson)
300+
}
301+
289302
private fun storeSdkInfo(args: Map<String, Any>, result: Result) {
290303
val version = args["version"] as? String ?: return result.noSdkInfo()
291304
val source = args["source"] as? String ?: return result.noSdkInfo()

ios/Classes/SwiftQonversionFlutterSdkPlugin.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public class SwiftQonversionFlutterSdkPlugin: NSObject, FlutterPlugin {
6969
qonversionSandwich?.logout()
7070
return result(nil)
7171

72+
case "presentCodeRedemptionSheet":
73+
return presentCodeRedemptionSheet(result)
74+
7275
default:
7376
break
7477
}
@@ -123,6 +126,9 @@ public class SwiftQonversionFlutterSdkPlugin: NSObject, FlutterPlugin {
123126
case "handleNotification":
124127
return handleNotification(args, result)
125128

129+
case "getNotificationCustomPayload":
130+
return getNotificationCustomPayload(args, result)
131+
126132
default:
127133
return result(FlutterMethodNotImplemented)
128134
}
@@ -283,6 +289,22 @@ public class SwiftQonversionFlutterSdkPlugin: NSObject, FlutterPlugin {
283289
result(isPushHandled)
284290
}
285291

292+
private func getNotificationCustomPayload(_ args: [AnyHashable: Any], _ result: @escaping FlutterResult) {
293+
guard let notificationData = args["notificationData"] as? [AnyHashable: Any] else {
294+
return result(FlutterError.noData)
295+
}
296+
297+
let customPayload: [AnyHashable: Any]? = qonversionSandwich?.getNotificationCustomPayload(notificationData)
298+
result(customPayload?.toJson())
299+
}
300+
301+
private func presentCodeRedemptionSheet(_ result: @escaping FlutterResult) {
302+
if #available(iOS 14.0, *) {
303+
qonversionSandwich?.presentCodeRedemptionSheet()
304+
}
305+
result(nil)
306+
}
307+
286308
private func getDefaultCompletion(_ result: @escaping FlutterResult) -> BridgeCompletion {
287309
return { data, error in
288310
if let error = error {

ios/qonversion_flutter.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
Pod::Spec.new do |s|
66
s.name = 'qonversion_flutter'
7-
s.version = '4.4.0'
7+
s.version = '4.6.0'
88
s.summary = 'Flutter Qonversion SDK'
99
s.description = <<-DESC
1010
Powerful yet simple subscription analytics
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
1818
s.platform = :ios, '9.0'
19-
s.dependency 'QonversionSandwich', '0.1.2'
19+
s.dependency 'QonversionSandwich', '0.2.0'
2020

2121
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }

lib/src/constants.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Constants {
4747
'setAppleSearchAdsAttributionEnabled';
4848
static const mSetNotificationsToken = 'setNotificationsToken';
4949
static const mHandleNotification = 'handleNotification';
50+
static const mGetNotificationCustomPayload = 'getNotificationCustomPayload';
51+
static const mPresentCodeRedemptionSheet = 'presentCodeRedemptionSheet';
5052

5153
// Numeric constants
5254
static const skuDetailsPriceRatio = 1000000;

lib/src/models/permission.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:json_annotation/json_annotation.dart';
2+
import 'package:qonversion_flutter/src/models/permission_source.dart';
23
import 'package:qonversion_flutter/src/models/product_renew_state.dart';
34
import 'package:qonversion_flutter/src/models/utils/mapper.dart';
45

@@ -25,6 +26,13 @@ class QPermission {
2526
)
2627
final QProductRenewState renewState;
2728

29+
/// A source determining where this permission is originally from - App Store, Play Store, Stripe, etc.
30+
@JsonKey(
31+
name: 'source',
32+
unknownEnumValue: QPermissionSource.unknown,
33+
)
34+
final QPermissionSource source;
35+
2836
/// Purchase date
2937
@JsonKey(
3038
name: 'startedTimestamp',
@@ -49,6 +57,7 @@ class QPermission {
4957
this.permissionId,
5058
this.productId,
5159
this.renewState,
60+
this.source,
5261
this.startedDate,
5362
this.expirationDate,
5463
this.isActive,

lib/src/models/permission.g.dart

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import 'package:json_annotation/json_annotation.dart';
2+
3+
enum QPermissionSource {
4+
@JsonValue("Unknown")
5+
unknown,
6+
7+
@JsonValue("AppStore")
8+
appStore,
9+
10+
@JsonValue("PlayStore")
11+
playStore,
12+
13+
@JsonValue("Stripe")
14+
stripe,
15+
16+
@JsonValue("Manual")
17+
manual,
18+
}

0 commit comments

Comments
 (0)