reconnect wbstream on a tunnel lost
This commit is contained in:
1 parent
c037fb211f
commit
cfb9b4c8f7
14 files changed
+262
-60
No files matched your search
Binary file not shown.
@@ -84,6 +84,7 @@ class HeadlessRelayController(
|
||||
when {
|
||||
status == "READY" -> onStatus(VpnStatus.STARTING)
|
||||
status == "CONNECTING" -> onStatus(VpnStatus.CONNECTING)
|
||||
status == "RECONNECTING" -> onStatus(VpnStatus.CONNECTING)
|
||||
status == "TUNNEL_CONNECTED" -> onStatus(VpnStatus.TUNNEL_ACTIVE)
|
||||
status == "TUNNEL_LOST" -> onStatus(VpnStatus.TUNNEL_LOST)
|
||||
status.startsWith("CAPTCHA:") -> {
|
||||
|
||||
@@ -44,7 +44,7 @@ class MainFragment : Fragment(R.layout.fragment_main_screen) {
|
||||
AddDestinationSheet.show(parentFragmentManager)
|
||||
}
|
||||
container.onHeroPressed = {
|
||||
if (isHostConnected()) {
|
||||
if (isHostConnected() || isHostConnecting()) {
|
||||
host()?.onDisconnectPressed()
|
||||
} else {
|
||||
val active = Prefs.activeDestination
|
||||
@@ -181,6 +181,14 @@ class MainFragment : Fragment(R.layout.fragment_main_screen) {
|
||||
|
||||
private fun isHostConnected(): Boolean = host()?.isTunnelActive() ?: false
|
||||
|
||||
private fun isHostConnecting(): Boolean = when (hostStatus()) {
|
||||
VpnStatus.CONNECTING,
|
||||
VpnStatus.STARTING,
|
||||
VpnStatus.CALL_CONNECTED,
|
||||
VpnStatus.DATACHANNEL_OPEN -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
private fun hostStatus(): VpnStatus? = host()?.currentStatus()
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -12,6 +12,7 @@ import bypass.whitelist.tunnel.CallConfig
|
||||
import bypass.whitelist.tunnel.VpnStatus
|
||||
import bypass.whitelist.util.Callback
|
||||
import bypass.whitelist.util.ParamCallback
|
||||
import bypass.whitelist.util.Prefs
|
||||
|
||||
class MainFragmentView(private val root: View) {
|
||||
|
||||
@@ -183,7 +184,11 @@ class MainFragmentView(private val root: View) {
|
||||
|
||||
fun bindStatus(status: VpnStatus) {
|
||||
val labelRes = status.labelRes
|
||||
statusDetail.text = root.context.getString(labelRes)
|
||||
statusDetail.text = if (status == VpnStatus.PORT_BUSY) {
|
||||
root.context.getString(labelRes, Prefs.socksPort)
|
||||
} else {
|
||||
root.context.getString(labelRes)
|
||||
}
|
||||
}
|
||||
|
||||
fun bindStatusText(text: String) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user