From f697e650a8a4f536b386f8718de2a309358b74b8 Mon Sep 17 00:00:00 2001
From: hch <16607480311@163.com>
Date: Tue, 19 Dec 2023 18:29:48 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 2 ++
common/build.gradle | 2 +-
.../com/yunbao/common/utils/GoogleUtils.java | 18 ++--------
.../common/views/APKUpdateCustomPopup.java | 34 +++++++++++++++----
common/src/main/res/values-en-rUS/string.xml | 3 ++
common/src/main/res/values-zh-rHK/strings.xml | 4 +++
common/src/main/res/values-zh-rTW/strings.xml | 4 +++
common/src/main/res/values-zh/strings.xml | 5 ++-
common/src/main/res/values/strings.xml | 4 +++
config.gradle | 4 +--
.../yunbao/main/activity/GoogleFragment.java | 2 +-
.../main/activity/MyWalletActivity.java | 6 ++--
.../yunbao/main/activity/SamsungFragment.java | 9 +++--
settings.gradle | 2 +-
14 files changed, 66 insertions(+), 33 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 2846a3d21..6a5cb886f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -171,6 +171,8 @@ android {
isGoogle = "Google"
} else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 2) {
isGoogle = "Huawei"
+ }else if (rootProject.ext.manifestPlaceholders.isGooglePlay == 3) {
+ isGoogle = "Samsung"
}
def isPlugin = "all"
if (rootProject.ext.manifestPlaceholders.isPluginModel) {
diff --git a/common/build.gradle b/common/build.gradle
index 6a33267a5..d436ac07d 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -214,7 +214,7 @@ dependencies {
//api project(':lib_huawei')
//google插件包
- api project(':lib_google')
+ //api project(':lib_google')
//samsung插件包
api project(':IAP6Helper')
diff --git a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
index a8a975dbc..079fcecda 100644
--- a/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
+++ b/common/src/main/java/com/yunbao/common/utils/GoogleUtils.java
@@ -6,6 +6,7 @@ import android.content.Intent;
import com.alibaba.fastjson.JSON;
+import com.yunbao.common.R;
import org.json.JSONObject;
@@ -162,10 +163,10 @@ public class GoogleUtils {
billingListener.onPaySuccess(token, orderId);
} else if (code == 1) {
timer.cancel();
- billingListener.onPayFailed("支付取消");
+ billingListener.onPayFailed(mActivity.getString(R.string.pay_cancel));
} else if (code == 2) {
timer.cancel();
- billingListener.onPayFailed("支付失败");
+ billingListener.onPayFailed(mActivity.getString(R.string.pay_fail));
}
} catch (Exception e) {
throw new RuntimeException(e);
@@ -185,19 +186,6 @@ public class GoogleUtils {
}
}
- public boolean getGoogleService() {
- boolean flag;
- try {
- Class> clz = mActivity.getClassLoader().loadClass("com.shayu.lib_google.utils.GoogleBillingManage");
- googlePay = clz.getConstructor(Activity.class).newInstance(mActivity);
- flag = (boolean) googlePay.getClass().getMethod("getGoogleService").invoke(googlePay);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return flag;
- }
-
-
public void setFirebaseTokenListener(Activity activity, FirebaseTokenListener firebaseTokenListener) {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
diff --git a/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java b/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
index b433c3957..eff92f029 100644
--- a/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
+++ b/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
@@ -114,8 +114,10 @@ public class APKUpdateCustomPopup extends CenterPopupView {
mContext.finish();
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
//华为
- //todo
- launchAppDetail(mContext, "com.pdlive.shayu", "com.huawei.appmarket");
+ launchHwAppDetail(mContext, "com.pdlive.shayu", "com.huawei.appmarket");
+ } else if (CommonAppConfig.IS_GOOGLE_PLAY == 3) {
+ //三星
+ launchSmAppDetail(mContext, "com.pdlive.shayu", "com.sec.android.app.samsungapps");
} else {
versionImmediateUse.setVisibility(GONE);
updateLine.setVisibility(VISIBLE);
@@ -130,23 +132,41 @@ public class APKUpdateCustomPopup extends CenterPopupView {
});
}
- public static boolean isAppStoreExist(Context context) {
+ public static void launchSmAppDetail(Context mContext, String appPkg, String marketPkg) {
+ try {
+ if (TextUtils.isEmpty(appPkg)) {
+ return;
+ }
+ if (isAppStoreExist(mContext, marketPkg)) {
+ Uri uri = Uri.parse("market://details?id=" + appPkg);
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ if (!TextUtils.isEmpty(marketPkg)) {
+ intent.setPackage(marketPkg);
+ }
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mContext.startActivity(intent);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean isAppStoreExist(Context context, String marketPkg) {
try {
PackageManager packageManager = context.getPackageManager();
- packageManager.getPackageInfo("com.huawei.appmarket", PackageManager.GET_ACTIVITIES);
+ packageManager.getPackageInfo(marketPkg, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
-
- public static void launchAppDetail(Context mContext, String appPkg, String marketPkg) {
+ public static void launchHwAppDetail(Context mContext, String appPkg, String marketPkg) {
try {
if (TextUtils.isEmpty(appPkg)) {
return;
}
- if (isAppStoreExist(mContext)) {
+ if (isAppStoreExist(mContext, marketPkg)) {
Uri uri = Uri.parse("appmarket://details?id=" + appPkg);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (!TextUtils.isEmpty(marketPkg)) {
diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml
index 094b3608e..025d7262b 100644
--- a/common/src/main/res/values-en-rUS/string.xml
+++ b/common/src/main/res/values-en-rUS/string.xml
@@ -1394,4 +1394,7 @@ Limited ride And limited avatar frame
2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;
3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.
+ Payment cancellation
+ Payment successful
+ Payment failed
diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml
index ed0ab01a7..0fb1f8c32 100644
--- a/common/src/main/res/values-zh-rHK/strings.xml
+++ b/common/src/main/res/values-zh-rHK/strings.xml
@@ -1390,4 +1390,8 @@
一、1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;
二、1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;
三、觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。
+
+ 支付取消
+ 支付成功
+ 支付失敗
diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml
index 852429a24..c4bc7008b 100644
--- a/common/src/main/res/values-zh-rTW/strings.xml
+++ b/common/src/main/res/values-zh-rTW/strings.xml
@@ -1389,4 +1389,8 @@
一、1星幣兌換1張觀影券,您可以根據需求自定義兌換數量,觀影券一經兌換不可撤銷,請提前確認;
二、1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;
三、觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。
+
+ 支付取消
+ 支付成功
+ 支付失敗
diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml
index 215f7ae42..315c9f783 100644
--- a/common/src/main/res/values-zh/strings.xml
+++ b/common/src/main/res/values-zh/strings.xml
@@ -644,7 +644,6 @@
座駕
一次免費贈送禮物特權!
-
TA還沒有座騎
歡迎來到PDLIVE
恭喜你獲得了新人獎勵
@@ -1390,4 +1389,8 @@
二、1張觀影券可觀看一集短劇,兌換成功後即可返回觀影頁面,使用觀影券繼續觀看影片;
三、觀影券禁止線下交易、收購等不正當行為,PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。
+ 支付取消
+ 支付成功
+ 支付失敗
+
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 21579cb64..99586f337 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -1396,4 +1396,8 @@ Limited ride And limited avatar frame
1.One star coin can be exchanged for one ticket. You can customize the exchange quantity according to your needs. Once the ticket is exchanged, it cannot be revoked. Please confirm in advance;
2.One ticket can be used to watch one episode of a short drama. After successful redemption, you can return to the viewing page and use the ticket to continue watching the movie;
3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.
+
+ Payment cancellation
+ Payment successful
+ Payment failed
diff --git a/config.gradle b/config.gradle
index 5442dbf23..f7586a40c 100644
--- a/config.gradle
+++ b/config.gradle
@@ -20,8 +20,8 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
-// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包
- isGooglePlay : 1,
+// true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包
+ isGooglePlay : 3,
//是否上报异常日志
isUploadLog : true,
//是否打包成插件包模式
diff --git a/main/src/main/java/com/yunbao/main/activity/GoogleFragment.java b/main/src/main/java/com/yunbao/main/activity/GoogleFragment.java
index 4493ea80c..3c2ddda23 100644
--- a/main/src/main/java/com/yunbao/main/activity/GoogleFragment.java
+++ b/main/src/main/java/com/yunbao/main/activity/GoogleFragment.java
@@ -143,7 +143,7 @@ public class GoogleFragment extends Fragment {
google_params.putString("price", MoneyUsds);
google_params.putString("quantity", "1");
dis();
- ToastUtil.show("支付成功");
+ ToastUtil.show(getString(R.string.pay_suc));
}
}
});
diff --git a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java
index b0d090b66..2bf2b8eba 100644
--- a/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MyWalletActivity.java
@@ -463,14 +463,14 @@ public class MyWalletActivity extends AbsActivity {
switch (code) {
case 60000:
- ToastUtil.show("支付取消");
+ ToastUtil.show(getString(R.string.pay_cancel));
break;
case -1:
case 60051:
- ToastUtil.show("支付失败");
+ ToastUtil.show(getString(R.string.pay_fail));
break;
case 0:
- ToastUtil.show("支付成功");
+ ToastUtil.show(getString(R.string.pay_suc));
inAppPurchaseData = object.getString("inAppPurchaseData");
inAppPurchaseDataSignature = object.getString("inAppPurchaseDataSignature");
MainHttpUtil.hwNotify(inAppPurchaseData, inAppPurchaseDataSignature, orderId, new HttpCallback() {
diff --git a/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java b/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java
index 19dd182cb..d7ac7e665 100644
--- a/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java
+++ b/main/src/main/java/com/yunbao/main/activity/SamsungFragment.java
@@ -17,6 +17,7 @@ import android.webkit.WebView;
import androidx.fragment.app.Fragment;
import com.facebook.appevents.AppEventsConstants;
+import com.samsung.android.sdk.iap.lib.helper.HelperDefine;
import com.samsung.android.sdk.iap.lib.listener.OnPaymentListener;
import com.samsung.android.sdk.iap.lib.vo.ErrorVo;
import com.samsung.android.sdk.iap.lib.vo.PurchaseVo;
@@ -115,7 +116,7 @@ public class SamsungFragment extends Fragment {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
- ToastUtil.show("支付成功");
+ ToastUtil.show(getString(R.string.pay_suc));
dis();
}
}
@@ -126,7 +127,11 @@ public class SamsungFragment extends Fragment {
payHandler.post(new Runnable() {
@Override
public void run() {
- ToastUtil.show(_errorVO.getErrorString());
+ if (_errorVO.getErrorCode() == HelperDefine.IAP_PAYMENT_IS_CANCELED) {
+ ToastUtil.show(getString(R.string.pay_cancel));
+ } else {
+ ToastUtil.show(_errorVO.getErrorString());
+ }
}
});
}
diff --git a/settings.gradle b/settings.gradle
index b391e1573..e8b3311ed 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -5,5 +5,5 @@ include ':FaceUnity'
include ':Share'
include ':pluginsForAnchor'
//include ':lib_huawei'
-include ':lib_google'
+//include ':lib_google'
include ':IAP6Helper'