Skip to content

Commit ca07ec7

Browse files
committed
Update IAP plugin to version 5.3.0+300
1 parent e8abb1e commit ca07ec7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+720
-1986
lines changed
-623 KB
Binary file not shown.

flutter-hms-iap/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
## 5.3.0+300
2+
3+
* [Breaking Change] Added null-safety support.
4+
* Updated Huawei IAP SDK version to 5.3.0.300
5+
* isSupportAppTouch parameter is added to isEnvReady API for AppTouch.
6+
* Added carrierId and country to IsEnvReadyResult for obtaining the carrier ID and the country of the currently signed-in ID.
7+
* Added a class of constants, named SignAlgorithmConstants, which contains the algorithm that you pass for calling a certain IapClient API.
8+
* Added signatureAlgorithm to ConsumeOwnedPurchaseReq, OwnedPurchasesReq and PurchaseIntentReq classes to specify signature algorithm to sign the result data.
9+
* Added signatureAlgorithm to ConsumeOwnedPurchaseResult, OwnedPurchasesResult and PurchaseResultInfo to verify the signature algorithm.
10+
111
## 5.0.2+301
12+
213
* Updated HMSLogger.
314

415
## 5.0.2+300

flutter-hms-iap/README.md

Lines changed: 20 additions & 1449 deletions
Large diffs are not rendered by default.

flutter-hms-iap/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ android {
4040
}
4141

4242
dependencies {
43-
implementation 'com.huawei.hms:iap:5.0.2.300'
43+
implementation 'com.huawei.hms:iap:5.3.0.300'
4444
implementation 'com.google.code.gson:gson:2.8.5'
4545
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

flutter-hms-iap/android/gradlew

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter-hms-iap/android/gradlew.bat

Lines changed: 4 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter-hms-iap/android/src/main/java/com/huawei/hms/flutter/iap/MethodCallHandlerImpl.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,21 @@ public class MethodCallHandlerImpl implements MethodCallHandler, ActivityResultL
7272
hmsLogger = HMSLogger.getInstance(mActivity.getApplicationContext());
7373
}
7474

75-
private void isEnvReady(@NonNull final Result result) {
75+
private void isEnvReady(@NonNull final MethodCall call, @NonNull final Result result) {
7676
final String isEnvReadyMethodName = "isEnvReady";
77+
final Boolean isSupportAppTouch = call.argument("isSupportAppTouch") == null
78+
? null
79+
: ValueGetter.getBoolean("isSupportAppTouch", call);
7780
hmsLogger.startMethodExecutionTimer(isEnvReadyMethodName);
78-
mIapClient.isEnvReady()
79-
.addOnSuccessListener(new DefaultSuccessListener<>(result, mGson, hmsLogger, isEnvReadyMethodName))
80-
.addOnFailureListener(new IsEnvReadyFailureListener(this, result, REQUEST_IS_ENVIRONMENT_READY, hmsLogger));
81+
if(isSupportAppTouch == null) {
82+
mIapClient.isEnvReady()
83+
.addOnSuccessListener(new DefaultSuccessListener<>(result, mGson, hmsLogger, isEnvReadyMethodName))
84+
.addOnFailureListener(new IsEnvReadyFailureListener(this, result, REQUEST_IS_ENVIRONMENT_READY, hmsLogger));
85+
} else{
86+
mIapClient.isEnvReady(isSupportAppTouch)
87+
.addOnSuccessListener(new DefaultSuccessListener<>(result, mGson, hmsLogger, isEnvReadyMethodName))
88+
.addOnFailureListener(new IsEnvReadyFailureListener(this, result, REQUEST_IS_ENVIRONMENT_READY, hmsLogger));
89+
}
8190
}
8291

8392
private void isSandboxActivated(@NonNull final Result result) {
@@ -119,13 +128,17 @@ private void createPurchaseIntent(@NonNull final MethodCall call, @NonNull final
119128
final String reservedInfor = call.argument("reservedInfor") == null
120129
? null
121130
: ValueGetter.getString("reservedInfor", call);
131+
final String signatureAlgorithm = call.argument("signatureAlgorithm") == null
132+
? null
133+
: ValueGetter.getString("signatureAlgorithm", call);
122134

123135
//Constructing request
124136
final PurchaseIntentReq request = new PurchaseIntentReq();
125137
request.setProductId(productId);
126138
request.setPriceType(priceType);
127139
request.setDeveloperPayload(developerPayload);
128140
request.setReservedInfor(reservedInfor);
141+
request.setSignatureAlgorithm(signatureAlgorithm);
129142

130143
//Create purchase intent from IAP service
131144
final String createPurchaseIntentMethodName = "createPurchaseIntent";
@@ -144,11 +157,15 @@ private void consumeOwnedPurchase(@NonNull final MethodCall call, @NonNull final
144157
final String developerChallenge = call.argument("developerChallenge") == null
145158
? null
146159
: ValueGetter.getString("developerChallenge", call);
160+
final String signatureAlgorithm = call.argument("signatureAlgorithm") == null
161+
? null
162+
: ValueGetter.getString("signatureAlgorithm", call);
147163

148164
//Constructing request
149165
final ConsumeOwnedPurchaseReq request = new ConsumeOwnedPurchaseReq();
150166
request.setDeveloperChallenge(developerChallenge);
151167
request.setPurchaseToken(purchaseToken);
168+
request.setSignatureAlgorithm(signatureAlgorithm);
152169

153170
// Call service from IAP service
154171
final String consumeOwnedPurchaseMethodName = "consumeOwnedPurchase";
@@ -164,6 +181,9 @@ private void consumeOwnedPurchase(@NonNull final MethodCall call, @NonNull final
164181
private void obtainOwnedPurchaseRecord(@NonNull final MethodCall call, @NonNull final Result result) {
165182
//Arguments
166183
final int priceType = ValueGetter.getInt("priceType", call);
184+
final String signatureAlgorithm = call.argument("signatureAlgorithm") == null
185+
? null
186+
: ValueGetter.getString("signatureAlgorithm", call);
167187
final String continuationToken = call.argument("continuationToken") == null
168188
? null
169189
: ValueGetter.getString("continuationToken", call);
@@ -172,6 +192,7 @@ private void obtainOwnedPurchaseRecord(@NonNull final MethodCall call, @NonNull
172192
final OwnedPurchasesReq request = new OwnedPurchasesReq();
173193
request.setContinuationToken(continuationToken);
174194
request.setPriceType(priceType);
195+
request.setSignatureAlgorithm(signatureAlgorithm);
175196

176197
//Obtain record from IAP service
177198
final String obtainOwnedPurchaseRecordMethodName = "obtainOwnedPurchaseRecord";
@@ -190,11 +211,15 @@ private void obtainOwnedPurchases(@NonNull final MethodCall call, @NonNull final
190211
final String continuationToken = call.argument("continuationToken") == null
191212
? null
192213
: ValueGetter.getString("continuationToken", call);
214+
final String signatureAlgorithm = call.argument("signatureAlgorithm") == null
215+
? null
216+
: ValueGetter.getString("signatureAlgorithm", call);
193217

194218
//Constructing request
195219
final OwnedPurchasesReq request = new OwnedPurchasesReq();
196220
request.setContinuationToken(continuationToken);
197221
request.setPriceType(priceType);
222+
request.setSignatureAlgorithm(signatureAlgorithm);
198223

199224
//Obtain owned purchase from IAP service
200225
final String obtainOwnedPurchasesMethodName = "obtainOwnedPurchases";
@@ -231,7 +256,7 @@ private void startIapActivity(@NonNull final MethodCall call, final Result resul
231256
public void onMethodCall(@NonNull final MethodCall call, @NonNull final Result result) {
232257
switch (call.method) {
233258
case "isEnvReady":
234-
isEnvReady(result);
259+
isEnvReady(call, result);
235260
break;
236261
case "isSandboxActivated":
237262
isSandboxActivated(result);

flutter-hms-iap/android/src/main/java/com/huawei/hms/flutter/iap/logger/HMSLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public final class HMSLogger {
4040

4141
private static final String PLATFORM = "Flutter";
4242

43-
private static final String VERSION = "5.0.2.301";
43+
private static final String VERSION = "5.3.0.300";
4444

4545
private static final String SERVICE = "Cross-Platform";
4646

0 commit comments

Comments
 (0)