From 4c1bd519d03713ab0a50a6474a2cfdddd19569fd Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 3 Aug 2023 16:46:41 +0200 Subject: [PATCH 1/2] fix: add flag to keep screen on when user is recording audio --- .../recordaudio/RecordAudioButtons.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt index 9d30090c1e8..0f99bfeaa63 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/recordaudio/RecordAudioButtons.kt @@ -17,7 +17,9 @@ */ package com.wire.android.ui.home.messagecomposer.recordaudio +import android.app.Activity import android.text.format.DateUtils +import android.view.WindowManager import androidx.annotation.DrawableRes import androidx.annotation.StringRes import androidx.compose.foundation.layout.Column @@ -30,6 +32,7 @@ import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -38,6 +41,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.sp @@ -100,6 +104,14 @@ fun RecordAudioButtonRecording( seconds += 1 } } + val activity = LocalContext.current as Activity + + DisposableEffect(Unit) { + activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + onDispose { + activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + } + } RecordAudioButton( onClick = onClick, From b4fe34381ed2f18938abd1720c16a465f8cc1f19 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Thu, 3 Aug 2023 16:56:25 +0200 Subject: [PATCH 2/2] trigger build