fix deprecated resume call in AlertDialogExtensions (#4775)
This commit is contained in:
parent
d3feca3a10
commit
bc397e993d
1 changed files with 1 additions and 3 deletions
|
|
@ -20,7 +20,6 @@ package com.keylesspalace.tusky.util
|
|||
import android.content.DialogInterface
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
|
||||
/**
|
||||
|
|
@ -30,14 +29,13 @@ import kotlinx.coroutines.suspendCancellableCoroutine
|
|||
* @param negativeText Optional text to show on the negative button
|
||||
* @param neutralText Optional text to show on the neutral button
|
||||
*/
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
suspend fun AlertDialog.await(
|
||||
positiveText: String,
|
||||
negativeText: String? = null,
|
||||
neutralText: String? = null
|
||||
) = suspendCancellableCoroutine { cont ->
|
||||
val listener = DialogInterface.OnClickListener { _, which ->
|
||||
cont.resume(which) { dismiss() }
|
||||
cont.resume(which) { _, _, _ -> dismiss() }
|
||||
}
|
||||
|
||||
setButton(AlertDialog.BUTTON_POSITIVE, positiveText, listener)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue