@capgo/capacitor-stream-call 7.0.5 → 7.1.2
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.
- package/android/build.gradle +2 -2
- package/android/src/main/java/ee/forgr/capacitor/streamcall/CustomStreamIntentResolver.kt +16 -10
- package/android/src/main/java/ee/forgr/capacitor/streamcall/StreamCallPlugin.kt +5 -5
- package/ios/Sources/StreamCallPlugin/StreamCallPlugin.swift +41 -4
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -77,8 +77,8 @@ dependencies {
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
// Stream dependencies
|
|
80
|
-
implementation("io.getstream:stream-video-android-ui-compose:1.
|
|
81
|
-
implementation("io.getstream:stream-video-android-core:1.
|
|
80
|
+
implementation("io.getstream:stream-video-android-ui-compose:1.11.1")
|
|
81
|
+
implementation("io.getstream:stream-video-android-core:1.11.1")
|
|
82
82
|
implementation("io.getstream:stream-android-push:1.3.2")
|
|
83
83
|
implementation("io.getstream:stream-android-push-firebase:1.3.2")
|
|
84
84
|
|
|
@@ -13,12 +13,18 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
13
13
|
|
|
14
14
|
private val PENDING_INTENT_FLAG = PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
15
15
|
|
|
16
|
-
override fun searchIncomingCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? {
|
|
16
|
+
override fun searchIncomingCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? {
|
|
17
17
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
18
18
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
19
19
|
putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
|
|
20
20
|
action = "io.getstream.video.android.action.INCOMING_CALL"
|
|
21
21
|
|
|
22
|
+
} ?: Intent(Intent.ACTION_MAIN).apply {
|
|
23
|
+
setPackage(context.packageName)
|
|
24
|
+
addCategory(Intent.CATEGORY_LAUNCHER)
|
|
25
|
+
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
26
|
+
putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
|
|
27
|
+
action = "io.getstream.video.android.action.INCOMING_CALL"
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
return PendingIntent.getActivity(
|
|
@@ -29,7 +35,7 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
29
35
|
)
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
override fun searchOutgoingCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? {
|
|
38
|
+
override fun searchOutgoingCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? {
|
|
33
39
|
// For outgoing calls, create a specific intent that only opens webview when user taps
|
|
34
40
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
35
41
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
@@ -49,13 +55,13 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
49
55
|
)
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
override fun searchNotificationCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? =
|
|
58
|
+
override fun searchNotificationCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? =
|
|
53
59
|
searchActivityPendingIntent(Intent(NotificationHandler.ACTION_NOTIFICATION), callId, notificationId)
|
|
54
60
|
|
|
55
|
-
override fun searchMissedCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? =
|
|
61
|
+
override fun searchMissedCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? =
|
|
56
62
|
searchActivityPendingIntent(Intent(NotificationHandler.ACTION_MISSED_CALL), callId, notificationId)
|
|
57
63
|
|
|
58
|
-
override fun getDefaultPendingIntent(): PendingIntent {
|
|
64
|
+
override fun getDefaultPendingIntent(payload: Map<String, Any?>): PendingIntent {
|
|
59
65
|
val intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
|
|
60
66
|
?: Intent(Intent.ACTION_MAIN).apply {
|
|
61
67
|
setPackage(context.packageName)
|
|
@@ -70,10 +76,10 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
70
76
|
)
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
override fun searchLiveCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? =
|
|
79
|
+
override fun searchLiveCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? =
|
|
74
80
|
searchActivityPendingIntent(Intent(NotificationHandler.ACTION_LIVE_CALL), callId, notificationId)
|
|
75
81
|
|
|
76
|
-
override fun searchAcceptCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? {
|
|
82
|
+
override fun searchAcceptCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? {
|
|
77
83
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
78
84
|
action = NotificationHandler.ACTION_ACCEPT_CALL
|
|
79
85
|
putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
|
|
@@ -88,10 +94,10 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
88
94
|
)
|
|
89
95
|
}
|
|
90
96
|
|
|
91
|
-
override fun searchRejectCallPendingIntent(callId: StreamCallId): PendingIntent? =
|
|
97
|
+
override fun searchRejectCallPendingIntent(callId: StreamCallId, payload: Map<String, Any?>): PendingIntent? =
|
|
92
98
|
searchBroadcastPendingIntent(Intent(NotificationHandler.ACTION_REJECT_CALL), callId)
|
|
93
99
|
|
|
94
|
-
override fun searchEndCallPendingIntent(callId: StreamCallId): PendingIntent? {
|
|
100
|
+
override fun searchEndCallPendingIntent(callId: StreamCallId, payload: Map<String, Any?>): PendingIntent? {
|
|
95
101
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
96
102
|
action = NotificationHandler.ACTION_LEAVE_CALL
|
|
97
103
|
putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
|
|
@@ -106,7 +112,7 @@ class CustomStreamIntentResolver(private val context: Application) : StreamInten
|
|
|
106
112
|
)
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
override fun searchOngoingCallPendingIntent(callId: StreamCallId, notificationId: Int): PendingIntent? {
|
|
115
|
+
override fun searchOngoingCallPendingIntent(callId: StreamCallId, notificationId: Int, payload: Map<String, Any?>): PendingIntent? {
|
|
110
116
|
val launchIntent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
|
|
111
117
|
action = NotificationHandler.ACTION_ONGOING_CALL
|
|
112
118
|
putExtra(NotificationHandler.INTENT_EXTRA_CALL_CID, callId)
|
|
@@ -350,7 +350,7 @@ class StreamCallPlugin : Plugin() {
|
|
|
350
350
|
changeActivityAsVisibleOnLockScreen(this@StreamCallPlugin.activity, false)
|
|
351
351
|
|
|
352
352
|
// Notify that call has ended using our helper
|
|
353
|
-
updateCallStatusAndNotify(call.
|
|
353
|
+
updateCallStatusAndNotify(call.cid, "rejected")
|
|
354
354
|
|
|
355
355
|
hideIncomingCall()
|
|
356
356
|
} catch (e: Exception) {
|
|
@@ -1235,8 +1235,8 @@ class StreamCallPlugin : Plugin() {
|
|
|
1235
1235
|
Log.d("StreamCallPlugin", "internalAcceptCall: setActiveCall completed for call ${call.id}")
|
|
1236
1236
|
|
|
1237
1237
|
// Notify that call has started using helper
|
|
1238
|
-
updateCallStatusAndNotify(call.
|
|
1239
|
-
Log.d("StreamCallPlugin", "internalAcceptCall: updateCallStatusAndNotify(joined) called for ${call.
|
|
1238
|
+
updateCallStatusAndNotify(call.cid, "joined")
|
|
1239
|
+
Log.d("StreamCallPlugin", "internalAcceptCall: updateCallStatusAndNotify(joined) called for ${call.cid}")
|
|
1240
1240
|
|
|
1241
1241
|
// Show overlay view with the active call and make webview transparent
|
|
1242
1242
|
runOnMainThread {
|
|
@@ -1983,7 +1983,7 @@ class StreamCallPlugin : Plugin() {
|
|
|
1983
1983
|
|
|
1984
1984
|
@OptIn(InternalStreamVideoApi::class)
|
|
1985
1985
|
private suspend fun endCallRaw(call: Call) {
|
|
1986
|
-
val callId = call.
|
|
1986
|
+
val callId = call.cid
|
|
1987
1987
|
Log.d("StreamCallPlugin", "Attempting to end call $callId")
|
|
1988
1988
|
|
|
1989
1989
|
try {
|
|
@@ -2107,7 +2107,7 @@ class StreamCallPlugin : Plugin() {
|
|
|
2107
2107
|
|
|
2108
2108
|
@OptIn(DelicateCoroutinesApi::class)
|
|
2109
2109
|
private fun transEndCallRaw(call: Call) {
|
|
2110
|
-
val callId = call.
|
|
2110
|
+
val callId = call.cid
|
|
2111
2111
|
val savedCapacitorActivity = savedActivity
|
|
2112
2112
|
if (savedCapacitorActivity == null) {
|
|
2113
2113
|
Log.d("StreamCallPlugin", "Cannot perform transEndCallRaw for call $callId. savedCapacitorActivity is null")
|
|
@@ -49,6 +49,7 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
49
49
|
private var activeCallSubscription: AnyCancellable?
|
|
50
50
|
private var lastVoIPToken: String?
|
|
51
51
|
private var touchInterceptView: TouchInterceptView?
|
|
52
|
+
private var needsTouchInterceptorSetup: Bool = false
|
|
52
53
|
|
|
53
54
|
private var streamVideo: StreamVideo?
|
|
54
55
|
|
|
@@ -71,6 +72,7 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
71
72
|
|
|
72
73
|
// Helper method to update call status and notify listeners
|
|
73
74
|
private func updateCallStatusAndNotify(callId: String, state: String, userId: String? = nil, reason: String? = nil, caller: [String: Any]? = nil, members: [[String: Any]]? = nil) {
|
|
75
|
+
print("updateCallStatusAndNotify: callId: \(callId), state: \(state)")
|
|
74
76
|
// Update stored call info
|
|
75
77
|
currentCallId = callId
|
|
76
78
|
currentCallState = state
|
|
@@ -241,6 +243,9 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
241
243
|
print("- In call state detected")
|
|
242
244
|
print("- All participants: \(String(describing: viewModel.participants))")
|
|
243
245
|
|
|
246
|
+
// Ensure views are set up first (important when accepting call from notification)
|
|
247
|
+
self.setupViews()
|
|
248
|
+
|
|
244
249
|
// Create/update overlay and make visible when there's an active call
|
|
245
250
|
self.createCallOverlayView()
|
|
246
251
|
|
|
@@ -290,8 +295,9 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
290
295
|
print("Failed to get call info for caller details: \(error)")
|
|
291
296
|
}
|
|
292
297
|
|
|
293
|
-
// Notify with caller information
|
|
294
|
-
|
|
298
|
+
// Notify with caller information
|
|
299
|
+
let fullCallId = "\(incomingCall.type):\(incomingCall.id)"
|
|
300
|
+
self.updateCallStatusAndNotify(callId: fullCallId, state: "ringing", caller: caller, members: members)
|
|
295
301
|
}
|
|
296
302
|
} else if newState == .idle {
|
|
297
303
|
print("Call state changed to idle. CurrentCallId: \(self.currentCallId), ActiveCall: \(String(describing: self.streamVideo?.state.activeCall?.cId))")
|
|
@@ -592,7 +598,8 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
592
598
|
}
|
|
593
599
|
|
|
594
600
|
// Now send the created event with complete member data
|
|
595
|
-
|
|
601
|
+
let fullCallId = "\(callType):\(callId)"
|
|
602
|
+
self.updateCallStatusAndNotify(callId: fullCallId, state: "created", members: allMembers)
|
|
596
603
|
|
|
597
604
|
// Update UI on main thread
|
|
598
605
|
await MainActor.run {
|
|
@@ -808,12 +815,19 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
808
815
|
|
|
809
816
|
// Update the CallOverlayView with the active call
|
|
810
817
|
await MainActor.run {
|
|
818
|
+
print("acceptCall: Setting up UI for accepted call")
|
|
819
|
+
|
|
820
|
+
// Ensure views are set up first
|
|
821
|
+
self.setupViews()
|
|
822
|
+
|
|
811
823
|
// Add touch interceptor for the call
|
|
812
824
|
self.addTouchInterceptor()
|
|
813
825
|
|
|
814
826
|
// self.overlayViewModel?.updateCall(streamCall)
|
|
815
827
|
self.overlayView?.isHidden = false
|
|
816
828
|
self.webView?.isOpaque = false
|
|
829
|
+
|
|
830
|
+
print("acceptCall: UI setup complete - overlay visible: \(!self.overlayView!.isHidden), touch interceptor: \(self.touchInterceptView != nil)")
|
|
817
831
|
}
|
|
818
832
|
|
|
819
833
|
call.resolve([
|
|
@@ -926,10 +940,32 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
926
940
|
])
|
|
927
941
|
}
|
|
928
942
|
}
|
|
943
|
+
|
|
944
|
+
// Check if we have an active call and need to add touch interceptor
|
|
945
|
+
if let activeCall = self.streamVideo?.state.activeCall {
|
|
946
|
+
print("Active call detected during setupViews, ensuring touch interceptor is added")
|
|
947
|
+
// Make overlay visible if there's an active call
|
|
948
|
+
self.overlayView?.isHidden = false
|
|
949
|
+
self.webView?.isOpaque = false
|
|
950
|
+
// Add touch interceptor if not already present
|
|
951
|
+
self.addTouchInterceptor()
|
|
952
|
+
} else if self.needsTouchInterceptorSetup {
|
|
953
|
+
// If we previously tried to add touch interceptor but webview wasn't ready
|
|
954
|
+
print("Deferred touch interceptor setup detected, attempting to add now")
|
|
955
|
+
self.addTouchInterceptor()
|
|
956
|
+
// Reset the flag if successful
|
|
957
|
+
if self.touchInterceptView != nil {
|
|
958
|
+
self.needsTouchInterceptorSetup = false
|
|
959
|
+
}
|
|
960
|
+
}
|
|
929
961
|
}
|
|
930
962
|
|
|
931
963
|
private func addTouchInterceptor() {
|
|
932
|
-
guard let webView = self.webView, let parent = webView.superview else {
|
|
964
|
+
guard let webView = self.webView, let parent = webView.superview else {
|
|
965
|
+
print("Cannot add touch interceptor - webView or parent not ready, marking for deferred setup")
|
|
966
|
+
self.needsTouchInterceptorSetup = true
|
|
967
|
+
return
|
|
968
|
+
}
|
|
933
969
|
|
|
934
970
|
// Check if touch interceptor already exists
|
|
935
971
|
if self.touchInterceptView != nil {
|
|
@@ -981,6 +1017,7 @@ public class StreamCallPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
981
1017
|
// Remove touch interceptor from view hierarchy
|
|
982
1018
|
touchInterceptView.removeFromSuperview()
|
|
983
1019
|
self.touchInterceptView = nil
|
|
1020
|
+
self.needsTouchInterceptorSetup = false
|
|
984
1021
|
|
|
985
1022
|
print("Touch interceptor removed after call ended")
|
|
986
1023
|
}
|
package/package.json
CHANGED