Commit a998e702 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 4e9750e7
...@@ -243,10 +243,4 @@ object Constant { ...@@ -243,10 +243,4 @@ object Constant {
// 外网IP地址 // 外网IP地址
const val OUT_NET_IP = "out_net_ip" const val OUT_NET_IP = "out_net_ip"
// 外网IP地址
const val MCRS_PKG = "com.harvestmoon.android"
// 牧场人生下载链接
const val MCRS_DOWNLOAD_Url = "https://imtt.dd.qq.com/16891/apk/958ADFB4EAA1D4BF8CF5FAD63987EC25.apk?fsname=com.harvestmoon.android_1.0.0.0_1000.apk&csr=1bbd"
} }
...@@ -198,6 +198,8 @@ public class MyInfo implements Serializable { ...@@ -198,6 +198,8 @@ public class MyInfo implements Serializable {
private int doubleCoin; private int doubleCoin;
private int max; private int max;
private String carrierType; private String carrierType;
private String downloadUrl;
private String pkg;
private String doubleCarrierType; private String doubleCarrierType;
private int complete; private int complete;
private int status = 0; private int status = 0;
...@@ -205,6 +207,14 @@ public class MyInfo implements Serializable { ...@@ -205,6 +207,14 @@ public class MyInfo implements Serializable {
private int readCoin; private int readCoin;
private int needSeconds; private int needSeconds;
public String getDownloadUrl() {
return downloadUrl;
}
public String getPkg() {
return pkg;
}
public int getNeedSeconds() { public int getNeedSeconds() {
return needSeconds; return needSeconds;
} }
......
...@@ -35,8 +35,8 @@ public class AppInstallService extends Service { ...@@ -35,8 +35,8 @@ public class AppInstallService extends Service {
private void initReceiver() { private void initReceiver() {
IntentFilter intentFilter = new IntentFilter(); IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PACKAGE_ADDED"); intentFilter.addAction("android.intent.action.PACKAGE_ADDED");
intentFilter.addAction("android.intent.action.PACKAGE_REPLACED"); // intentFilter.addAction("android.intent.action.PACKAGE_REPLACED");
intentFilter.addAction("android.intent.action.PACKAGE_REMOVED"); // intentFilter.addAction("android.intent.action.PACKAGE_REMOVED");
intentFilter.addDataScheme("package"); intentFilter.addDataScheme("package");
registerReceiver(this.broadcastReceiver, intentFilter); registerReceiver(this.broadcastReceiver, intentFilter);
} }
......
...@@ -90,6 +90,7 @@ class MyFragment : BaseFragment(), ...@@ -90,6 +90,7 @@ class MyFragment : BaseFragment(),
// 牧场人生安装奖励金币 // 牧场人生安装奖励金币
private var downloadMCRSCoin = 50 private var downloadMCRSCoin = 50
private var pkgMCRSName = "com.harvestmoon.android"
// 签到信息 // 签到信息
private var signCardBean: SignCardBean? = null private var signCardBean: SignCardBean? = null
...@@ -130,9 +131,9 @@ class MyFragment : BaseFragment(), ...@@ -130,9 +131,9 @@ class MyFragment : BaseFragment(),
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
DownloadApkManager.tryOnceInstallApk()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FIVE) { if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FIVE) {
DownloadApkManager.tryOnceInstallApk()
if (!TextUtils.isEmpty(userManager.userID)) { if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getAutoUserHallBaseMsg() myPresenter.getAutoUserHallBaseMsg()
refreshHighTask() refreshHighTask()
...@@ -715,9 +716,10 @@ class MyFragment : BaseFragment(), ...@@ -715,9 +716,10 @@ class MyFragment : BaseFragment(),
MainMyAdapter.TO_FIRSTDOWNLOAD -> { MainMyAdapter.TO_FIRSTDOWNLOAD -> {
// 牧场人生下载金币赋值 // 牧场人生下载金币赋值
downloadMCRSCoin = taskBean.otherConfig.coin downloadMCRSCoin = taskBean.otherConfig.coin
pkgMCRSName = taskBean.otherConfig.pkg
// 下载牧场人生 // 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), Constant.MCRS_DOWNLOAD_Url, Constant.MCRS_PKG) DownloadApkManager.downloadApk(requireActivity(), taskBean.otherConfig.downloadUrl, pkgMCRSName)
// 开启广播监听安装事件 // 开启广播监听安装事件
registerBroad() registerBroad()
...@@ -1255,14 +1257,13 @@ class MyFragment : BaseFragment(), ...@@ -1255,14 +1257,13 @@ class MyFragment : BaseFragment(),
// ps.put(Constant.HIGH_TASK_PKG_NAME, pkg) // ps.put(Constant.HIGH_TASK_PKG_NAME, pkg)
myPresenter.setHighTaskType("3") myPresenter.setHighTaskType("3")
} else if (TextUtils.equals(pkg, Constant.MCRS_PKG)) { } else if (TextUtils.equals(pkg, pkgMCRSName)) {
// 牧场人生APP,直接弹奖励框 // 牧场人生APP,直接弹奖励框
val bundle = Bundle() val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, downloadMCRSCoin) bundle.putInt(Constant.MAIN_CUR_COIN, downloadMCRSCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD) bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
readyGo(AwardActivity::class.java, bundle) readyGo(AwardActivity::class.java, bundle)
return
} }
} catch (e: Exception) { } catch (e: Exception) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment