@capgo/capacitor-stream-call 0.0.77 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,10 +75,10 @@ dependencies {
75
75
  implementation "androidx.compose.material3:material3:1.3.2"
76
76
 
77
77
  // Stream dependencies
78
- implementation("io.getstream:stream-video-android-ui-compose:1.6.3")
79
- implementation("io.getstream:stream-video-android-core:1.6.3")
80
- implementation("io.getstream:stream-android-push:1.3.1")
81
- implementation("io.getstream:stream-android-push-firebase:1.3.1")
78
+ implementation("io.getstream:stream-video-android-ui-compose:1.9.1")
79
+ implementation("io.getstream:stream-video-android-core:1.9.1")
80
+ implementation("io.getstream:stream-android-push:1.3.2")
81
+ implementation("io.getstream:stream-android-push-firebase:1.3.2")
82
82
 
83
83
  // Firebase dependencies using BOM
84
84
  implementation(platform('com.google.firebase:firebase-bom:33.13.0'))
@@ -14,6 +14,7 @@ import io.getstream.video.android.core.notifications.DefaultNotificationHandler
14
14
  import io.getstream.video.android.core.notifications.NotificationHandler
15
15
  import io.getstream.video.android.model.StreamCallId
16
16
  import io.getstream.video.android.model.streamCallId
17
+ import io.getstream.video.android.core.R
17
18
 
18
19
  // declare "incoming_calls_custom" as a constant
19
20
  const val INCOMING_CALLS_CUSTOM = "incoming_calls_custom"
@@ -206,6 +207,45 @@ class CustomNotificationHandler(
206
207
  endCall(callId)
207
208
  super.onMissedCall(callId, callDisplayName)
208
209
  }
210
+
211
+ override fun getOngoingCallNotification(
212
+ callId: StreamCallId,
213
+ callDisplayName: String?,
214
+ isOutgoingCall: Boolean,
215
+ remoteParticipantCount: Int
216
+ ): Notification? {
217
+ Log.d("CustomNotificationHandler", "getOngoingCallNotification called: callId=$callId, isOutgoing=$isOutgoingCall, participants=$remoteParticipantCount")
218
+ createOngoingCallChannel()
219
+
220
+ val launchIntent = application.packageManager.getLaunchIntentForPackage(application.packageName)
221
+ val contentIntent = if (launchIntent != null) {
222
+ launchIntent.putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
223
+ launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP)
224
+ PendingIntent.getActivity(
225
+ application,
226
+ callId.cid.hashCode(),
227
+ launchIntent,
228
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
229
+ )
230
+ } else {
231
+ Log.e("CustomNotificationHandler", "Could not get launch intent for package: ${application.packageName}. Ongoing call notification will not open the app.")
232
+ null
233
+ }
234
+
235
+ return getNotification {
236
+ setContentTitle(callDisplayName ?: "Ongoing Call")
237
+ setContentText("Tap to return to the call")
238
+ setSmallIcon(R.drawable.stream_video_ic_call)
239
+ setChannelId("ongoing_calls")
240
+ setOngoing(true)
241
+ setAutoCancel(false)
242
+ setCategory(NotificationCompat.CATEGORY_CALL)
243
+ setDefaults(0)
244
+ if (contentIntent != null) {
245
+ setContentIntent(contentIntent)
246
+ }
247
+ }
248
+ }
209
249
 
210
250
  private fun customCreateIncomingCallChannel() {
211
251
  Log.d("CustomNotificationHandler", "customCreateIncomingCallChannel called")
@@ -233,6 +273,26 @@ class CustomNotificationHandler(
233
273
  },
234
274
  )
235
275
  }
276
+
277
+ private fun createOngoingCallChannel() {
278
+ Log.d("CustomNotificationHandler", "createOngoingCallChannel called")
279
+ maybeCreateChannel(
280
+ channelId = "ongoing_calls",
281
+ context = application,
282
+ configure = {
283
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
284
+ name = "Ongoing calls"
285
+ description = "Notifications for ongoing calls"
286
+ importance = NotificationManager.IMPORTANCE_LOW
287
+ this.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
288
+ this.setShowBadge(false)
289
+ setSound(null, null)
290
+ enableVibration(false)
291
+ enableLights(false)
292
+ }
293
+ },
294
+ )
295
+ }
236
296
 
237
297
  public fun clone(): CustomNotificationHandler {
238
298
  Log.d("CustomNotificationHandler", "clone called")
@@ -2261,13 +2261,22 @@ public class StreamCallPlugin : Plugin() {
2261
2261
  return sharedPrefs.getString(DYNAMIC_API_KEY_PREF, null)
2262
2262
  }
2263
2263
 
2264
+ private fun getDynamicApiKey(context: Context): String? {
2265
+ val sharedPrefs = getApiKeyPreferences(context)
2266
+ return sharedPrefs.getString(DYNAMIC_API_KEY_PREF, null)
2267
+ }
2268
+
2264
2269
  private fun getApiKeyPreferences(): SharedPreferences {
2265
2270
  return context.getSharedPreferences(API_KEY_PREFS_NAME, Context.MODE_PRIVATE)
2266
2271
  }
2267
2272
 
2273
+ private fun getApiKeyPreferences(context: Context): SharedPreferences {
2274
+ return context.getSharedPreferences(API_KEY_PREFS_NAME, Context.MODE_PRIVATE)
2275
+ }
2276
+
2268
2277
  private fun getEffectiveApiKey(context: Context): String {
2269
2278
  // A) Check if the key exists in the custom preference
2270
- val dynamicApiKey = getDynamicApiKey()
2279
+ val dynamicApiKey = getDynamicApiKey(context)
2271
2280
  return if (!dynamicApiKey.isNullOrEmpty() && dynamicApiKey.trim().isNotEmpty()) {
2272
2281
  android.util.Log.d("StreamCallPlugin", "Using dynamic API key")
2273
2282
  dynamicApiKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-stream-call",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "description": "Uses the https://getstream.io/ SDK to implement calling in Capacitor",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",