Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Dec 12, 2023
2 parents ae2ac24 + 65850a1 commit 8d0ce23
Show file tree
Hide file tree
Showing 77 changed files with 1,501 additions and 2,307 deletions.
3 changes: 2 additions & 1 deletion demo-app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/build
!/libs/**
4 changes: 1 addition & 3 deletions demo-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ If you want to build and run the [dogfooding app](https://github.com/GetStream/s

```
# Environment Variable for dogfooding app
DOGFOODING_BUILD_CONFIG_API_KEY=YOUR_STREAM_API_KEY
PRODUCTION_BUILD_CONFIG_API_KEY=YOUR_STREAM_API_KEY
DOGFOODING_RES_CONFIG_DEEPLINKING_HOST=stream-calls-dogfood.vercel.app
DOGFOODING_RES_CONFIG_DEEPLINKING_HOST=pronto.getstream.io
PRODUCTION_RES_CONFIG_DEEPLINKING_HOST=getstream.io
DOGFOODING_RES_CONFIG_DEEPLINKING_PATH_PREFIX=/
PRODUCTION_RES_CONFIG_DEEPLINKING_PATH_PREFIX=/video/demos/
Expand Down
8 changes: 8 additions & 0 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ android {
baseline = file("lint-baseline.xml")
}

packaging {
jniLibs.pickFirsts.add("lib/*/librenderscript-toolkit.so")
}

baselineProfile {
mergeIntoMain = true
}
Expand Down Expand Up @@ -260,6 +264,10 @@ dependencies {
implementation(libs.play.auth)
implementation(libs.play.app.update.ktx)

// Video Filters
implementation(libs.google.mlkit.selfie.segmentation)
implementation(files("libs/renderscript-toolkit.aar"))

// Memory detection
debugImplementation(libs.leakCanary)

Expand Down
Binary file added demo-app/libs/renderscript-toolkit.aar
Binary file not shown.
40 changes: 40 additions & 0 deletions demo-app/src/development/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2023 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="107dp"
android:height="107dp"
android:viewportWidth="107"
android:viewportHeight="107">
<path
android:pathData="M0,0h107v107h-107z"
android:fillColor="#008E30"/>
<path
android:pathData="M0,0h107v107h-107z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="107"
android:startY="-0"
android:endX="0"
android:endY="107"
android:type="linear">
<item android:offset="0" android:color="#FF49DDED"/>
<item android:offset="1" android:color="#0049DDED"/>
</gradient>
</aapt:attr>
</path>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->
<resources>
<string name="app_name">Dogfooding</string>
<string name="app_name">Stream Video Calls (Development)</string>
<string name="deeplinking_host">getstream.io</string>
<string name="deeplinking_path_prefix">/video/demos</string>
</resources>
2 changes: 1 addition & 1 deletion demo-app/src/main/kotlin/io/getstream/video/android/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ class App : Application() {
}
}

val STREAM_SDK_ENVIRONMENT = if (BuildConfig.FLAVOR == StreamFlavors.production) "pronto" else "demo"
val STREAM_SDK_ENVIRONMENT = if (BuildConfig.FLAVOR == StreamFlavors.production) "demo" else "pronto"

val Context.app get() = applicationContext as App
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import io.getstream.result.Result
import io.getstream.video.android.compose.theme.VideoTheme
import io.getstream.video.android.compose.ui.components.call.activecall.CallContent
import io.getstream.video.android.compose.ui.components.call.ringing.RingingCallContent
import io.getstream.video.android.core.Call
import io.getstream.video.android.core.StreamVideo
import io.getstream.video.android.core.call.state.AcceptCall
import io.getstream.video.android.core.call.state.CallAction
Expand All @@ -45,7 +46,10 @@ import io.getstream.video.android.datastore.delegate.StreamUserDataStore
import io.getstream.video.android.model.mapper.isValidCallId
import io.getstream.video.android.model.mapper.toTypeAndId
import io.getstream.video.android.util.StreamVideoInitHelper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.openapitools.client.models.CallRejectedEvent
import java.util.UUID
import javax.inject.Inject

Expand All @@ -54,6 +58,7 @@ class DirectCallActivity : ComponentActivity() {

@Inject
lateinit var dataStore: StreamUserDataStore
private lateinit var call: Call

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -73,7 +78,7 @@ class DirectCallActivity : ComponentActivity() {
}

// Create call object
val call = StreamVideo.instance().call(type, id)
call = StreamVideo.instance().call(type, id)

// Get list of members
val members: List<String> = intent.getStringArrayExtra(EXTRA_MEMBERS_ARRAY)?.asList() ?: emptyList()
Expand All @@ -84,6 +89,18 @@ class DirectCallActivity : ComponentActivity() {
// Ring the members
val result = call.create(ring = true, memberIds = membersWithMe)

// Update the call
call.get()

call.subscribe {
when (it) {
// Finish this activity if ever a call.reject is received
is CallRejectedEvent -> {
finish()
}
}
}

if (result is Result.Failure) {
// Failed to recover the current state of the call
// TODO: Automaticly call this in the SDK?
Expand All @@ -101,20 +118,19 @@ class DirectCallActivity : ComponentActivity() {
val onCallAction: (CallAction) -> Unit = { callAction ->
when (callAction) {
is ToggleCamera -> call.camera.setEnabled(callAction.isEnabled)
is ToggleMicrophone -> call.microphone.setEnabled(callAction.isEnabled)
is ToggleMicrophone -> call.microphone.setEnabled(
callAction.isEnabled,
)
is ToggleSpeakerphone -> call.speaker.setEnabled(callAction.isEnabled)
is LeaveCall -> {
call.leave()
finish()
}
is DeclineCall -> {
// Not needed. this activity is only used for outgoing calls.
reject(call)
}
is CancelCall -> {
lifecycleScope.launch {
call.leave()
finish()
}
reject(call)
}
is AcceptCall -> {
lifecycleScope.launch {
Expand All @@ -131,8 +147,7 @@ class DirectCallActivity : ComponentActivity() {
modifier = Modifier.background(color = VideoTheme.colors.appBackground),
call = call,
onBackPressed = {
call.leave()
finish()
reject(call)
},
onAcceptedContent = {
CallContent(
Expand All @@ -142,8 +157,7 @@ class DirectCallActivity : ComponentActivity() {
)
},
onRejectedContent = {
call.leave()
finish()
reject(call)
},
onCallAction = onCallAction,
)
Expand All @@ -152,6 +166,22 @@ class DirectCallActivity : ComponentActivity() {
}
}

override fun onStop() {
super.onStop()
if (::call.isInitialized) {
reject(call)
}
}

private fun reject(call: Call) {
lifecycleScope.launch(Dispatchers.IO) {
call.reject()
withContext(Dispatchers.Main) {
finish()
}
}
}

companion object {
const val EXTRA_CID: String = "EXTRA_CID"
const val EXTRA_MEMBERS_ARRAY: String = "EXTRA_MEMBERS_ARRAY"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -135,8 +136,10 @@ class IncomingCallActivity : ComponentActivity() {
)
},
onRejectedContent = {
call.leave()
finish()
LaunchedEffect(key1 = call) {
call.reject()
finish()
}
},
onCallAction = onCallAction,
)
Expand Down
Loading

0 comments on commit 8d0ce23

Please sign in to comment.