Skip to content

Commit 5ffed12

Browse files
committed
Navigate to the call from the history screen
1 parent 9e8598d commit 5ffed12

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

features/calls/src/main/kotlin/io/getstream/whatsappclone/calls/info/WhatsAppCallHistoryInfoBody.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.getstream.whatsappclone.calls.info
1818

19+
import androidx.compose.foundation.clickable
1920
import androidx.compose.foundation.layout.padding
2021
import androidx.compose.foundation.layout.size
2122
import androidx.compose.foundation.shape.CircleShape
@@ -28,6 +29,7 @@ import androidx.compose.ui.Modifier
2829
import androidx.compose.ui.draw.clip
2930
import androidx.compose.ui.unit.dp
3031
import androidx.constraintlayout.compose.ConstraintLayout
32+
import androidx.hilt.navigation.compose.hiltViewModel
3133
import com.skydoves.landscapist.glide.GlideImage
3234
import io.getstream.whatsappclone.designsystem.R
3335
import io.getstream.whatsappclone.designsystem.icon.WhatsAppIcons
@@ -40,8 +42,8 @@ import java.util.Date
4042
@Composable
4143
fun WhatsAppCallHistoryInfoBody(
4244
modifier: Modifier,
43-
whatsAppUser: WhatsAppUser
44-
45+
whatsAppUser: WhatsAppUser,
46+
whatsAppCallHistoryViewModel: WhatsAppCallHistoryViewModel = hiltViewModel()
4547
) {
4648
ConstraintLayout(modifier = modifier.padding(12.dp)) {
4749
val (image, name, call, divider, location, date) = createRefs()
@@ -77,6 +79,12 @@ fun WhatsAppCallHistoryInfoBody(
7779
.constrainAs(call) {
7880
top.linkTo(parent.top)
7981
end.linkTo(parent.end)
82+
}
83+
.clickable {
84+
whatsAppCallHistoryViewModel.navigateToVideoCall(
85+
channelId = whatsAppUser.cell,
86+
videoCall = false
87+
)
8088
},
8189
imageVector = WhatsAppIcons.Call,
8290
tint = GREEN450,

features/calls/src/main/kotlin/io/getstream/whatsappclone/calls/info/WhatsAppCallHistoryViewModel.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package io.getstream.whatsappclone.calls.info
1919
import androidx.lifecycle.ViewModel
2020
import dagger.hilt.android.lifecycle.HiltViewModel
2121
import io.getstream.whatsappclone.navigation.AppComposeNavigator
22+
import io.getstream.whatsappclone.navigation.WhatsAppScreens
2223
import javax.inject.Inject
2324

2425
@HiltViewModel
@@ -29,4 +30,13 @@ class WhatsAppCallHistoryViewModel @Inject constructor(
2930
fun navigateUp() {
3031
composeNavigator.navigateUp()
3132
}
33+
34+
fun navigateToVideoCall(channelId: String, videoCall: Boolean) {
35+
composeNavigator.navigate(
36+
WhatsAppScreens.VideoCall.createRoute(
37+
callId = channelId,
38+
videoCall = videoCall
39+
)
40+
)
41+
}
3242
}

0 commit comments

Comments
 (0)