qksms
qksms copied to clipboard
[Enhancement] Phone call from Conversation view should call recipient from whom most recent message was received
DESCRIPTION
Pressing the phone call button from the conversation view of a group text appears to dial the first recipient in the list of recipients. Instead, it should call whichever recipient you have most recently received a message from.
STEPS
- Make a group conversation
- Receive some texts
- Press the phone call button
- Observe which recipient is dialed.
DESIRED
The call should dial whichever recipient sent the most recent message (ignoring outgoing messages, obviously)
OBSERVATIONS
In the list of group text members, "Person A, Person B, Person C, etc," pressing the call button always dials Person A, even if the most recently received text in the conversation was from Person C.
@moezbhatti I have a decent idea of where to start in the code to make a PR for this. Is this worth doing? Is this an enhancement you agree with?
FYI, I believe it would just involve modifying the following 3 files that handle phone calls: presentation/src/main/java/com/moez/QKSMS/feature/main/MainViewModel.kt presentation/src/main/java/com/moez/QKSMS/feature/qkreply/QkReplyViewModel.kt presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt
Adding something along the lines of
val conversation = conversationRepo.getConversation(threadId)
val lastMessage = conversation.lastMessage
val lastRecipient = when {
conversation.recipients.size == 1 || lastMessage == null -> conversation.recipients.firstOrNull()
else -> conversation.recipients.find { recipient ->
phoneNumberUtils.compare(recipient.address, lastMessage.address)
}
}
(mostly from presentation/src/main/java/com/moez/QKSMS/feature/conversations/ConversationsAdapter.kt#L96)
If other files would have to be edited I don't know what they would be.