Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed May 3, 2024
2 parents db3ccde + ba0f534 commit 79441ea
Show file tree
Hide file tree
Showing 23 changed files with 379 additions and 657 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ If you're interested in customizing the UI components for the Video SDK, check o
You can find sample projects below that demonstrates use cases of Stream Video SDK for Android:

- [Demo App](https://github.com/GetStream/stream-video-android/tree/develop/demo-app): Demo App demonstrates Stream Video SDK for Android with modern Android tech stacks, such as Compose, Hilt, and Coroutines.
- [Android Video Samples](https://github.com/GetStream/Android-Video-Samples): Provides a collection of samples that utilize modern Android tech stacks and Stream Video SDK for Kotlin and Compose.
- [WhatsApp Clone Compose](https://github.com/getstream/whatsapp-clone-compose): WhatsApp clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat/Video SDK for Compose.
- [Twitch Clone Compose](https://github.com/skydoves/twitch-clone-compose): Twitch clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat/Video SDK for Compose.
- [Meeting Room Compose](https://github.com/GetStream/meeting-room-compose): A real-time meeting room app built with Jetpack Compose to demonstrate video communications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ object Configuration {
const val minSdk = 24
const val majorVersion = 0
const val minorVersion = 5
const val patchVersion = 7
const val patchVersion = 8
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 21
const val versionCode = 22
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.0.9"
const val streamVideoCallGooglePlayVersion = "1.0.10"
const val streamWebRtcVersionName = "1.1.1"
}
42 changes: 10 additions & 32 deletions demo-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,6 @@
</intent-filter>
</activity>

<activity
android:name="io.getstream.video.android.ui.call.CallActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:exported="true"
android:launchMode="singleTask"
android:hardwareAccelerated="true"
android:supportsPictureInPicture="true"
android:windowSoftInputMode="adjustResize">
<intent-filter android:priority="1">
<action android:name="io.getstream.video.android.action.ONGOING_CALL" />
</intent-filter>
</activity>

<activity
android:name="io.getstream.video.android.IncomingCallActivity"
android:exported="false"
android:showOnLockScreen="true"
android:showWhenLocked="true"
android:supportsPictureInPicture="true">
<intent-filter android:priority="1">
<action android:name="io.getstream.video.android.action.INCOMING_CALL" />
<action android:name="io.getstream.video.android.action.NOTIFICATION" />
<action android:name="io.getstream.video.android.action.LIVE_CALL" />
<action android:name="io.getstream.video.android.action.ACCEPT_CALL" />
</intent-filter>
</activity>

<activity
android:name=".DeeplinkingActivity"
android:exported="true"
Expand All @@ -99,13 +72,18 @@
</activity>

<activity
android:name="io.getstream.video.android.DirectCallActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:exported="true"
android:hardwareAccelerated="true"
android:name=".CallActivity"
android:supportsPictureInPicture="true"
android:windowSoftInputMode="adjustResize">
android:showOnLockScreen="true"
android:showWhenLocked="true"
android:launchMode="singleTop"
android:exported="false">
<intent-filter android:priority="1">
<action android:name="io.getstream.video.android.action.INCOMING_CALL" />
<action android:name="io.getstream.video.android.action.NOTIFICATION" />
<action android:name="io.getstream.video.android.action.LIVE_CALL" />
<action android:name="io.getstream.video.android.action.ONGOING_CALL" />
<action android:name="io.getstream.video.android.action.ACCEPT_CALL" />
<action android:name="io.getstream.video.android.action.OUTGOING_CALL" />
</intent-filter>
</activity>
Expand Down
108 changes: 108 additions & 0 deletions demo-app/src/main/kotlin/io/getstream/video/android/CallActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (c) 2014-2024 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.getstream.video.android

import android.content.Intent
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import io.getstream.chat.android.client.ChatClient
import io.getstream.chat.android.models.Filters
import io.getstream.chat.android.models.querysort.QuerySortByField
import io.getstream.result.onSuccessSuspend
import io.getstream.video.android.compose.ui.ComposeStreamCallActivity
import io.getstream.video.android.compose.ui.StreamCallActivityComposeDelegate
import io.getstream.video.android.core.Call
import io.getstream.video.android.ui.call.CallScreen
import io.getstream.video.android.ui.common.StreamActivityUiDelegate
import io.getstream.video.android.ui.common.StreamCallActivity
import io.getstream.video.android.ui.common.StreamCallActivityConfiguration
import io.getstream.video.android.ui.common.util.StreamCallActivityDelicateApi
import io.getstream.video.android.util.FullScreenCircleProgressBar

@OptIn(StreamCallActivityDelicateApi::class)
class CallActivity : ComposeStreamCallActivity() {

override val uiDelegate: StreamActivityUiDelegate<StreamCallActivity> = StreamDemoUiDelegate()
override val configuration: StreamCallActivityConfiguration =
StreamCallActivityConfiguration(closeScreenOnCallEnded = false)

private class StreamDemoUiDelegate : StreamCallActivityComposeDelegate() {

@Composable
override fun StreamCallActivity.LoadingContent(call: Call) {
// Use as loading screen.. so the layout is shown.
if (call.type == "default") {
VideoCallContent(call = call)
} else {
FullScreenCircleProgressBar(text = "Connecting...")
}
}

@Composable
override fun StreamCallActivity.CallDisconnectedContent(call: Call) {
goBackToMainScreen()
}

@Composable
override fun StreamCallActivity.VideoCallContent(call: Call) {
CallScreen(
call = call,
showDebugOptions = BuildConfig.DEBUG,
onCallDisconnected = {
leave(call)
goBackToMainScreen()
},
onUserLeaveCall = {
leave(call)
goBackToMainScreen()
},
)

// step 4 (optional) - chat integration
val user by ChatClient.instance().clientState.user.collectAsState(initial = null)
LaunchedEffect(key1 = user) {
if (user != null) {
val channel = ChatClient.instance().channel("videocall", call.id)
channel.queryMembers(
offset = 0,
limit = 10,
filter = Filters.neutral(),
sort = QuerySortByField(),
).await().onSuccessSuspend { members ->
if (members.isNotEmpty()) {
channel.addMembers(listOf(user!!.id)).await()
} else {
channel.create(listOf(user!!.id), emptyMap()).await()
}
}
}
}
}

private fun StreamCallActivity.goBackToMainScreen() {
if (!isFinishing) {
val intent = Intent(this, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
startActivity(intent)
finish()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import io.getstream.video.android.compose.theme.VideoTheme
import io.getstream.video.android.core.StreamVideo
import io.getstream.video.android.datastore.delegate.StreamUserDataStore
import io.getstream.video.android.model.StreamCallId
import io.getstream.video.android.ui.call.CallActivity
import io.getstream.video.android.ui.common.StreamCallActivity
import io.getstream.video.android.util.InitializedState
import io.getstream.video.android.util.StreamVideoInitHelper
import io.getstream.video.android.util.config.AppConfig
Expand Down Expand Up @@ -110,16 +110,17 @@ class DeeplinkingActivity : ComponentActivity() {
joinCall(data, callId)
} else {
// first ask for push notification permission
val manager = NotificationPermissionManager.createNotificationPermissionsManager(
application = app,
requestPermissionOnAppLaunch = { true },
onPermissionStatus = {
// we don't care about the result for demo purposes
if (it != NotificationPermissionStatus.REQUESTED) {
joinCall(data, callId)
}
},
)
val manager =
NotificationPermissionManager.createNotificationPermissionsManager(
application = app,
requestPermissionOnAppLaunch = { true },
onPermissionStatus = {
// we don't care about the result for demo purposes
if (it != NotificationPermissionStatus.REQUESTED) {
joinCall(data, callId)
}
},
)
manager.start()
}
} else {
Expand Down Expand Up @@ -179,13 +180,10 @@ class DeeplinkingActivity : ComponentActivity() {
if (it == InitializedState.FINISHED || it == InitializedState.FAILED) {
if (StreamVideo.isInstalled) {
val callId = StreamCallId(type = "default", id = cid)
val intent = CallActivity.createIntent(
val intent = StreamCallActivity.callIntent(
context = this@DeeplinkingActivity,
callId = callId,
disableMicOverride = intent.getBooleanExtra(
EXTRA_DISABLE_MIC_OVERRIDE,
false,
),
cid = callId,
clazz = CallActivity::class.java,
).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
Expand Down

0 comments on commit 79441ea

Please sign in to comment.