mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Always use the latest... fix.
This commit is contained in:
committed by
Benoit Marty
parent
3ced570b3c
commit
eb51b49aef
+5
-2
@@ -18,6 +18,8 @@ package io.element.android.features.rageshake.api.detection
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -73,9 +75,10 @@ private fun TakeScreenshot(
|
||||
onScreenshotTaken: (ImageResult) -> Unit
|
||||
) {
|
||||
val view = LocalView.current
|
||||
LaunchedEffect(onScreenshotTaken) {
|
||||
val latestOnScreenshotTaken by rememberUpdatedState(onScreenshotTaken)
|
||||
LaunchedEffect(Unit) {
|
||||
view.screenshot {
|
||||
onScreenshotTaken(it)
|
||||
latestOnScreenshotTaken(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user