Skip to content

Commit 424abf8

Browse files
committed
feat: send and receive in-call reactions [#WPB-14254]
1 parent 22a0b22 commit 424abf8

33 files changed

+1521
-147
lines changed

app/src/main/kotlin/com/wire/android/di/accountScoped/CallsModule.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,9 @@ class CallsModule {
202202
@Provides
203203
fun provideObserveConferenceCallingEnabledUseCase(callsScope: CallsScope) =
204204
callsScope.observeConferenceCallingEnabled
205+
206+
@ViewModelScoped
207+
@Provides
208+
fun provideObserveInCallReactionsUseCase(callsScope: CallsScope) =
209+
callsScope.observeInCallReactions
205210
}

app/src/main/kotlin/com/wire/android/di/accountScoped/MessageModule.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.wire.kalium.logic.feature.asset.ObserveAssetStatusesUseCase
2828
import com.wire.kalium.logic.feature.asset.ObservePaginatedAssetImageMessages
2929
import com.wire.kalium.logic.feature.asset.ScheduleNewAssetMessageUseCase
3030
import com.wire.kalium.logic.feature.asset.UpdateAssetMessageTransferStatusUseCase
31+
import com.wire.kalium.logic.feature.incallreaction.SendInCallReactionUseCase
3132
import com.wire.kalium.logic.feature.message.DeleteMessageUseCase
3233
import com.wire.kalium.logic.feature.message.GetMessageByIdUseCase
3334
import com.wire.kalium.logic.feature.message.GetNotificationsUseCase
@@ -216,4 +217,9 @@ class MessageModule {
216217
@Provides
217218
fun provideRemoveMessageDraftUseCase(messageScope: MessageScope): RemoveMessageDraftUseCase =
218219
messageScope.removeMessageDraftUseCase
220+
221+
@ViewModelScoped
222+
@Provides
223+
fun provideSendInCallReactionUseCase(messageScope: MessageScope): SendInCallReactionUseCase =
224+
messageScope.sendInCallReactionUseCase
219225
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/CameraButton.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ package com.wire.android.ui.calling.controlbuttons
2020

2121
import androidx.compose.runtime.Composable
2222
import androidx.compose.ui.Modifier
23-
import androidx.compose.ui.unit.Dp
2423
import com.wire.android.R
2524
import com.wire.android.appLogger
26-
import com.wire.android.ui.common.dimensions
2725
import com.wire.android.ui.theme.WireTheme
2826
import com.wire.android.util.permission.rememberCameraPermissionFlow
2927
import com.wire.android.util.ui.PreviewMultipleThemes
@@ -34,7 +32,6 @@ fun CameraButton(
3432
onPermissionPermanentlyDenied: () -> Unit,
3533
modifier: Modifier = Modifier,
3634
isCameraOn: Boolean = false,
37-
size: Dp = dimensions().defaultCallingControlsSize,
3835
) {
3936
val cameraPermissionCheck = rememberCameraPermissionFlow(
4037
onPermissionGranted = {
@@ -56,7 +53,6 @@ fun CameraButton(
5653
false -> R.string.content_description_calling_turn_camera_on
5754
},
5855
onClick = cameraPermissionCheck::launch,
59-
size = size,
6056
modifier = modifier,
6157
)
6258
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/HangUpButton.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import com.wire.android.util.ui.PreviewMultipleThemes
3838
fun HangUpButton(
3939
onHangUpButtonClicked: () -> Unit,
4040
modifier: Modifier = Modifier,
41-
size: Dp = dimensions().bigCallingControlsSize,
41+
size: Dp = dimensions().defaultCallingControlsHeight,
4242
iconSize: Dp = dimensions().bigCallingHangUpButtonIconSize,
4343
) {
4444
WirePrimaryIconButton(
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Wire
3+
* Copyright (C) 2024 Wire Swiss GmbH
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see http://www.gnu.org/licenses/.
17+
*/
18+
19+
package com.wire.android.ui.calling.controlbuttons
20+
21+
import androidx.compose.foundation.layout.height
22+
import androidx.compose.foundation.layout.width
23+
import androidx.compose.foundation.shape.CircleShape
24+
import androidx.compose.material3.MaterialTheme
25+
import androidx.compose.runtime.Composable
26+
import androidx.compose.ui.Modifier
27+
import androidx.compose.ui.unit.Dp
28+
import androidx.compose.ui.unit.DpSize
29+
import com.wire.android.R
30+
import com.wire.android.ui.common.button.WireButtonState
31+
import com.wire.android.ui.common.button.WirePrimaryIconButton
32+
import com.wire.android.ui.common.dimensions
33+
import com.wire.android.ui.theme.WireTheme
34+
import com.wire.android.ui.theme.wireDimensions
35+
import com.wire.android.util.ui.PreviewMultipleThemes
36+
37+
@Composable
38+
fun HangUpOngoingButton(
39+
onHangUpButtonClicked: () -> Unit,
40+
modifier: Modifier = Modifier,
41+
width: Dp = dimensions().defaultCallingControlsWidth,
42+
height: Dp = dimensions().defaultCallingControlsHeight,
43+
iconSize: Dp = dimensions().bigCallingHangUpButtonIconSize,
44+
) {
45+
WirePrimaryIconButton(
46+
iconResource = R.drawable.ic_call_reject,
47+
contentDescription = R.string.content_description_calling_hang_up_call,
48+
state = WireButtonState.Error,
49+
shape = CircleShape,
50+
minSize = DpSize(width, height),
51+
minClickableSize = DpSize(width, height),
52+
iconSize = iconSize,
53+
onButtonClicked = onHangUpButtonClicked,
54+
modifier = modifier,
55+
)
56+
}
57+
58+
@PreviewMultipleThemes
59+
@Composable
60+
fun PreviewComposableHangUpOngoingButton() = WireTheme {
61+
HangUpOngoingButton(
62+
modifier = Modifier
63+
.width(MaterialTheme.wireDimensions.bigCallingControlsSize)
64+
.height(MaterialTheme.wireDimensions.bigCallingControlsSize),
65+
onHangUpButtonClicked = { }
66+
)
67+
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/CameraFlipButton.kt renamed to app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/InCallReactionsButton.kt

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,49 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see http://www.gnu.org/licenses/.
1717
*/
18-
1918
package com.wire.android.ui.calling.controlbuttons
2019

2120
import androidx.compose.runtime.Composable
2221
import androidx.compose.ui.Modifier
23-
import androidx.compose.ui.unit.Dp
2422
import com.wire.android.R
25-
import com.wire.android.ui.common.dimensions
2623
import com.wire.android.ui.theme.WireTheme
2724
import com.wire.android.util.ui.PreviewMultipleThemes
2825

2926
@Composable
30-
fun CameraFlipButton(
31-
onCameraFlipButtonClicked: () -> Unit,
27+
fun InCallReactionsButton(
28+
isSelected: Boolean,
29+
onInCallReactionsClick: () -> Unit,
3230
modifier: Modifier = Modifier,
33-
isOnFrontCamera: Boolean = false,
34-
size: Dp = dimensions().defaultCallingControlsSize
3531
) {
3632
WireCallControlButton(
37-
isSelected = !isOnFrontCamera,
38-
iconResId = when (isOnFrontCamera) {
39-
true -> R.drawable.ic_camera_flipped
40-
false -> R.drawable.ic_camera_flip
33+
isSelected = isSelected,
34+
iconResId = when (isSelected) {
35+
true -> R.drawable.ic_incall_reactions
36+
false -> R.drawable.ic_incall_reactions
4137
},
42-
contentDescription = when (isOnFrontCamera) {
43-
true -> R.string.content_description_calling_flip_camera_on
44-
false -> R.string.content_description_calling_flip_camera_off
38+
contentDescription = when (isSelected) {
39+
true -> R.string.content_description_calling_unmute_call
40+
false -> R.string.content_description_calling_mute_call
4541
},
46-
onClick = onCameraFlipButtonClicked,
47-
size = size,
48-
modifier = modifier,
42+
onClick = onInCallReactionsClick,
43+
modifier = modifier
4944
)
5045
}
5146

5247
@PreviewMultipleThemes
5348
@Composable
54-
fun PreviewCameraFlipButtonOn() = WireTheme {
55-
CameraFlipButton(isOnFrontCamera = true, onCameraFlipButtonClicked = { })
49+
fun PreviewInCallReactionsButton() = WireTheme {
50+
InCallReactionsButton(
51+
isSelected = false,
52+
onInCallReactionsClick = { }
53+
)
5654
}
5755

5856
@PreviewMultipleThemes
5957
@Composable
60-
fun PreviewCameraFlipButtonOff() = WireTheme {
61-
CameraFlipButton(isOnFrontCamera = false, onCameraFlipButtonClicked = { })
58+
fun PreviewInCallReactionsButtonSelected() = WireTheme {
59+
InCallReactionsButton(
60+
isSelected = true,
61+
onInCallReactionsClick = { }
62+
)
6263
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/MicrophoneButton.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ package com.wire.android.ui.calling.controlbuttons
2020

2121
import androidx.compose.runtime.Composable
2222
import androidx.compose.ui.Modifier
23-
import androidx.compose.ui.unit.Dp
2423
import com.wire.android.R
25-
import com.wire.android.ui.common.dimensions
2624
import com.wire.android.ui.theme.WireTheme
2725
import com.wire.android.util.ui.PreviewMultipleThemes
2826

@@ -31,7 +29,6 @@ fun MicrophoneButton(
3129
isMuted: Boolean,
3230
onMicrophoneButtonClicked: () -> Unit,
3331
modifier: Modifier = Modifier,
34-
size: Dp = dimensions().defaultCallingControlsSize
3532
) {
3633
WireCallControlButton(
3734
isSelected = !isMuted,
@@ -44,7 +41,6 @@ fun MicrophoneButton(
4441
false -> R.string.content_description_calling_mute_call
4542
},
4643
onClick = onMicrophoneButtonClicked,
47-
size = size,
4844
modifier = modifier
4945
)
5046
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/SpeakerButton.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ package com.wire.android.ui.calling.controlbuttons
2020

2121
import androidx.compose.runtime.Composable
2222
import androidx.compose.ui.Modifier
23-
import androidx.compose.ui.unit.Dp
2423
import com.wire.android.R
25-
import com.wire.android.ui.common.dimensions
2624
import com.wire.android.ui.theme.WireTheme
2725
import com.wire.android.util.ui.PreviewMultipleThemes
2826

@@ -31,7 +29,6 @@ fun SpeakerButton(
3129
isSpeakerOn: Boolean,
3230
onSpeakerButtonClicked: () -> Unit,
3331
modifier: Modifier = Modifier,
34-
size: Dp = dimensions().defaultCallingControlsSize
3532
) {
3633
WireCallControlButton(
3734
isSelected = isSpeakerOn,
@@ -44,7 +41,6 @@ fun SpeakerButton(
4441
false -> R.string.content_description_calling_turn_speaker_on
4542
},
4643
onClick = onSpeakerButtonClicked,
47-
size = size,
4844
modifier = modifier,
4945
)
5046
}

app/src/main/kotlin/com/wire/android/ui/calling/controlbuttons/WireCallControlButton.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ package com.wire.android.ui.calling.controlbuttons
2020

2121
import androidx.annotation.DrawableRes
2222
import androidx.annotation.StringRes
23-
import androidx.compose.foundation.layout.size
2423
import androidx.compose.foundation.shape.CircleShape
2524
import androidx.compose.runtime.Composable
2625
import androidx.compose.ui.Modifier
2726
import androidx.compose.ui.unit.Dp
2827
import androidx.compose.ui.unit.DpSize
2928
import com.wire.android.ui.common.button.WireButtonState
30-
import com.wire.android.ui.common.button.WireSecondaryIconButton
29+
import com.wire.android.ui.common.button.WirePrimaryIconButton
3130
import com.wire.android.ui.common.button.wireSecondaryButtonColors
3231
import com.wire.android.ui.common.colorsScheme
3332
import com.wire.android.ui.common.dimensions
@@ -39,10 +38,11 @@ fun WireCallControlButton(
3938
@StringRes contentDescription: Int,
4039
onClick: () -> Unit,
4140
modifier: Modifier = Modifier,
42-
size: Dp = dimensions().defaultCallingControlsSize,
41+
width: Dp = dimensions().defaultCallingControlsWidth,
42+
height: Dp = dimensions().defaultCallingControlsHeight,
4343
iconSize: Dp = dimensions().defaultCallingControlsIconSize
4444
) {
45-
WireSecondaryIconButton(
45+
WirePrimaryIconButton(
4646
onButtonClicked = onClick,
4747
iconResource = iconResId,
4848
shape = CircleShape,
@@ -60,9 +60,9 @@ fun WireCallControlButton(
6060
},
6161
contentDescription = contentDescription,
6262
state = if (isSelected) WireButtonState.Selected else WireButtonState.Default,
63-
minSize = DpSize(size, size),
64-
minClickableSize = DpSize(size, size),
63+
minSize = DpSize(width, height),
64+
minClickableSize = DpSize(width, height),
6565
iconSize = iconSize,
66-
modifier = modifier.size(size),
66+
modifier = modifier,
6767
)
6868
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Wire
3+
* Copyright (C) 2024 Wire Swiss GmbH
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see http://www.gnu.org/licenses/.
17+
*/
18+
package com.wire.android.ui.calling.model
19+
20+
data class InCallReaction(
21+
val emoji: String,
22+
val sender: ReactionSender,
23+
)
24+
25+
sealed interface ReactionSender {
26+
data object You : ReactionSender
27+
data class Other(val name: String) : ReactionSender
28+
data object Unknown : ReactionSender
29+
}

0 commit comments

Comments
 (0)