change to start dial of last non-me recipient in a conversation in compose, qkreply and main-activity-swipe call actions

This commit is contained in:
gavine99
2025-03-13 09:39:02 +11:00
parent 28001d4e99
commit 74a639cf40
5 changed files with 65 additions and 37 deletions
@@ -359,12 +359,14 @@ class ComposeViewModel @Inject constructor(
// Open the phone dialer if the call button is clicked
view.optionsItemIntent
.filter { it == R.id.call }
.withLatestFrom(conversation) { _, conversation -> conversation }
.mapNotNull { conversation -> conversation.recipients.firstOrNull() }
.map { recipient -> recipient.address }
.autoDisposable(view.scope())
.subscribe { address -> navigator.makePhoneCall(address) }
.filter { it == R.id.call }
.withLatestFrom(state, conversation)
.mapNotNull { (_, state, conversation) ->
state.messages?.second?.lastOrNull { !it.isMe() }?.address // most recent non-me msg address
?: conversation.recipients.firstOrNull()?.address // first recipient in convo
}
.autoDisposable(view.scope())
.subscribe { navigator.makePhoneCall(it) }
// Open the conversation settings if info button is clicked
view.optionsItemIntent