This commit is contained in:
hch 2023-12-19 18:29:48 +08:00
parent 9d543f2211
commit f697e650a8
14 changed files with 66 additions and 33 deletions

View File

@ -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) {

View File

@ -214,7 +214,7 @@ dependencies {
//api project(':lib_huawei')
//google插件包
api project(':lib_google')
//api project(':lib_google')
//samsung插件包
api project(':IAP6Helper')

View File

@ -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() {

View File

@ -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)) {

View File

@ -1394,4 +1394,7 @@ Limited ride And limited avatar frame</string>
<string name="conversion_quantity_need_of_use2">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;</string>
<string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
<string name="pay_cancel">Payment cancellation</string>
<string name="pay_suc">Payment successful</string>
<string name="pay_fail">Payment failed</string>
</resources>

View File

@ -1390,4 +1390,8 @@
<string name="conversion_quantity_need_of_use1">一、1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">二、1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">三、觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
<string name="pay_cancel">支付取消</string>
<string name="pay_suc">支付成功</string>
<string name="pay_fail">支付失敗</string>
</resources>

View File

@ -1389,4 +1389,8 @@
<string name="conversion_quantity_need_of_use1">一、1星幣兌換1張觀影券您可以根據需求自定義兌換數量觀影券一經兌換不可撤銷請提前確認</string>
<string name="conversion_quantity_need_of_use2">二、1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">三、觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
<string name="pay_cancel">支付取消</string>
<string name="pay_suc">支付成功</string>
<string name="pay_fail">支付失敗</string>
</resources>

View File

@ -644,7 +644,6 @@
<string name="car">座駕</string>
<string name="one_free">一次免費贈送禮物特權!</string>
<string name="no_car">TA還沒有座騎</string>
<string name="welcome_pdlive">歡迎來到PDLIVE</string>
<string name="newcomer">恭喜你獲得了新人獎勵</string>
@ -1390,4 +1389,8 @@
<string name="conversion_quantity_need_of_use2">二、1張觀影券可觀看一集短劇兌換成功後即可返回觀影頁面使用觀影券繼續觀看影片</string>
<string name="conversion_quantity_need_of_use3">三、觀影券禁止線下交易、收購等不正當行為PDLIVE將對各類以盈利為目的的交易行為進行嚴厲打擊。</string>
<string name="pay_cancel">支付取消</string>
<string name="pay_suc">支付成功</string>
<string name="pay_fail">支付失敗</string>
</resources>

View File

@ -1396,4 +1396,8 @@ Limited ride And limited avatar frame</string>
<string name="conversion_quantity_need_of_use1">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;</string>
<string name="conversion_quantity_need_of_use2">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;</string>
<string name="conversion_quantity_need_of_use3">3.Ticket prohibit illegal activities such as offline trading and acquisitions, and PDLIVE will crack down severely on various profit-making trading activities.</string>
<string name="pay_cancel">Payment cancellation</string>
<string name="pay_suc">Payment successful</string>
<string name="pay_fail">Payment failed</string>
</resources>

View File

@ -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,
//

View File

@ -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));
}
}
});

View File

@ -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() {

View File

@ -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());
}
}
});
}

View File

@ -5,5 +5,5 @@ include ':FaceUnity'
include ':Share'
include ':pluginsForAnchor'
//include ':lib_huawei'
include ':lib_google'
//include ':lib_google'
include ':IAP6Helper'