Merge remote-tracking branch 'origin/dev_改版主分支-升级融云SDK&AGP8' into dev_改版主分支-升级融云SDK&AGP8

This commit is contained in:
2024-03-26 17:39:10 +08:00
13 changed files with 78 additions and 51 deletions

View File

@@ -229,7 +229,7 @@ dependencies {
api project(':lib_google')
//samsung插件包
api project(':IAP6Helper')
//api project(':IAP6Helper')
//時間選擇器
api 'com.contrarywind:Android-PickerView:4.1.9'

Binary file not shown.

View File

@@ -3,14 +3,16 @@ package com.yunbao.common.pay.samsung;
import android.content.Context;
import com.google.gson.Gson;
import com.samsung.android.sdk.iap.lib2.helper.HelperDefine;
import com.samsung.android.sdk.iap.lib2.helper.IapHelper;
import com.samsung.android.sdk.iap.lib2.listener.OnConsumePurchasedItemsListener;
import com.samsung.android.sdk.iap.lib2.listener.OnGetOwnedListListener;
import com.samsung.android.sdk.iap.lib2.listener.OnPaymentListener;
import com.samsung.android.sdk.iap.lib2.vo.ConsumeVo;
import com.samsung.android.sdk.iap.lib2.vo.ErrorVo;
import com.samsung.android.sdk.iap.lib2.vo.OwnedProductVo;
import com.samsung.android.sdk.iap.lib.constants.HelperDefine;
import com.samsung.android.sdk.iap.lib.helper.IapHelper;
import com.samsung.android.sdk.iap.lib.listener.OnConsumePurchasedItemsListener;
import com.samsung.android.sdk.iap.lib.listener.OnGetOwnedListListener;
import com.samsung.android.sdk.iap.lib.listener.OnPaymentListener;
import com.samsung.android.sdk.iap.lib.vo.ConsumeVo;
import com.samsung.android.sdk.iap.lib.vo.ErrorVo;
import com.samsung.android.sdk.iap.lib.vo.OwnedProductVo;
import com.samsung.android.sdk.iap.lib.vo.PurchaseVo;
import com.yunbao.common.R;
import com.yunbao.common.utils.L;
import java.util.ArrayList;
@@ -57,9 +59,27 @@ public class SamsungUtil {
*/
public void buy(String skuId, OnPaymentListener onPaymentListener) {
//购买
iapHelper.startPayment(skuId, "", onPaymentListener);
iapHelper.startPayment(skuId, "", (errorVo, purchaseVo) -> {
if (purchaseVo != null) {
onPaymentListener.onPaymentSuccess(purchaseVo.getPurchaseId());
} else {
if (errorVo.getErrorCode() == HelperDefine.IAP_PAYMENT_IS_CANCELED) {
onPaymentListener.onPaymentFailed(mContext.getString(R.string.pay_cancel));
} else {
onPaymentListener.onPaymentFailed(errorVo.getErrorString());
}
}
});
}
public interface OnPaymentListener {
void onPaymentSuccess(String purchaseVo);
void onPaymentFailed(String errorVo);
}
/**
* 消耗指定商品
*

View File

@@ -27,4 +27,5 @@
<string name="focus_on">Focus on</string>
<string name="see_more">See more</string>
<string name="close">close</string>
<string name="time_cannot_be_greater_than_the_current_time">Time cannot be greater than the current time</string>
</resources>

View File

@@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@@ -1492,4 +1492,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@@ -1490,4 +1490,5 @@
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>

View File

@@ -1512,6 +1512,7 @@ Limited ride And limited avatar frame</string>
<string name="focus_on">關注</string>
<string name="see_more">查看更多</string>
<string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
</resources>