diff --git a/app/build.gradle b/app/build.gradle
index f0660033f..5d8cd9bff 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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)
- }
- }
- }
-}
\ No newline at end of file
+//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)
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7e4cbcfab..d3f6b665f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -47,9 +47,7 @@
-
+
diff --git a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java
index 718c4e526..5397f4a20 100644
--- a/common/src/main/java/com/yunbao/common/bean/ConfigBean.java
+++ b/common/src/main/java/com/yunbao/common/bean/ConfigBean.java
@@ -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() {
diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java
index 258cecba8..43c48853e 100644
--- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java
+++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java
@@ -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) {
diff --git a/common/src/main/java/com/yunbao/common/utils/VersionUtil.java b/common/src/main/java/com/yunbao/common/utils/VersionUtil.java
index 0b5170839..4fd871b6a 100644
--- a/common/src/main/java/com/yunbao/common/utils/VersionUtil.java
+++ b/common/src/main/java/com/yunbao/common/utils/VersionUtil.java
@@ -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,15 +81,16 @@ public class VersionUtil {
//谷歌更新
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
- 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(true)
- .setClickCallback(new DialogUitl.SimpleCallback() {
- @Override
- public void onConfirmClick(Dialog dialog, String content) {
+ if (configBean.getGoogle_isup().equals("0")) {
+ 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(true)
+ .setClickCallback(new DialogUitl.SimpleCallback() {
+ @Override
+ public void onConfirmClick(Dialog dialog, String content) {
try {
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
@@ -95,11 +98,33 @@ public class VersionUtil {
} catch (Exception e) {
ToastUtil.show(R.string.version_download_url_error);
}
- }
- })
- .build()
- .show();
+ }
+ })
+ .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) {
@@ -124,7 +149,7 @@ public class VersionUtil {
.updateContent(configBean.getUpdateDes())
.update();
}
- },2000);
+ }, 2000);
} catch (Exception e) {
@@ -133,27 +158,53 @@ public class VersionUtil {
} else {
ToastUtil.show(R.string.version_download_url_error);
}
- }else if(CommonAppConfig.IS_GOOGLE_PLAY == true){
- 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(true)
- .setClickCallback(new DialogUitl.SimpleCallback() {
- @Override
- public void onConfirmClick(Dialog dialog, String content) {
- try {
+ } 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())
+ .setConfrimString(WordUtil.getString(R.string.version_immediate_use))
+ .setCancelString(WordUtil.getString(R.string.version_not_update))
+ .setCancelable(true)
+ .setClickCallback(new DialogUitl.SimpleCallback() {
+ @Override
+ public void onConfirmClick(Dialog dialog, String content) {
+ try {
+ 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);
+ } catch (Exception e) {
+ ToastUtil.show(R.string.version_download_url_error);
+ }
+ }
+ })
+ .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);
- } catch (Exception e) {
- ToastUtil.show(R.string.version_download_url_error);
+ context.finish();
}
- }
- })
- .build()
- .show();
+ })
+ .build()
+ .show();
+ }
+
}
}
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index bcf6d2cb7..ef91d112c 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -478,7 +478,7 @@
分享取消
版本更新
版本號
- 立即使用
+ 立即更新
暫不更新
已經是最新版本
下載地址無效
diff --git a/config.gradle b/config.gradle
index 3738cd1a2..f9e5da19d 100644
--- a/config.gradle
+++ b/config.gradle
@@ -25,6 +25,6 @@ ext {
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
// true表示谷歌支付 false
- isGooglePlay : false
+ isGooglePlay : true
]
}
\ No newline at end of file
diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
index 233a017aa..c9030463d 100644
--- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
@@ -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 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 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() {
@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) {
}
});
+
}