Skip to content

Commit 55fc028

Browse files
Merge branch 'develop'
2 parents 591ee86 + f05c366 commit 55fc028

File tree

23 files changed

+1401
-51
lines changed

23 files changed

+1401
-51
lines changed

buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ object Configuration {
66
const val minSdk = 24
77
const val majorVersion = 0
88
const val minorVersion = 5
9-
const val patchVersion = 4
9+
const val patchVersion = 5
1010
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
11-
const val versionCode = 18
11+
const val versionCode = 19
1212
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
1313
const val artifactGroup = "io.getstream"
14-
const val streamVideoCallGooglePlayVersion = "1.0.6"
14+
const val streamVideoCallGooglePlayVersion = "1.0.7"
1515
const val streamWebRtcVersionName = "1.1.1"
1616
}

docusaurus/docs/Android/02-tutorials/01-video-calling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
3131
```kotlin
3232
dependencies {
3333
// Stream Video Compose SDK
34-
implementation("io.getstream:stream-video-android-ui-compose:0.5.4")
34+
implementation("io.getstream:stream-video-android-ui-compose:0.5.5")
3535

3636
// Optionally add Jetpack Compose if Android studio didn't automatically include them
3737
implementation(platform("androidx.compose:compose-bom:2023.08.00"))

docusaurus/docs/Android/02-tutorials/02-audio-room.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
3535
```groovy
3636
dependencies {
3737
// Stream Video Compose SDK
38-
implementation("io.getstream:stream-video-android-ui-compose:0.5.4")
38+
implementation("io.getstream:stream-video-android-ui-compose:0.5.5")
3939
4040
// Jetpack Compose (optional/ android studio typically adds them when you create a new project)
4141
implementation(platform("androidx.compose:compose-bom:2023.08.00"))

docusaurus/docs/Android/02-tutorials/03-livestream.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ If you're new to android, note that there are 2 `build.gradle` files, you want t
3535
```kotlin
3636
dependencies {
3737
// Stream Video Compose SDK
38-
implementation("io.getstream:stream-video-android-ui-compose:0.5.4")
38+
implementation("io.getstream:stream-video-android-ui-compose:0.5.5")
3939

4040
// Jetpack Compose (optional/ android studio typically adds them when you create a new project)
4141
implementation(platform("androidx.compose:compose-bom:2023.08.00"))

docusaurus/docs/Android/06-advanced/07-chat-with-video.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Let the project sync. It should have all the dependencies required for you to fi
3131
```groovy
3232
dependencies {
3333
// Stream Video Compose SDK
34-
implementation("io.getstream:stream-video-android-ui-compose:0.5.4")
34+
implementation("io.getstream:stream-video-android-ui-compose:0.5.5")
3535
3636
// Stream Chat
3737
implementation(libs.stream.chat.compose)

gradle/libs.versions.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,44 @@ androidGradlePlugin = "8.2.2"
33
cameraCamera2 = "1.3.0"
44
spotless = "6.21.0"
55
nexusPlugin = "1.3.0"
6-
kotlin = "1.9.22"
7-
ksp = "1.9.22-1.0.17"
8-
kotlinSerialization = "1.6.2"
6+
kotlin = "1.9.23"
7+
ksp = "1.9.23-1.0.19"
8+
kotlinSerialization = "1.6.3"
99
kotlinSerializationConverter = "1.0.0"
1010
kotlinxCoroutines = "1.8.0"
1111

12-
kotlinDokka = "1.9.10"
12+
kotlinDokka = "1.9.20"
1313
jvmTarget = "11"
1414

1515
androidxMaterial = "1.11.0"
1616
androidxAppCompat = "1.6.1"
1717
androidxCore = "1.12.0"
18-
androidxAnnotation = "1.7.0"
19-
androidxLifecycle = "2.6.2"
18+
androidxAnnotation = "1.7.1"
19+
androidxLifecycle = "2.7.0"
2020
androidxStartup = "1.1.1"
21-
androidxActivity = "1.8.0"
21+
androidxActivity = "1.8.2"
2222
androidxDataStore = "1.0.0"
2323
googleService = "4.3.14"
2424

25-
androidxComposeBom = "2024.02.02"
26-
androidxComposeCompiler = "1.5.10"
25+
androidxComposeBom = "2024.03.00"
26+
androidxComposeCompiler = "1.5.11"
2727
androidxComposeTracing = "1.0.0-beta01"
2828
androidxHiltNavigation = "1.2.0"
29-
androidxComposeNavigation = "2.7.6"
29+
androidxComposeNavigation = "2.7.7"
3030
composeStableMarker = "1.0.2"
3131

32-
coil = "2.5.0"
33-
landscapist = "2.3.1"
32+
coil = "2.6.0"
33+
landscapist = "2.3.2"
3434
accompanist = "0.32.0"
3535
telephoto = "0.3.0"
3636
audioswitch = "1.1.8"
3737
libyuv = "0.30.0"
3838

3939
wire = "4.7.0"
4040
okhttp = "4.12.0"
41-
retrofit = "2.9.0"
42-
moshi = "1.15.0"
43-
threetenAbp = "1.4.6"
41+
retrofit = "2.11.0"
42+
moshi = "1.15.1"
43+
threetenAbp = "1.4.7"
4444
tink = "1.9.0"
4545
turbine = "0.13.0"
4646

@@ -71,8 +71,8 @@ installReferrer = "2.2"
7171
playAuth = "20.7.0"
7272
playAppUpdate = "2.1.0"
7373

74-
hilt = "2.50"
75-
leakCanary = "2.12"
74+
hilt = "2.51.1"
75+
leakCanary = "2.13"
7676
binaryCompatabilityValidator = "0.14.0"
7777
playPublisher = "3.8.4"
7878

stream-video-android-core/api/stream-video-android-core.api

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4075,11 +4075,12 @@ public final class io/getstream/video/android/core/model/VisibilityOnScreenState
40754075

40764076
public class io/getstream/video/android/core/notifications/DefaultNotificationHandler : io/getstream/android/push/permissions/NotificationPermissionHandler, io/getstream/video/android/core/notifications/NotificationHandler {
40774077
public static final field Companion Lio/getstream/video/android/core/notifications/DefaultNotificationHandler$Companion;
4078-
public fun <init> (Landroid/app/Application;Lio/getstream/android/push/permissions/NotificationPermissionHandler;)V
4079-
public synthetic fun <init> (Landroid/app/Application;Lio/getstream/android/push/permissions/NotificationPermissionHandler;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
4078+
public fun <init> (Landroid/app/Application;Lio/getstream/android/push/permissions/NotificationPermissionHandler;Z)V
4079+
public synthetic fun <init> (Landroid/app/Application;Lio/getstream/android/push/permissions/NotificationPermissionHandler;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
40804080
public fun getChannelDescription ()Ljava/lang/String;
40814081
public fun getChannelId ()Ljava/lang/String;
40824082
public fun getChannelName ()Ljava/lang/String;
4083+
public final fun getHideRingingNotificationInForeground ()Z
40834084
public fun getOngoingCallNotification (Lio/getstream/video/android/model/StreamCallId;)Landroid/app/Notification;
40844085
public fun getRingingCallNotification (Lio/getstream/video/android/core/RingingState;Lio/getstream/video/android/model/StreamCallId;Ljava/lang/String;)Landroid/app/Notification;
40854086
public fun onLiveCall (Lio/getstream/video/android/model/StreamCallId;Ljava/lang/String;)V
@@ -4096,14 +4097,16 @@ public final class io/getstream/video/android/core/notifications/DefaultNotifica
40964097

40974098
public final class io/getstream/video/android/core/notifications/NotificationConfig {
40984099
public fun <init> ()V
4099-
public fun <init> (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;)V
4100-
public synthetic fun <init> (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
4100+
public fun <init> (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;Z)V
4101+
public synthetic fun <init> (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
41014102
public final fun component1 ()Ljava/util/List;
41024103
public final fun component2 ()Lkotlin/jvm/functions/Function0;
41034104
public final fun component3 ()Lio/getstream/video/android/core/notifications/NotificationHandler;
4104-
public final fun copy (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;)Lio/getstream/video/android/core/notifications/NotificationConfig;
4105-
public static synthetic fun copy$default (Lio/getstream/video/android/core/notifications/NotificationConfig;Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;ILjava/lang/Object;)Lio/getstream/video/android/core/notifications/NotificationConfig;
4105+
public final fun component4 ()Z
4106+
public final fun copy (Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;Z)Lio/getstream/video/android/core/notifications/NotificationConfig;
4107+
public static synthetic fun copy$default (Lio/getstream/video/android/core/notifications/NotificationConfig;Ljava/util/List;Lkotlin/jvm/functions/Function0;Lio/getstream/video/android/core/notifications/NotificationHandler;ZILjava/lang/Object;)Lio/getstream/video/android/core/notifications/NotificationConfig;
41064108
public fun equals (Ljava/lang/Object;)Z
4109+
public final fun getHideRingingNotificationInForeground ()Z
41074110
public final fun getNotificationHandler ()Lio/getstream/video/android/core/notifications/NotificationHandler;
41084111
public final fun getPushDeviceGenerators ()Ljava/util/List;
41094112
public final fun getRequestPermissionOnAppLaunch ()Lkotlin/jvm/functions/Function0;

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/DefaultNotificationHandler.kt

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.getstream.video.android.core.notifications
1818

1919
import android.annotation.SuppressLint
20+
import android.app.ActivityManager
2021
import android.app.Application
2122
import android.app.Notification
2223
import android.app.NotificationChannel
@@ -48,6 +49,13 @@ public open class DefaultNotificationHandler(
4849
private val notificationPermissionHandler: NotificationPermissionHandler =
4950
DefaultNotificationPermissionHandler
5051
.createDefaultNotificationPermissionHandler(application),
52+
/**
53+
* Set this to true if you want to make the ringing notifications as low-priority
54+
* in case the application is in foreground. This will prevent the notification from
55+
* interrupting the user while he is in the app. In this case you need to make sure to
56+
* handle this call state and display an incoming call screen.
57+
*/
58+
val hideRingingNotificationInForeground: Boolean = false,
5159
) : NotificationHandler,
5260
NotificationPermissionHandler by notificationPermissionHandler {
5361

@@ -126,13 +134,33 @@ public open class DefaultNotificationHandler(
126134
rejectCallPendingIntent: PendingIntent,
127135
callDisplayName: String,
128136
): Notification {
137+
// if the app is in foreground then don't interrupt the user with a high priority
138+
// notification (popup). The application will display an incoming ringing call
139+
// screen instead - but this needs to be handled by the application.
140+
// The default behaviour is that all notification are high priority
141+
val showAsHighPriority = !hideRingingNotificationInForeground || !isInForeground()
142+
129143
val channelId = application.getString(
130-
R.string.stream_video_incoming_call_notification_channel_id,
144+
if (showAsHighPriority) {
145+
R.string.stream_video_incoming_call_notification_channel_id
146+
} else {
147+
R.string.stream_video_incoming_call_low_priority_notification_channel_id
148+
},
131149
)
132150
maybeCreateChannel(channelId, application) {
133151
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
134-
description = application.getString(R.string.stream_video_incoming_call_notification_channel_description)
135-
importance = NotificationManager.IMPORTANCE_HIGH
152+
description = application.getString(
153+
if (showAsHighPriority) {
154+
R.string.stream_video_incoming_call_notification_channel_description
155+
} else {
156+
R.string.stream_video_incoming_call_low_priority_notification_channel_description
157+
},
158+
)
159+
importance = if (showAsHighPriority) {
160+
NotificationManager.IMPORTANCE_HIGH
161+
} else {
162+
NotificationManager.IMPORTANCE_LOW
163+
}
136164
this.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
137165
this.setShowBadge(true)
138166
}
@@ -383,6 +411,15 @@ public open class DefaultNotificationHandler(
383411
}
384412
}
385413

414+
private fun isInForeground(): Boolean {
415+
val appProcessInfo = ActivityManager.RunningAppProcessInfo()
416+
ActivityManager.getMyMemoryState(appProcessInfo)
417+
return (
418+
appProcessInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND ||
419+
appProcessInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE
420+
)
421+
}
422+
386423
open fun getChannelId(): String = application.getString(
387424
R.string.stream_video_incoming_call_notification_channel_id,
388425
)

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/NotificationConfig.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ public data class NotificationConfig(
2323
val pushDeviceGenerators: List<PushDeviceGenerator> = emptyList(),
2424
val requestPermissionOnAppLaunch: () -> Boolean = { true },
2525
val notificationHandler: NotificationHandler = NoOpNotificationHandler,
26+
/**
27+
* Set this to true if you want to make the ringing notifications as low-priority
28+
* in case the application is in foreground. This will prevent the notification from
29+
* interrupting the user while he is in the app. In this case you need to make sure to
30+
* handle this call state and display an incoming call screen.
31+
* NOTE: This setting has only an effect if you don't set a custom [NotificationHandler]!
32+
*/
33+
val hideRingingNotificationInForeground: Boolean = false,
2634
)

stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/StreamNotificationManager.kt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ internal class StreamNotificationManager private constructor(
8080
deviceTokenStorage.updateUserDevice(pushDevice.toDevice())
8181
Result.Success(newDevice)
8282
} catch (e: Exception) {
83+
logger.e(e) {
84+
"Failed to register device for push notifications " +
85+
"(PN will not work!). Does the push provider key " +
86+
"(${pushDevice.pushProvider.key}) match the key in the Stream Dashboard?"
87+
}
8388
Result.Failure(Error.ThrowableError("Device couldn't be created", e))
8489
}
8590
}
@@ -151,7 +156,10 @@ internal class StreamNotificationManager private constructor(
151156
} else {
152157
val application = context.applicationContext as? Application
153158
val updatedNotificationConfig =
154-
notificationConfig.overrideDefault(application)
159+
notificationConfig.overrideDefault(
160+
application = application,
161+
hideRingingNotificationInForeground = notificationConfig.hideRingingNotificationInForeground,
162+
)
155163
val onPermissionStatus: (NotificationPermissionStatus) -> Unit = { nps ->
156164
with(updatedNotificationConfig.notificationHandler) {
157165
when (nps) {
@@ -182,11 +190,17 @@ internal class StreamNotificationManager private constructor(
182190
}
183191
}
184192

185-
private fun NotificationConfig.overrideDefault(application: Application?): NotificationConfig {
193+
private fun NotificationConfig.overrideDefault(
194+
application: Application?,
195+
hideRingingNotificationInForeground: Boolean,
196+
): NotificationConfig {
186197
return application?.let {
187198
val notificationHandler = notificationHandler
188199
.takeUnless { it == NoOpNotificationHandler }
189-
?: DefaultNotificationHandler(application)
200+
?: DefaultNotificationHandler(
201+
application = application,
202+
hideRingingNotificationInForeground = hideRingingNotificationInForeground,
203+
)
190204
this.copy(notificationHandler = notificationHandler)
191205
} ?: this
192206
}

0 commit comments

Comments
 (0)