谷歌敏感权限和新的更新包逻辑

This commit is contained in:
18142669586 2022-09-22 15:21:15 +08:00
parent 24e07db6e1
commit f52e10b96f
8 changed files with 130 additions and 51 deletions

View File

@ -114,15 +114,15 @@ dependencies {
}
//
project.afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processResources.doFirst { pm->
String manifestPath = output.processResources.manifestFile;
def manifestContent = file(manifestPath).getText()
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
file(manifestPath).write(manifestContent)
}
}
}
}
//project.afterEvaluate {
// android.applicationVariants.all { variant ->
// variant.outputs.each { output ->
// output.processResources.doFirst { pm->
// String manifestPath = output.processResources.manifestFile;
// def manifestContent = file(manifestPath).getText()
// manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
// file(manifestPath).write(manifestContent)
// }
// }
// }
//}

View File

@ -47,9 +47,7 @@
<uses-permission
android:name="android.permission.MODIFY_AUDIO_SETTINGS"
tools:node="remove" />
<uses-permission
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

View File

@ -57,6 +57,15 @@ public class ConfigBean {
private String txVideoUgcLicenceUrl;//腾讯直播视频鉴权
private String txPlayUgcLicenceUrl;//腾讯短视频鉴权
private String txVideoUgcKey;
private String google_isup;
@JSONField(name = "google_isup")
public String getGoogle_isup() {
return google_isup;
}
@JSONField(name = "google_isup")
public void setGoogle_isup(String google_isup) {
this.google_isup = google_isup;
}
@JSONField(name = "tx_play_ugc_licence_url")
public String getTxPlayUgcLicenceUrl() {

View File

@ -165,7 +165,8 @@ public class CommonHttpUtil {
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
.params("langue", lang)
.params("version", "6.4.1")
.params("version", ""+VersionUtil.getVersion())
.params("from", "android")
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {

View File

@ -1,5 +1,6 @@
package com.yunbao.common.utils;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@ -8,6 +9,7 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
@ -47,7 +49,7 @@ public class VersionUtil {
//是否是谷歌版本
public static void showDialog(final Context context, ConfigBean configBean, final String downloadUrl) {
public static void showDialog(final Activity context, ConfigBean configBean, final String downloadUrl) {
if (configBean.getForceUpdate() != 0) {
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
if (!TextUtils.isEmpty(downloadUrl)) {
@ -79,6 +81,7 @@ public class VersionUtil {
//谷歌更新
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (configBean.getGoogle_isup().equals("0")) {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(WordUtil.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
@ -99,7 +102,29 @@ public class VersionUtil {
})
.build()
.show();
} else {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(WordUtil.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
.setCancelString(WordUtil.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
context.finish();
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
}
}
} else {
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
@ -134,6 +159,8 @@ public class VersionUtil {
ToastUtil.show(R.string.version_download_url_error);
}
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
if (configBean.getGoogle_isup().equals("0")) {
Log.e("tagg", "111111");
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(WordUtil.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
@ -154,6 +181,30 @@ public class VersionUtil {
})
.build()
.show();
} else {
DialogUitl.Builder builder = new DialogUitl.Builder(context);
builder.setTitle(WordUtil.getString(R.string.version_update))
.setContent(configBean.getUpdateDes())
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
.setCancelString(WordUtil.getString(R.string.version_not_update))
.setCancelable(false)
.setClickCallback(new DialogUitl.SimpleCallback2() {
public void onCancelClick() {
context.finish();
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
context.startActivity(i);
context.finish();
}
})
.build()
.show();
}
}
}

View File

@ -478,7 +478,7 @@
<string name="share_cancel">分享取消</string>
<string name="version_update">版本更新</string>
<string name="versions">版本號</string>
<string name="version_immediate_use">立即使用</string>
<string name="version_immediate_use">立即更新</string>
<string name="version_not_update">暫不更新</string>
<string name="version_latest">已經是最新版本</string>
<string name="version_download_url_error">下載地址無效</string>

View File

@ -25,6 +25,6 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false
isGooglePlay : false
isGooglePlay : true
]
}

View File

@ -195,6 +195,24 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onSetupSuccess(boolean isSelf) {
super.onSetupSuccess(isSelf);
Log.d(TAG, "内购服务初始化完成");
// googleBillingUtil.queryPurchaseHistoryAsyncInApp(new PurchaseHistoryResponseListener() {
// @Override
// public void onPurchaseHistoryResponse(@NonNull BillingResult billingResult, @Nullable List<PurchaseHistoryRecord> list) {
// Log.e(TAG,list.get(0).getPurchaseToken());
// //谷歌掉单处理
//// CommonHttpUtil.Google_sec_pay(purchase.getPurchaseToken(), purchase.getOrderId(), purchase.getSku(), new HttpCallback() {
//// @Override
//// public void onSuccess(int code, String msg, String[] info) {
////
//// }
//// });
//
// }
// });
List<Purchase> data = googleBillingUtil.queryPurchasesInApp(MainActivity.this);
if(data!=null&&data.size()>0) {
Log.e(TAG, data.get(0).getSku());
}
}
@Override
@ -284,6 +302,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
.addOnGoogleBillingListener(MainActivity.this, mOnMyGoogleBillingListener)
.build(MainActivity.this);
//在请求一下这个接口给我后台版本号
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
@Override
@ -446,7 +465,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
showInvitationCode();
}
checkVersion();
loginIM();
CommonAppConfig.getInstance().setLaunched(true);
mFristLoad = true;
@ -542,6 +560,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
});
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion();
}
/**
@ -570,6 +589,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
public void onError(String error) {
}
});
}