Skip to content

Commit 5311db7

Browse files
committed
Add VideoCall type and configure navigation
1 parent 430127a commit 5311db7

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

app/src/main/kotlin/io/getstream/whatsappclone/navigation/WhatsAppNavigation.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,13 @@ fun NavGraphBuilder.whatsAppHomeNavigation() {
5858
whatsAppUser = whatsAppUser
5959
)
6060
}
61+
62+
composable(
63+
route = WhatsAppScreens.VideoCall.name,
64+
arguments = WhatsAppScreens.VideoCall.navArguments
65+
) {
66+
val callId = it.arguments?.getString(WhatsAppScreens.VideoCall.KEY_CALL_ID)
67+
68+
// TODO
69+
}
6170
}

buildSrc/src/main/kotlin/Configurations.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Configurations {
22
const val compileSdk = 34
33
const val targetSdk = 34
4-
const val minSdk = 21
4+
const val minSdk = 24
55
const val majorVersion = 1
66
const val minorVersion = 0
77
const val patchVersion = 4

core/navigation/src/main/kotlin/io/getstream/whatsappclone/navigation/WhatsAppScreens.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ import io.getstream.whatsappclone.navigation.navtypes.WhatsAppUserType
2424

2525
sealed class WhatsAppScreens(
2626
val route: String,
27-
val index: Int? = null,
2827
val navArguments: List<NamedNavArgument> = emptyList()
2928
) {
3029
val name: String = route.appendArguments(navArguments)
3130

3231
// home screen
33-
object Home : WhatsAppScreens("home")
32+
data object Home : WhatsAppScreens("home")
3433

3534
// message screen
36-
object Messages : WhatsAppScreens(
35+
data object Messages : WhatsAppScreens(
3736
route = "messages",
3837
navArguments = listOf(navArgument("channelId") { type = NavType.StringType })
3938
) {
@@ -42,7 +41,7 @@ sealed class WhatsAppScreens(
4241
}
4342

4443
// call info screen
45-
object CallInfo : WhatsAppScreens(
44+
data object CallInfo : WhatsAppScreens(
4645
route = "call_info",
4746
navArguments = listOf(
4847
navArgument("user") {
@@ -55,6 +54,22 @@ sealed class WhatsAppScreens(
5554
fun createRoute(whatsAppUser: WhatsAppUser) =
5655
name.replace("{${navArguments.first().name}}", WhatsAppUserType.encodeToString(whatsAppUser))
5756
}
57+
58+
// video call screen
59+
data object VideoCall : WhatsAppScreens(
60+
route = "video_call",
61+
navArguments = listOf(
62+
navArgument("call_id") {
63+
type = NavType.StringType
64+
nullable = false
65+
}
66+
)
67+
) {
68+
const val KEY_CALL_ID = "call_id"
69+
70+
fun createRoute(callId: String) =
71+
name.replace("{${navArguments.first().name}}", callId)
72+
}
5873
}
5974

6075
private fun String.appendArguments(navArguments: List<NamedNavArgument>): String {

features/calls/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ dependencies {
3030
implementation(project(":core:uistate"))
3131
implementation(project(":core:data"))
3232

33-
// stream Video SDK
34-
implementation(libs.stream.video.compose)
35-
3633
implementation(libs.androidx.lifecycle.runtimeCompose)
3734
implementation(libs.androidx.lifecycle.viewModelCompose)
3835
implementation(libs.stream.log)

features/chats/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ dependencies {
3131
implementation(project(":core:network"))
3232
implementation(project(":core:data"))
3333

34-
// Stream Chat & Video Compose
34+
// Stream Chat Compose
3535
api(libs.stream.chat.compose)
36-
api(libs.stream.video.compose)
3736

3837
implementation(libs.androidx.lifecycle.runtimeCompose)
3938
implementation(libs.androidx.lifecycle.viewModelCompose)

0 commit comments

Comments
 (0)