mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Lambda parameters in a composable function should be in present tense, not past tense.
https://mrmans0n.github.io/compose-rules/rules/#naming-parameters-properly
This commit is contained in:
+6
-6
@@ -36,8 +36,8 @@ fun CrashDetectionView(
|
||||
if (state.crashDetected) {
|
||||
CrashDetectionContent(
|
||||
appName = state.appName,
|
||||
onYesClicked = onOpenBugReport,
|
||||
onNoClicked = ::onPopupDismissed,
|
||||
onYesClick = onOpenBugReport,
|
||||
onNoClick = ::onPopupDismissed,
|
||||
onDismiss = ::onPopupDismissed,
|
||||
)
|
||||
}
|
||||
@@ -46,8 +46,8 @@ fun CrashDetectionView(
|
||||
@Composable
|
||||
private fun CrashDetectionContent(
|
||||
appName: String,
|
||||
onNoClicked: () -> Unit = { },
|
||||
onYesClicked: () -> Unit = { },
|
||||
onNoClick: () -> Unit = { },
|
||||
onYesClick: () -> Unit = { },
|
||||
onDismiss: () -> Unit = { },
|
||||
) {
|
||||
ConfirmationDialog(
|
||||
@@ -55,8 +55,8 @@ private fun CrashDetectionContent(
|
||||
content = stringResource(id = R.string.crash_detection_dialog_content, appName),
|
||||
submitText = stringResource(id = CommonStrings.action_yes),
|
||||
cancelText = stringResource(id = CommonStrings.action_no),
|
||||
onCancelClicked = onNoClicked,
|
||||
onSubmitClicked = onYesClicked,
|
||||
onCancelClick = onNoClick,
|
||||
onSubmitClick = onYesClick,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
|
||||
+14
-14
@@ -50,16 +50,16 @@ fun RageshakeDetectionView(
|
||||
}
|
||||
when {
|
||||
state.takeScreenshot -> TakeScreenshot(
|
||||
onScreenshotTaken = { eventSink(RageshakeDetectionEvents.ProcessScreenshot(it)) }
|
||||
onScreenshot = { eventSink(RageshakeDetectionEvents.ProcessScreenshot(it)) }
|
||||
)
|
||||
state.showDialog -> {
|
||||
LaunchedEffect(Unit) {
|
||||
context.vibrate()
|
||||
}
|
||||
RageshakeDialogContent(
|
||||
onNoClicked = { eventSink(RageshakeDetectionEvents.Dismiss) },
|
||||
onDisableClicked = { eventSink(RageshakeDetectionEvents.Disable) },
|
||||
onYesClicked = onOpenBugReport
|
||||
onNoClick = { eventSink(RageshakeDetectionEvents.Dismiss) },
|
||||
onDisableClick = { eventSink(RageshakeDetectionEvents.Disable) },
|
||||
onYesClick = onOpenBugReport
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -67,22 +67,22 @@ fun RageshakeDetectionView(
|
||||
|
||||
@Composable
|
||||
private fun TakeScreenshot(
|
||||
onScreenshotTaken: (ImageResult) -> Unit
|
||||
onScreenshot: (ImageResult) -> Unit
|
||||
) {
|
||||
val view = LocalView.current
|
||||
val latestOnScreenshotTaken by rememberUpdatedState(onScreenshotTaken)
|
||||
val latestOnScreenshot by rememberUpdatedState(onScreenshot)
|
||||
LaunchedEffect(Unit) {
|
||||
view.screenshot {
|
||||
latestOnScreenshotTaken(it)
|
||||
latestOnScreenshot(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RageshakeDialogContent(
|
||||
onNoClicked: () -> Unit = { },
|
||||
onDisableClicked: () -> Unit = { },
|
||||
onYesClicked: () -> Unit = { },
|
||||
onNoClick: () -> Unit = { },
|
||||
onDisableClick: () -> Unit = { },
|
||||
onYesClick: () -> Unit = { },
|
||||
) {
|
||||
ConfirmationDialog(
|
||||
title = stringResource(id = CommonStrings.action_report_bug),
|
||||
@@ -90,10 +90,10 @@ private fun RageshakeDialogContent(
|
||||
thirdButtonText = stringResource(id = CommonStrings.action_disable),
|
||||
submitText = stringResource(id = CommonStrings.action_yes),
|
||||
cancelText = stringResource(id = CommonStrings.action_no),
|
||||
onCancelClicked = onNoClicked,
|
||||
onThirdButtonClicked = onDisableClicked,
|
||||
onSubmitClicked = onYesClicked,
|
||||
onDismiss = onNoClicked,
|
||||
onCancelClick = onNoClick,
|
||||
onThirdButtonClick = onDisableClick,
|
||||
onSubmitClick = onYesClick,
|
||||
onDismiss = onNoClick,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -51,8 +51,8 @@ class BugReportNode @AssistedInject constructor(
|
||||
BugReportView(
|
||||
state = state,
|
||||
modifier = modifier,
|
||||
onBackPressed = { navigateUp() },
|
||||
onDone = {
|
||||
onBackClick = { navigateUp() },
|
||||
onSuccess = {
|
||||
activity?.toast(CommonStrings.common_report_submitted)
|
||||
onDone()
|
||||
},
|
||||
|
||||
+6
-6
@@ -57,8 +57,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||
fun BugReportView(
|
||||
state: BugReportState,
|
||||
onViewLogs: () -> Unit,
|
||||
onDone: () -> Unit,
|
||||
onBackPressed: () -> Unit,
|
||||
onSuccess: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val eventSink = state.eventSink
|
||||
@@ -66,7 +66,7 @@ fun BugReportView(
|
||||
Box(modifier = modifier) {
|
||||
PreferencePage(
|
||||
title = stringResource(id = CommonStrings.common_report_a_problem),
|
||||
onBackPressed = onBackPressed
|
||||
onBackClick = onBackClick
|
||||
) {
|
||||
val isFormEnabled = state.sending !is AsyncAction.Loading
|
||||
var descriptionFieldState by textFieldState(
|
||||
@@ -163,7 +163,7 @@ fun BugReportView(
|
||||
progressDialog = { },
|
||||
onSuccess = {
|
||||
eventSink(BugReportEvents.ResetAll)
|
||||
onDone()
|
||||
onSuccess()
|
||||
},
|
||||
errorMessage = { error ->
|
||||
when (error) {
|
||||
@@ -181,8 +181,8 @@ fun BugReportView(
|
||||
internal fun BugReportViewPreview(@PreviewParameter(BugReportStateProvider::class) state: BugReportState) = ElementPreview {
|
||||
BugReportView(
|
||||
state = state,
|
||||
onDone = {},
|
||||
onBackPressed = {},
|
||||
onSuccess = {},
|
||||
onBackClick = {},
|
||||
onViewLogs = {},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user