bug fix :1.单点登录 充值界面检测登录状态改变之后退出到登录页面
         2.用户使用状态上传由10s改为60s
         3.内核删除文件后等待初始化提示完成提示
This commit is contained in:
level 2025-07-01 17:21:57 +08:00
parent c55d282acc
commit 2f240e85a5
8 changed files with 24 additions and 21 deletions

View File

@ -105,11 +105,10 @@ class MemberRechargeActivity : BaseActivity() {
mainAtyVM = ViewModelProvider(this)[MainAtyVM::class.java] mainAtyVM = ViewModelProvider(this)[MainAtyVM::class.java]
val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD) val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
setExpireDate(validPeriod) setExpireDate(validPeriod)
android.util.Log.i("AAAAAAAAAAA:","isvip::"+ isVip)
if (isVip) { if (isVip) {
userIdentity.text = resources.getString(R.string.TemporaryUser)
} else {
userIdentity.text = resources.getString(R.string.VIPMember) userIdentity.text = resources.getString(R.string.VIPMember)
} else {
userIdentity.text = resources.getString(R.string.TemporaryUser)
} }
userIdentityNumber.text = userIdentityNumber.text =
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME) MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME)
@ -667,6 +666,7 @@ class MemberRechargeActivity : BaseActivity() {
if (clashRunning) { if (clashRunning) {
HomeFragment().stopClash() HomeFragment().stopClash()
} }
UIMainActivity.isSubbed=false
mainAtyVM.stopHeartBeat() mainAtyVM.stopHeartBeat()
cleanProfile() cleanProfile()
val intent=Intent(CommonUtils.getApp(), LoginActivity::class.java) val intent=Intent(CommonUtils.getApp(), LoginActivity::class.java)

View File

@ -113,7 +113,6 @@ class UIMainActivity : BaseActivity() {
var profileBinder: IProfileManager? = null var profileBinder: IProfileManager? = null
var isUpload: Boolean = false var isUpload: Boolean = false
var hostsMem: ArrayList<String> = ArrayList() var hostsMem: ArrayList<String> = ArrayList()
var isSubed = false
var newMainActGlo: Boolean = false var newMainActGlo: Boolean = false
var isVip:Boolean=false var isVip:Boolean=false
} }
@ -320,7 +319,6 @@ class UIMainActivity : BaseActivity() {
val expensesRecordList = expensesRecordRsp.data.expensesRecords val expensesRecordList = expensesRecordRsp.data.expensesRecords
if(expensesRecordList!=null){ if(expensesRecordList!=null){
if(expensesRecordList.size>0){ if(expensesRecordList.size>0){
android.util.Log.i("AAAAAAAA:","data::"+expensesRecordList.size)
isVip=true isVip=true
}else{ }else{
isVip=false isVip=false
@ -391,6 +389,7 @@ class UIMainActivity : BaseActivity() {
if (clashRunning) { if (clashRunning) {
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() } fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
} }
isSubbed=false
stopUploadTimer() stopUploadTimer()
mainAtyVM.stopHeartBeat() mainAtyVM.stopHeartBeat()
cleanProfile() cleanProfile()
@ -725,6 +724,7 @@ class UIMainActivity : BaseActivity() {
if (clashRunning) { if (clashRunning) {
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() } fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
} }
isSubbed=false
stopUploadTimer() stopUploadTimer()
mainAtyVM.stopHeartBeat() mainAtyVM.stopHeartBeat()
cleanProfile() cleanProfile()

View File

@ -45,7 +45,7 @@ import com.yingmao.clash.act.ConnectionModeActivity
import com.yingmao.clash.act.LoginActivity import com.yingmao.clash.act.LoginActivity
import com.yingmao.clash.act.UIMainActivity import com.yingmao.clash.act.UIMainActivity
import com.yingmao.clash.act.UIMainActivity.Companion.clashBinder import com.yingmao.clash.act.UIMainActivity.Companion.clashBinder
import com.yingmao.clash.act.UIMainActivity.Companion.isSubed import com.yingmao.clash.act.UIMainActivity.Companion.isSubbed
import com.yingmao.clash.act.UIMainActivity.Companion.newMainActGlo import com.yingmao.clash.act.UIMainActivity.Companion.newMainActGlo
import com.yingmao.clash.act.UIMainActivity.Companion.newUuid import com.yingmao.clash.act.UIMainActivity.Companion.newUuid
import com.yingmao.clash.act.UIMainActivity.Companion.profileBinder import com.yingmao.clash.act.UIMainActivity.Companion.profileBinder
@ -261,7 +261,13 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
} }
rxDialogSureCancel.show() rxDialogSureCancel.show()
} else { } else {
startClash() android.util.Log.i("AAAAAAAAAAAAA::","data isSubbed::: "+isSubbed)
if(isSubbed){
startClash()
}else{
RxToast.success(resources.getString(R.string.tooFast))
}
} }
} }
clActivity.setOnClickListener { clActivity.setOnClickListener {
@ -277,7 +283,7 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
var selected_name = var selected_name =
MMKV.defaultMMKV().decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, ""); MMKV.defaultMMKV().decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "")
if (!TextUtils.isEmpty(selected_name)) { if (!TextUtils.isEmpty(selected_name)) {
if (!BuildConfig.is_tz){ if (!BuildConfig.is_tz){
setNodeNameAndImg(selected_name!!) setNodeNameAndImg(selected_name!!)
@ -526,14 +532,12 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
pm.setActive(profile) pm.setActive(profile)
newUuid = profile.uuid.toString() newUuid = profile.uuid.toString()
isSubed = true
} ?: run { } ?: run {
//为空的情况下选择第一个 //为空的情况下选择第一个
pm.queryAll().forEach { profile -> pm.queryAll().forEach { profile ->
pm.setActive(profile) pm.setActive(profile)
newUuid = profile.uuid.toString() newUuid = profile.uuid.toString()
isSubed = true
return@forEach return@forEach
} }
} }

View File

@ -57,7 +57,6 @@ import com.yingmao.clash.act.ShareActivity
import com.yingmao.clash.act.SplashActivity import com.yingmao.clash.act.SplashActivity
import com.yingmao.clash.act.SplashHelper import com.yingmao.clash.act.SplashHelper
import com.yingmao.clash.act.UIMainActivity import com.yingmao.clash.act.UIMainActivity
import com.yingmao.clash.act.UIMainActivity.Companion.isSubed
import com.yingmao.clash.act.UIMainActivity.Companion.isVip import com.yingmao.clash.act.UIMainActivity.Companion.isVip
import com.yingmao.clash.act.UIMainActivity.Companion.newUuid import com.yingmao.clash.act.UIMainActivity.Companion.newUuid
import com.yingmao.clash.act.UIMainActivity.Companion.profileBinder import com.yingmao.clash.act.UIMainActivity.Companion.profileBinder
@ -259,9 +258,9 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
setExpireDate() setExpireDate()
if (isVip) { if (isVip) {
userIdentity.text = requireActivity().resources.getString(R.string.TemporaryUser)
} else {
userIdentity.text = requireActivity().resources.getString(R.string.VIPMember) userIdentity.text = requireActivity().resources.getString(R.string.VIPMember)
} else {
userIdentity.text = requireActivity().resources.getString(R.string.TemporaryUser)
} }
userIdentityNumber.text = userIdentityNumber.text =
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME) MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME)
@ -338,6 +337,7 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
launch(Dispatchers.IO) { launch(Dispatchers.IO) {
profileBinder?.let { pm -> profileBinder?.let { pm ->
pm.queryAll().forEach { profile -> pm.queryAll().forEach { profile ->
Log.d("setting profile delete ==>${profile.name}") Log.d("setting profile delete ==>${profile.name}")
pm.delete(profile.uuid) pm.delete(profile.uuid)
} }
@ -637,6 +637,7 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand) MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY) MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL) MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
UIMainActivity.isSubbed=false
Log.d("cleanUserInfo clashRunning==>${clashRunning}") Log.d("cleanUserInfo clashRunning==>${clashRunning}")
if (clashRunning) { if (clashRunning) {
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() } fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
@ -825,7 +826,6 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
delay(500) delay(500)
pm.update(it.uuid) pm.update(it.uuid)
newUuid = pro.uuid.toString() newUuid = pro.uuid.toString()
isSubed = true
} ?: run { } ?: run {
val uuid: UUID = pm.create( val uuid: UUID = pm.create(
Profile.Type.Url, Conf.getClashConfName(requireActivity().applicationContext) Profile.Type.Url, Conf.getClashConfName(requireActivity().applicationContext)
@ -844,7 +844,6 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
) )
} }
newUuid = qPro.uuid.toString() newUuid = qPro.uuid.toString()
isSubed = true
// } // }
} }
} }
@ -904,7 +903,7 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
Log.d("new main actname==>" + actName) Log.d("new main actname==>" + actName)
pm.setActive(it) pm.setActive(it)
newUuid = pro.uuid.toString(); newUuid = pro.uuid.toString();
isSubed = true UIMainActivity.isSubbed = true
Log.d("setSub2 setActive end") Log.d("setSub2 setActive end")
finishInit() finishInit()
} ?: run { } ?: run {
@ -925,7 +924,7 @@ class SettingFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatc
) )
} }
newUuid = qPro.uuid.toString(); newUuid = qPro.uuid.toString();
isSubed = true UIMainActivity.isSubbed = true
// } // }
} }
finishInit() finishInit()

View File

@ -359,5 +359,5 @@ Service Description\n
<string name="email_or_phone_register">Email registration</string> <string name="email_or_phone_register">Email registration</string>
<string name="CZHY">Recharge Membership</string> <string name="CZHY">Recharge Membership</string>
<string name="LoginOut">It is detected that the current account is logged in on other devices. If it is not your own operation, please change the password immediately and log out of the unfamiliar device.</string> <string name="LoginOut">It is detected that the current account is logged in on other devices. If it is not your own operation, please change the password immediately and log out of the unfamiliar device.</string>
<string name="tooFast">The application is initializing. Please wait for 1~2 seconds and try again.</string>
</resources> </resources>

View File

@ -350,5 +350,5 @@
<string name="CZHY">充值會員</string> <string name="CZHY">充值會員</string>
<string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string> <string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string>
<string name="tooFast">應用初始化中,請等待1~2秒後重試</string>
</resources> </resources>

View File

@ -348,5 +348,5 @@
<string name="email_or_phone_register">手動注册</string> <string name="email_or_phone_register">手動注册</string>
<string name="CZHY">充值會員</string> <string name="CZHY">充值會員</string>
<string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string> <string name="LoginOut">檢測到當前賬號在其他設備登錄,如非本人操作,請立即修改密碼並退出陌生設備。</string>
<string name="tooFast">應用初始化中,請等待1~2秒後重試</string>
</resources> </resources>

View File

@ -370,5 +370,5 @@
<string name="CZHY">充值会员</string> <string name="CZHY">充值会员</string>
<string name="LoginOut">检测到当前账号在其他设备登录,如非本人操作,请立即修改密码并退出陌生设备。</string> <string name="LoginOut">检测到当前账号在其他设备登录,如非本人操作,请立即修改密码并退出陌生设备。</string>
<string name="tooFast">应用初始化中,请等待1~2秒后重试</string>
</resources> </resources>