Snackbar: SnackbarDispatcher.post does not need to be suspend.
This commit is contained in:
parent
d909bb0c3d
commit
1ecb704e24
4 changed files with 6 additions and 10 deletions
|
|
@ -45,7 +45,7 @@ class LoggedInEventProcessor @Inject constructor(
|
|||
observingJob = null
|
||||
}
|
||||
|
||||
private suspend fun displayMessage(message: Int) {
|
||||
private fun displayMessage(message: Int) {
|
||||
snackbarDispatcher.post(SnackbarMessage(message))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private suspend fun handleCopyContents(event: TimelineItem.Event) {
|
||||
private fun handleCopyContents(event: TimelineItem.Event) {
|
||||
val content = when (event.content) {
|
||||
is TimelineItemTextBasedContent -> event.content.body
|
||||
is TimelineItemStateContent -> event.content.body
|
||||
|
|
@ -496,7 +496,7 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun handleCopyCaption(event: TimelineItem.Event) {
|
||||
private fun handleCopyCaption(event: TimelineItem.Event) {
|
||||
val content = (event.content as? TimelineItemEventContentWithAttachment)?.caption ?: return
|
||||
clipboardHelper.copyPlainText(content)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
package io.element.android.features.securebackup.impl.setup
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
|
|
@ -22,8 +21,6 @@ import io.element.android.libraries.architecture.inputs
|
|||
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
|
||||
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarMessage
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@ContributesNode(SessionScope::class)
|
||||
class SecureBackupSetupNode @AssistedInject constructor(
|
||||
|
|
@ -42,12 +39,11 @@ class SecureBackupSetupNode @AssistedInject constructor(
|
|||
|
||||
@Composable
|
||||
override fun View(modifier: Modifier) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val state = presenter.present()
|
||||
SecureBackupSetupView(
|
||||
state = state,
|
||||
onSuccess = {
|
||||
coroutineScope.postSuccessSnackbar()
|
||||
postSuccessSnackbar()
|
||||
navigateUp()
|
||||
},
|
||||
onBackClick = ::navigateUp,
|
||||
|
|
@ -55,7 +51,7 @@ class SecureBackupSetupNode @AssistedInject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun CoroutineScope.postSuccessSnackbar() = launch {
|
||||
private fun postSuccessSnackbar() {
|
||||
snackbarDispatcher.post(
|
||||
SnackbarMessage(
|
||||
messageResId = if (inputs.isChangeRecoveryKeyUserStory) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class SnackbarDispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
suspend fun post(message: SnackbarMessage) {
|
||||
fun post(message: SnackbarMessage) {
|
||||
if (snackBarMessageQueue.isEmpty()) {
|
||||
snackBarMessageQueue.add(message)
|
||||
if (queueMutex.isLocked) queueMutex.unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue