mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
fix: snackbar and restarts bug
This commit is contained in:
@@ -204,7 +204,7 @@ class MainActivity : AppCompatActivity() {
|
||||
SnackbarInfo(
|
||||
message =
|
||||
buildAnnotatedString {
|
||||
sideEffect.message.asString(context)
|
||||
append(sideEffect.message.asString(context))
|
||||
},
|
||||
type = sideEffect.type ?: SnackbarType.INFO,
|
||||
durationMs = sideEffect.durationMs ?: 4000L,
|
||||
|
||||
@@ -74,14 +74,14 @@ constructor(
|
||||
if (tunnelConfig != null) {
|
||||
tunnelRepository.save(tunnelConfig)
|
||||
|
||||
if (state.isRunning) tunnelManager.restartActiveTunnel(tunnelConfig.id)
|
||||
|
||||
postSideEffect(
|
||||
GlobalSideEffect.Toast(
|
||||
StringValue.StringResource(R.string.config_changes_saved)
|
||||
)
|
||||
)
|
||||
postSideEffect(GlobalSideEffect.PopBackStack)
|
||||
|
||||
if (state.isRunning) tunnelManager.restartActiveTunnel(tunnelConfig.id)
|
||||
}
|
||||
}
|
||||
.onFailure {
|
||||
|
||||
+5
-5
@@ -39,11 +39,6 @@ constructor(
|
||||
reduce { state.copy(showSaveModal = false) }
|
||||
lockdownSettingsRepository.upsert(lockdownSettings)
|
||||
|
||||
postSideEffect(GlobalSideEffect.PopBackStack)
|
||||
postSideEffect(
|
||||
GlobalSideEffect.Toast(StringValue.StringResource(R.string.config_changes_saved))
|
||||
)
|
||||
|
||||
tunnelManager.setBackendMode(BackendMode.Inactive)
|
||||
val allowedIps =
|
||||
if (lockdownSettings.bypassLan) TunnelConfig.LAN_BYPASS_ALLOWED_IPS else emptySet()
|
||||
@@ -54,6 +49,11 @@ constructor(
|
||||
dualStack = lockdownSettings.dualStack,
|
||||
)
|
||||
)
|
||||
|
||||
postSideEffect(GlobalSideEffect.PopBackStack)
|
||||
postSideEffect(
|
||||
GlobalSideEffect.Toast(StringValue.StringResource(R.string.config_changes_saved))
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun postSideEffect(globalSideEffect: GlobalSideEffect) {
|
||||
|
||||
+2
-2
@@ -111,12 +111,12 @@ constructor(
|
||||
|
||||
proxySettingsRepository.upsert(updated)
|
||||
|
||||
if (state.activeTuns.isNotEmpty()) tunnelManager.restartActiveTunnels()
|
||||
|
||||
postSideEffect(
|
||||
GlobalSideEffect.Snackbar(StringValue.StringResource(R.string.config_changes_saved))
|
||||
)
|
||||
postSideEffect(GlobalSideEffect.PopBackStack)
|
||||
|
||||
if (state.activeTuns.isNotEmpty()) tunnelManager.restartActiveTunnels()
|
||||
}
|
||||
|
||||
fun clearHttpBindError() = intent { reduce { state.copy(isHttpBindAddressError = false) } }
|
||||
|
||||
Reference in New Issue
Block a user