diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2020-09-16 18:30:34 +0530 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-09-16 18:01:06 +0200 |
commit | bd1679b7e0db627afe37f6b1e7c47997a348f3e8 (patch) | |
tree | 37a027eaf1ed3490aeb645bb7ef630e3c21d5b69 /ui | |
parent | ff7d7e0edd9fbcafeea3bfb56c8d3a1f136efb56 (diff) |
ui: await activity creation to change selected tunnel
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/activity/BaseActivity.kt | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/ui/src/main/java/com/wireguard/android/activity/BaseActivity.kt b/ui/src/main/java/com/wireguard/android/activity/BaseActivity.kt index 95af26fd..a9f118ca 100644 --- a/ui/src/main/java/com/wireguard/android/activity/BaseActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/BaseActivity.kt @@ -10,7 +10,6 @@ import androidx.databinding.CallbackRegistry.NotifierCallback import androidx.lifecycle.lifecycleScope import com.wireguard.android.Application import com.wireguard.android.model.ObservableTunnel -import kotlinx.coroutines.launch /** * Base class for activities that need to remember the currently-selected tunnel. @@ -38,7 +37,7 @@ abstract class BaseActivity : ThemeChangeAwareActivity() { else -> 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. super.onCreate(savedInstanceState) |