ui: await activity creation to change selected tunnel
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
ff7d7e0edd
commit
bd1679b7e0
@ -10,7 +10,6 @@ import androidx.databinding.CallbackRegistry.NotifierCallback
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.wireguard.android.Application
|
import com.wireguard.android.Application
|
||||||
import com.wireguard.android.model.ObservableTunnel
|
import com.wireguard.android.model.ObservableTunnel
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for activities that need to remember the currently-selected tunnel.
|
* Base class for activities that need to remember the currently-selected tunnel.
|
||||||
@ -38,7 +37,7 @@ abstract class BaseActivity : ThemeChangeAwareActivity() {
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (savedTunnelName != null)
|
if (savedTunnelName != null)
|
||||||
lifecycleScope.launch { selectedTunnel = Application.getTunnelManager().getTunnels()[savedTunnelName] }
|
lifecycleScope.launchWhenCreated { selectedTunnel = Application.getTunnelManager().getTunnels()[savedTunnelName] }
|
||||||
|
|
||||||
// The selected tunnel must be set before the superclass method recreates fragments.
|
// The selected tunnel must be set before the superclass method recreates fragments.
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
Loading…
Reference in New Issue
Block a user