Commit 4e9750e7 authored by jyx's avatar jyx

添加牧场人生下载奖励

parent b1311615
......@@ -135,6 +135,7 @@ object Constant {
const val CARRIER_CPD = "CPD" //珊瑚CPD下载试玩任务
const val CARRIER_CPD_SYD = "CPD_SYD" //SYDCPD下载试玩任务
const val CARRIER_CPD_USEAPP = "CPD_USEAPP" //积分墙体验试玩下载过的APP
const val CARRIER_MC_FIRSTDOWNLOAD = "MC_FIRSTDOWNLOAD" // 牧场人生下载奖励
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......@@ -242,4 +243,10 @@ object Constant {
// 外网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"
}
......@@ -35,6 +35,8 @@ public class AppInstallService extends Service {
private void initReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PACKAGE_ADDED");
intentFilter.addAction("android.intent.action.PACKAGE_REPLACED");
intentFilter.addAction("android.intent.action.PACKAGE_REMOVED");
intentFilter.addDataScheme("package");
registerReceiver(this.broadcastReceiver, intentFilter);
}
......
......@@ -9,7 +9,6 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.express.PreLoadExpressManager
......@@ -174,7 +173,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_HOMEVEDIO_CHALLENGE, Constant.CARRIER_MINIVEDIO_CHALLENGE,
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL,
Constant.CARRIER_RUISHINEWS_CHALLANGE, Constant.CARRIER_ZHANGYUE_CHALLENGE,
Constant.CARRIER_XMLY_CHALLENGE, Constant.CARRIER_SHARE_NEWS -> {
Constant.CARRIER_XMLY_CHALLENGE, Constant.CARRIER_SHARE_NEWS,
Constant.CARRIER_MC_FIRSTDOWNLOAD -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
......
......@@ -54,6 +54,9 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 喜马拉雅
const val TO_XMLY = "TO_XMLY"
// 下载牧场人生
const val TO_FIRSTDOWNLOAD = "TO_FIRSTDOWNLOAD"
}
private var mContext: Context = context
......
......@@ -88,6 +88,9 @@ class MyFragment : BaseFragment(),
private var carrierType = ""
private var curSignCoin = 50
// 牧场人生安装奖励金币
private var downloadMCRSCoin = 50
// 签到信息
private var signCardBean: SignCardBean? = null
......@@ -126,6 +129,9 @@ class MyFragment : BaseFragment(),
override fun onResume() {
super.onResume()
DownloadApkManager.tryOnceInstallApk()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FIVE) {
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getAutoUserHallBaseMsg()
......@@ -705,7 +711,16 @@ class MyFragment : BaseFragment(),
}
}
}
}
MainMyAdapter.TO_FIRSTDOWNLOAD -> {
// 牧场人生下载金币赋值
downloadMCRSCoin = taskBean.otherConfig.coin
// 下载牧场人生
DownloadApkManager.downloadApk(requireActivity(), Constant.MCRS_DOWNLOAD_Url, Constant.MCRS_PKG)
// 开启广播监听安装事件
registerBroad()
}
}
}
......@@ -1231,19 +1246,29 @@ class MyFragment : BaseFragment(),
override fun onReceive(context: Context?, intent: Intent?) {
if (intent == null) return
// 非高额任务不监听下载安装
if (TextUtils.equals(carrierType, Constant.CARRIER_HIGH_ACTIVITY)) {
try {
val pkg = intent.getStringExtra("pkg")
try {
val pkg = intent.getStringExtra("pkg")
// 非高额任务不监听下载安装
if (TextUtils.equals(carrierType, Constant.CARRIER_HIGH_ACTIVITY)) {
mCurrentPkg = pkg
// ps.put(Constant.HIGH_TASK_PKG_NAME, pkg)
myPresenter.setHighTaskType("3")
} catch (e: Exception) {
e.printStackTrace()
} else if (TextUtils.equals(pkg, Constant.MCRS_PKG)) {
// 牧场人生APP,直接弹奖励框
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, downloadMCRSCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MC_FIRSTDOWNLOAD)
readyGo(AwardActivity::class.java, bundle)
return
}
} catch (e: Exception) {
e.printStackTrace()
}
}
}
......
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