Skip to content

fix: add recent reaction to map as a visual aid when animations are disabled (WPB-18128) #4123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.viewModelScope
import com.wire.android.appLogger
import com.wire.android.di.CurrentAccount
import com.wire.android.mapper.UICallParticipantMapper
import com.wire.android.mapper.UserTypeMapper
import com.wire.android.model.ImageAsset
Expand Down Expand Up @@ -88,6 +89,7 @@ import kotlinx.coroutines.launch
@HiltViewModel(assistedFactory = SharedCallingViewModel.Factory::class)
class SharedCallingViewModel @AssistedInject constructor(
@Assisted val conversationId: ConversationId,
@CurrentAccount private val selfUserId: UserId,
private val conversationDetails: ObserveConversationDetailsUseCase,
private val observeEstablishedCallWithSortedParticipants: ObserveEstablishedCallWithSortedParticipantsUseCase,
private val hangUpCall: HangUpCallUseCase,
Expand Down Expand Up @@ -319,6 +321,7 @@ class SharedCallingViewModel @AssistedInject constructor(
viewModelScope.launch {
sendInCallReactionUseCase(conversationId, emoji).onSuccess {
_inCallReactions.send(InCallReaction(emoji, ReactionSender.You))
recentReactions[selfUserId] = emoji
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package com.wire.android.ui.calling
import android.view.View
import app.cash.turbine.test
import com.wire.android.assertIs
import com.wire.android.assertions.shouldBeEqualTo
import com.wire.android.config.CoroutineTestExtension
import com.wire.android.config.NavigationTestExtension
import com.wire.android.config.TestDispatcherProvider
Expand Down Expand Up @@ -60,7 +61,7 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Assertions.assertEquals
import com.wire.android.assertions.shouldBeEqualTo
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
Expand Down Expand Up @@ -142,6 +143,7 @@ class SharedCallingViewModelTest {

sharedCallingViewModel = SharedCallingViewModel(
conversationId = conversationId,
selfUserId = TestUser.SELF_USER_ID,
conversationDetails = observeConversationDetails,
observeEstablishedCallWithSortedParticipants = observeEstablishedCall,
hangUpCall = hangUpCall,
Expand Down Expand Up @@ -385,6 +387,23 @@ class SharedCallingViewModelTest {
}
}

@Test
fun givenAnOngoingCall_WhenInCallReactionIsSent_ThenReactionMessageIsSentAndAddedToRecentReactions() =
runTest(dispatcherProvider.main()) {

// given
coEvery { sendInCallReactionUseCase(conversationId, any()) } returns Either.Right(Unit)

// when
sharedCallingViewModel.onReactionClick("👌")

// then
coVerify(exactly = 1) {
sendInCallReactionUseCase(OngoingCallViewModelTest.conversationId, "👌")
}
assertTrue(sharedCallingViewModel.recentReactions.containsValue("👌"))
}

@Test
fun givenAnOngoingCall_WhenInCallReactionSentFails_ThenNoEmojiIsEmitted() = runTest(dispatcherProvider.main()) {
// given
Expand Down
Loading