一键连

更改获取节点时长
This commit is contained in:
11111 2026-03-05 17:22:37 +08:00
parent 995c73b991
commit be8f8e7fd9
1 changed files with 3 additions and 28 deletions

View File

@ -291,7 +291,7 @@ class NodeGroupActivity : BaseActivity(){
}
}
fun doProfile() {
showLoading("正在获取...", this@NodeGroupActivity)
showLoading("获取节点中,请耐心等待", this@NodeGroupActivity)
startTimer()
launch(Dispatchers.IO) {
setSub2(nowSubUrl)
@ -299,7 +299,7 @@ class NodeGroupActivity : BaseActivity(){
}
fun nextDoProfile() {
showLoading("正在获取...", this@NodeGroupActivity)
showLoading("获取节点中,请耐心等待", this@NodeGroupActivity)
startTimer()
launch(Dispatchers.IO) {
setSub2(nowSubUrl)
@ -334,41 +334,16 @@ class NodeGroupActivity : BaseActivity(){
}
}
private fun startTimer() {
getNodeTimeOutNum = 15
getNodeTimeOutNum = 10
timerJob = launch {
repeat(16) {
Log.d("GetNodeTimeOutNum==>$getNodeTimeOutNum")
if (getNodeTimeOutNum == 0) {
// hideLoading()
// RxToast.error("获取节点失败...正在切换其他地址")
// if (setNewData()) {
// timerJob?.cancel()
// MMKV.defaultMMKV()
// .removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
// saveSubUrl()
// MainApplication.restartApp(this@NodeGroupActivity, object :
// MainApplication.OnRestartButtonListener {
//
// override fun enterButton() {
//
// }
//
// override fun cancelButton() {
// doProfile()
// }
//
// })
// } else {
// timerJob?.cancel()
// RxToast.error("获取全部线路失败...请切换网络重试")
// }
hideLoading()
//更换其他地址的头部用于订阅链接的头部,看下能不能更换成功
if(switchServer2()){
timerJob?.cancel()
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
saveSubUrl()
Log.i("KKKKKKKKKKKKKK data:${nowSubUrl}")
nextDoProfile()
}else{
val userExpireDialog= MaterialDialog(this@NodeGroupActivity).apply {