Skip to content

Commit

Permalink
Remove usage of deprecated launchWhenCreated()
Browse files Browse the repository at this point in the history
  • Loading branch information
gujjwal00 committed Dec 26, 2023
1 parent 8181c6b commit 85f7e75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
* Server Profile Editor. It can be opened in two modes:
Expand Down Expand Up @@ -311,7 +312,7 @@ class ProfileEditorFragment : DialogFragment() {
encrypted = isPrivateKeyEncrypted(key)
}

lifecycleScope.launchWhenCreated {
withContext(Dispatchers.Main) {
result.onSuccess {
profile.sshPrivateKey = key
binding.keyImportBtn.setText(R.string.title_change)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/gaurav/avnc/ui/vnc/VncActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class VncActivity : AppCompatActivity() {
if (isConnected && !viewModel.pref.runInfo.hasConnectedSuccessfully) {
viewModel.pref.runInfo.hasConnectedSuccessfully = true
binding.drawerLayout.openDrawer(binding.primaryToolbar)
lifecycleScope.launchWhenCreated {
lifecycleScope.launch {
delay(1500)
binding.drawerLayout.closeDrawer(binding.primaryToolbar)
}
Expand Down

0 comments on commit 85f7e75

Please sign in to comment.