fix 活动功能的绑定账号

This commit is contained in:
pc 2024-07-29 10:47:28 +08:00
parent 400ac6943e
commit 1618540d17
2 changed files with 71 additions and 16 deletions

View File

@ -33,9 +33,11 @@ import com.yingmao.clash.net.http.HttpReqType
import com.yingmao.clash.net.http.HttpStatus import com.yingmao.clash.net.http.HttpStatus
import com.yingmao.clash.net.http.entity.Activity_ import com.yingmao.clash.net.http.entity.Activity_
import com.yingmao.clash.net.http.entity.GetActivityRsp import com.yingmao.clash.net.http.entity.GetActivityRsp
import com.yingmao.clash.util.CommonUtils
import com.yingmao.clash.view.RxToast import com.yingmao.clash.view.RxToast
import com.yingmao.clash.view.adapter.GetActivityAdapter import com.yingmao.clash.view.adapter.GetActivityAdapter
import com.yingmao.clash.view.dialog.DialogBandChoose
class ActivityActivity : BaseActivity() { class ActivityActivity : BaseActivity() {
private lateinit var activityAtyVM: ActivityAtyVM private lateinit var activityAtyVM: ActivityAtyVM
@ -72,8 +74,14 @@ class ActivityActivity : BaseActivity() {
getActivityAdapter = getActivityAdapter =
GetActivityAdapter(R.layout.get_activity_item_layout, object : MyAdapterListener { GetActivityAdapter(R.layout.get_activity_item_layout, object : MyAdapterListener {
override fun onMyItemChildClickListener(itemBean: Activity_) { override fun onMyItemChildClickListener(itemBean: Activity_) {
if (itemBean.redirectLink.contains("BindAccount")) {
showBindAccDialog(itemBean)
} else {
showActDialog(itemBean) showActDialog(itemBean)
} }
}
}) })
getActivityAdapter.animationEnable = true getActivityAdapter.animationEnable = true
@ -83,9 +91,9 @@ class ActivityActivity : BaseActivity() {
private fun showActDialog(bean: Activity_) { private fun showActDialog(bean: Activity_) {
var command = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_VPN_UserCommand, "")!! var command = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_VPN_UserCommand, "")!!
if (TextUtils.isEmpty(command)){ // if (TextUtils.isEmpty(command)){
command=NewMainActivity.userCommand!! // command= MainApplication.getUserInfo()?.userCommand!!
} // }
command = "领会员${command}" command = "领会员${command}"
copyToClipboard(command) copyToClipboard(command)
var act_dialog = MaterialDialog(this@ActivityActivity).show { var act_dialog = MaterialDialog(this@ActivityActivity).show {
@ -113,16 +121,31 @@ class ActivityActivity : BaseActivity() {
} }
} }
private fun checkExpire(): Boolean { private fun showBindAccDialog(bean: Activity_) {
val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
if (validPeriod > 0) { var act_dialog = MaterialDialog(this@ActivityActivity).show {
var nowTime = System.currentTimeMillis(); this.cancelable(false)
com.yingmao.clash.common.log.Log.d("validPeriod==>$validPeriod, nowTime==>$nowTime") cornerRadius(res = R.dimen.dp_10)
if (validPeriod >= nowTime) { customView(
return false R.layout.act_dialog_layout,
scrollable = false,
noVerticalPadding = true,
horizontalPadding = false
)
val finshBut = getCustomView().findViewById<TextView>(R.id.tv_pay_finish)
finshBut.text = "绑定";
finshBut.setOnClickListener {
showBingDialogChoose()
dismiss()
} }
getCustomView().findViewById<TextView>(R.id.tv_pay_cancle).setOnClickListener {
dismiss()
}
getCustomView().findViewById<TextView>(R.id.act_dia_title).text = bean.title
getCustomView().findViewById<TextView>(R.id.tv_act_info).text = bean.content
getCustomView().findViewById<TextView>(R.id.tv_act_tz).visibility=View.GONE
getCustomView().findViewById<TextView>(R.id.tv_act_com).visibility=View.GONE
} }
return true;
} }
private fun goLink(url: String) { private fun goLink(url: String) {
@ -172,6 +195,18 @@ class ActivityActivity : BaseActivity() {
activityAtyVM.getActivity(mPageInfo) activityAtyVM.getActivity(mPageInfo)
} }
private fun showBingDialogChoose() {
val dialog = DialogBandChoose(this@ActivityActivity)
dialog.setOnBandClickListener(object : DialogBandChoose.OnBandClickListener {
override fun onBandClick(isPhone: Boolean) {
val intent = Intent(CommonUtils.getApp(), BandPhoneActivity::class.java)
intent.putExtra("isPhone", isPhone)
startActivity(intent)
}
})
dialog.show()
}
override fun httpLoading(httpStatus: HttpStatus.Loading) { override fun httpLoading(httpStatus: HttpStatus.Loading) {
if (httpStatus.reqType == HttpReqType.GetActivity) { if (httpStatus.reqType == HttpReqType.GetActivity) {
if (mPageInfo.isFirstPage) { if (mPageInfo.isFirstPage) {
@ -228,7 +263,7 @@ class ActivityActivity : BaseActivity() {
if (mPageInfo.isFirstPage) { if (mPageInfo.isFirstPage) {
swipeLayout.isRefreshing = true swipeLayout.isRefreshing = true
} }
RxToast.error("获取订单信息异常") RxToast.error("获取活动信息异常")
getActivityAdapter.loadMoreModule.loadMoreFail() getActivityAdapter.loadMoreModule.loadMoreFail()
} }
} }

View File

@ -51,8 +51,8 @@ subprojects {
minSdk = 21 minSdk = 21
//noinspection ExpiredTargetSdkVersion //noinspection ExpiredTargetSdkVersion
targetSdk = 31 targetSdk = 31
versionName = "1.0.1.0" versionName = "1.0.1.1"
versionCode = 1010 versionCode = 1011
resValue("string", "release_name", "v$versionName") resValue("string", "release_name", "v$versionName")
resValue("integer", "release_code", "$versionCode") resValue("integer", "release_code", "$versionCode")
externalNativeBuild { externalNativeBuild {
@ -284,6 +284,26 @@ subprojects {
) )
) )
} }
create("6507") {
isDefault = true
dimension = flavorDimensionList[0]
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
if (isApp) {
// applicationIdSuffix = ".meta"
}
buildConfigField("boolean", "is_back_cn", "false")
buildConfigField("boolean", "is_ym", "true")
buildConfigField("boolean", "is_free", "false")
buildConfigField("String", "applicationId", "\"com.yingmao.clash\"")
buildConfigField("String", "service_url", "\"https://api.yingmaovpnpro.win:18002\"")
buildConfigField("String", "productId", "\"6507\"")
manifestPlaceholders(
mapOf(
"APP_NAME" to "@string/app_name_gz", "APP_ICON" to "@mipmap/ic_logo_9972"
)
)
}
create("182242") { create("182242") {
isDefault = true isDefault = true
dimension = flavorDimensionList[0] dimension = flavorDimensionList[0]