1
0
mirror of https://github.com/nextcloud/talk-android synced 2025-07-14 16:25:05 +01:00

this should work - didn't test yet tho

Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
rapterjet2004 2025-03-17 11:45:34 -05:00
parent 65e5be4798
commit 03c5d2561e
No known key found for this signature in database
GPG Key ID: A6A69CFF84968EA1
3 changed files with 20 additions and 3 deletions
app/src/main/java/com/nextcloud/talk/chat

View File

@ -506,10 +506,15 @@ class ChatActivity :
} }
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
chatViewModel.handleOrientationChange() chatViewModel.handleSavedInstance()
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
} }
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
chatViewModel.handleRestoreInstance()
super.onRestoreInstanceState(savedInstanceState)
}
override fun onStop() { override fun onStop() {
super.onStop() super.onStop()
active = false active = false

View File

@ -35,6 +35,7 @@ class MediaRecorderManager : LifecycleAwareManager {
} }
var currentVoiceRecordFile: String = "" var currentVoiceRecordFile: String = ""
private var lockRecording = false
enum class MediaRecorderState { enum class MediaRecorderState {
INITIAL, INITIAL,
@ -166,6 +167,12 @@ class MediaRecorderManager : LifecycleAwareManager {
} }
override fun handleOnStop() { override fun handleOnStop() {
if (!lockRecording) {
stop() stop()
} }
}
fun lockRecording(shouldLock: Boolean) {
lockRecording = shouldLock
}
} }

View File

@ -667,8 +667,13 @@ class ChatViewModel @Inject constructor(
audioFocusRequestManager.audioFocusRequest(request, callback) audioFocusRequestManager.audioFocusRequest(request, callback)
} }
fun handleOrientationChange() { fun handleSavedInstance() {
_getCapabilitiesViewState.value = GetCapabilitiesStartState _getCapabilitiesViewState.value = GetCapabilitiesStartState
mediaRecorderManager.lockRecording(true)
}
fun handleRestoreInstance() {
mediaRecorderManager.lockRecording(false)
} }
fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> = fun getMessageById(url: String, conversationModel: ConversationModel, messageId: Long): Flow<ChatMessage> =