Skip to content

Commit d9c549a

Browse files
committed
Bug 2024167 - Added haptic feedback on summary in s2s
1 parent c1e060f commit d9c549a

File tree

1 file changed

+10
-0
lines changed
  • mobile/android/android-components/components/feature/summarize/src/main/java/mozilla/components/feature/summarize

1 file changed

+10
-0
lines changed

mobile/android/android-components/components/feature/summarize/src/main/java/mozilla/components/feature/summarize/SummarizationScreen.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import androidx.compose.ui.Alignment
2626
import androidx.compose.ui.Modifier
2727
import androidx.compose.ui.draw.clip
2828
import androidx.compose.ui.graphics.Color
29+
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
2930
import androidx.compose.ui.input.nestedscroll.nestedScroll
31+
import androidx.compose.ui.platform.LocalHapticFeedback
3032
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
3133
import androidx.compose.ui.tooling.preview.PreviewParameter
3234
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@@ -86,8 +88,16 @@ private fun SummarizationScreen(
8688
store: SummarizationStore,
8789
settingsStore: SummarizeSettingsStore? = null,
8890
) {
91+
val haptic = LocalHapticFeedback.current
92+
8993
val state by store.stateFlow.collectAsStateWithLifecycle()
9094

95+
LaunchedEffect(state) {
96+
if (state is SummarizationState.Summarized) {
97+
haptic.performHapticFeedback(HapticFeedbackType.Confirm)
98+
}
99+
}
100+
91101
SummarizationScreenScaffold(
92102
modifier = modifier
93103
.thenConditional(Modifier.summaryLoadingGradient()) {

0 commit comments

Comments
 (0)