qksms icon indicating copy to clipboard operation
qksms copied to clipboard

[Enhancement] Phone call from Conversation view should call recipient from whom most recent message was received

Open e-t-l opened this issue 1 year ago • 1 comments

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

  1. Make a group conversation
  2. Receive some texts
  3. Press the phone call button
  4. 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?

e-t-l avatar Apr 24 '23 15:04 e-t-l

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.

e-t-l avatar Apr 24 '23 16:04 e-t-l