一键连

1.新增节点获取失败后在次获取节点数据的逻辑
This commit is contained in:
level 2025-12-11 12:12:02 +08:00
parent 71e496fa4e
commit 05ee01c7d4
5 changed files with 37 additions and 21 deletions

View File

@ -375,29 +375,36 @@ open class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispa
}
private fun startClash(isStart: Boolean) {
launch {
profileBinder?.let { pm ->
val active = pm.queryActive()
if (active == null) {
if (isStart) {
delay(2000)
}
Log.d("startClash: 未选择")
val pro = pm.queryAll().find {
it.name == Conf.getClashConfName(this@HomeFragment.context)
}
val nodeJson=serStore.nodes
Log.d("nodeJson: ${nodeJson.isEmpty()}")
if(nodeJson.isEmpty()){
RxToast.info(resources.getString(R.string.GetNodesAgined))
refreshNode()
hideLoading()
}else{
launch {
profileBinder?.let { pm ->
val active = pm.queryActive()
if (active == null) {
if (isStart) {
delay(2000)
}
Log.d("startClash: 未选择")
val pro = pm.queryAll().find {
it.name == Conf.getClashConfName(this@HomeFragment.context)
}
pro?.let { profile ->
Log.d("new setactive name " + profile.name)
pm.setActive(profile)
newUuid = profile.uuid.toString()
isSubbed = true
} ?: run {
//为空的情况下选择第一个
pm.queryAll().forEach { profile ->
pro?.let { profile ->
Log.d("new setactive name " + profile.name)
pm.setActive(profile)
newUuid = profile.uuid.toString()
isSubbed = true
} ?: run {
//为空的情况下选择第一个
pm.queryAll().forEach { profile ->
pm.setActive(profile)
newUuid = profile.uuid.toString()
isSubbed = true
return@forEach
@ -431,11 +438,13 @@ open class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispa
ivAccelerate.setImageResource(R.mipmap.yjl_home_clink_select_bg)
hideLoading()
// checkGlo()
}
}
}
}
}
}
private val nextRequestKey = AtomicInteger(0)
@ -748,6 +757,9 @@ open class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispa
cm.patchSelector("GLOBAL", baseNodeName)
}
}
}else{
RxToast.info(resources.getString(R.string.GetNodesAgined))
refreshNode()
}
}
} else {

View File

@ -424,4 +424,5 @@ In order to implement and strengthen awareness of personal information security
<string name="closeRunningChoose">Please disconnect and switch modes</string>
<string name="OpenSwitchingSourceModel">Please enable acceleration before switching to global mode</string>
<string name="GolbalModeNoChoose">Switching nodes is not currently supported in global acceleration mode. Please switch to smart mode!</string>
<string name="GetNodesAgined">Getting nodes, please click to speed up later</string>
</resources>

View File

@ -416,4 +416,5 @@
<string name="closeRunningChoose">請斷開連線後在進行模式切換</string>
<string name="OpenSwitchingSourceModel">請開啟加速後在進行全域模式切換</string>
<string name="GolbalModeNoChoose">全域模式加速下暫不支援切換節點,請切換至智慧模式!</string>
<string name="GetNodesAgined">取得節點中,請稍後點選加速</string>
</resources>

View File

@ -414,4 +414,5 @@
<string name="closeRunningChoose">請斷開連線後在進行模式切換</string>
<string name="OpenSwitchingSourceModel">請開啟加速後在進行全域模式切換</string>
<string name="GolbalModeNoChoose">全域模式加速下暫不支援切換節點,請切換至智慧模式!</string>
<string name="GetNodesAgined">取得節點中,請稍後點選加速</string>
</resources>

View File

@ -481,4 +481,5 @@
<string name="LinkSharetxt">点击分享</string>
<string name="OpenSwitchingSourceModel">请开启加速后在进行全局模式切换</string>
<string name="GolbalModeNoChoose">全局模式加速下暂不支持切换节点,请切换至智能模式!</string>
<string name="GetNodesAgined">获取节点中,请稍后点击加速</string>
</resources>