From 626b47e477a6920e90dad9fa8624a663e69c8b87 Mon Sep 17 00:00:00 2001 From: Suhas Dissanayake Date: Wed, 24 Apr 2024 13:48:55 +0530 Subject: [PATCH] fix: ringtone picker not stopping playback when closed --- .../clock/presentation/features/RingtonePickerDialog.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/bnyro/clock/presentation/features/RingtonePickerDialog.kt b/app/src/main/java/com/bnyro/clock/presentation/features/RingtonePickerDialog.kt index 7133af36..4253069c 100644 --- a/app/src/main/java/com/bnyro/clock/presentation/features/RingtonePickerDialog.kt +++ b/app/src/main/java/com/bnyro/clock/presentation/features/RingtonePickerDialog.kt @@ -22,6 +22,7 @@ import androidx.compose.material3.AlertDialog import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -50,6 +51,11 @@ fun RingtonePickerDialog( onDismissRequest.invoke() } + DisposableEffect(Unit) { + onDispose { + ringingToneModel.stopRinging() + } + } AlertDialog( onDismissRequest = { ringingToneModel.stopRinging()