@capgo/capacitor-stream-call 0.0.29 → 0.0.30
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.
|
@@ -63,6 +63,7 @@ import io.getstream.video.android.core.CameraDirection
|
|
|
63
63
|
import android.content.BroadcastReceiver
|
|
64
64
|
import android.content.Intent
|
|
65
65
|
import android.content.IntentFilter
|
|
66
|
+
import io.getstream.android.video.generated.models.CallSessionParticipantLeftEvent
|
|
66
67
|
|
|
67
68
|
// I am not a religious pearson, but at this point, I am not sure even god himself would understand this code
|
|
68
69
|
// It's a spaghetti-like, tangled, unreadable mess and frankly, I am deeply sorry for the code crimes commited in the Android impl
|
|
@@ -705,6 +706,28 @@ public class StreamCallPlugin : Plugin() {
|
|
|
705
706
|
updateCallStatusAndNotify(event.callCid, "left")
|
|
706
707
|
}
|
|
707
708
|
|
|
709
|
+
is CallSessionParticipantLeftEvent -> {
|
|
710
|
+
val activeCall = streamVideoClient?.state?.activeCall?.value
|
|
711
|
+
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: Received for call ${event.callCid}. User left: ${event.participant?.user?.id}. Active call: ${activeCall?.cid}")
|
|
712
|
+
|
|
713
|
+
if (activeCall != null && activeCall.cid == event.callCid) {
|
|
714
|
+
// Directly check remote participants after a left event for the active call
|
|
715
|
+
val remoteParticipants = activeCall.state.remoteParticipants.value
|
|
716
|
+
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: Active call ${activeCall.cid}, remote participants count: ${remoteParticipants.size}")
|
|
717
|
+
|
|
718
|
+
if (remoteParticipants.isEmpty()) {
|
|
719
|
+
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: All remote participants have left call ${activeCall.cid}. Ending call.")
|
|
720
|
+
kotlinx.coroutines.GlobalScope.launch(Dispatchers.IO) {
|
|
721
|
+
endCallRaw(activeCall)
|
|
722
|
+
}
|
|
723
|
+
} else {
|
|
724
|
+
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: Remote participants still present in call ${activeCall.cid}. Count: ${remoteParticipants.size}")
|
|
725
|
+
}
|
|
726
|
+
} else {
|
|
727
|
+
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: Conditions not met (activeCall null, or cid mismatch, or local user not joined). ActiveCall CID: ${activeCall?.cid}, Event CID: ${event.callCid}")
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
708
731
|
else -> {
|
|
709
732
|
updateCallStatusAndNotify(
|
|
710
733
|
streamVideoClient?.state?.activeCall?.value?.cid ?: "",
|
|
@@ -726,7 +749,8 @@ public class StreamCallPlugin : Plugin() {
|
|
|
726
749
|
android.util.Log.d("StreamCallPlugin", "- All participants: ${state.participants}")
|
|
727
750
|
android.util.Log.d("StreamCallPlugin", "- Remote participants: ${state.remoteParticipants}")
|
|
728
751
|
|
|
729
|
-
// Notify that a call has started
|
|
752
|
+
// Notify that a call has started or state updated (e.g., participants changed but still active)
|
|
753
|
+
// The actual check for "last participant" is now handled by CallSessionParticipantLeftEvent
|
|
730
754
|
updateCallStatusAndNotify(call.cid, "joined")
|
|
731
755
|
} ?: run {
|
|
732
756
|
// Notify that call has ended using our helper
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import android.view.MotionEvent
|
|
2
2
|
import android.view.ViewGroup
|
|
3
3
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
4
|
+
import android.util.Log
|
|
4
5
|
|
|
5
6
|
class TouchInterceptWrapper(private val originalViewGroup: ViewGroup) : CoordinatorLayout(
|
|
6
7
|
originalViewGroup.context
|
|
@@ -13,19 +14,31 @@ class TouchInterceptWrapper(private val originalViewGroup: ViewGroup) : Coordina
|
|
|
13
14
|
originalViewGroup.removeViewAt(0)
|
|
14
15
|
addView(child)
|
|
15
16
|
}
|
|
17
|
+
Log.d("TouchInterceptWrapper", "Wrapped original view group and moved children.")
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
|
21
|
+
Log.d("TouchInterceptWrapper", "dispatchTouchEvent: action=${MotionEvent.actionToString(ev.action)}, x=${ev.x}, y=${ev.y}")
|
|
22
|
+
var eventHandledOverall = false // Declare and initialize
|
|
19
23
|
// Traverse children from top (highest z) to bottom
|
|
20
24
|
for (i in childCount - 1 downTo 0) {
|
|
21
25
|
val child = getChildAt(i)
|
|
26
|
+
Log.d("TouchInterceptWrapper", "Checking child $i: ${child::class.java.simpleName}, visibility: ${child.visibility == VISIBLE}")
|
|
22
27
|
if (child.visibility == VISIBLE) {
|
|
23
28
|
val copy = MotionEvent.obtain(ev)
|
|
24
|
-
|
|
29
|
+
// It's important to transform event coordinates to the child's coordinate system
|
|
30
|
+
copy.offsetLocation(-child.left.toFloat(), -child.top.toFloat())
|
|
31
|
+
val handledByChild = child.dispatchTouchEvent(copy)
|
|
32
|
+
Log.d("TouchInterceptWrapper", "Child $i (${child::class.java.simpleName}) handled: $handledByChild")
|
|
25
33
|
copy.recycle()
|
|
26
|
-
if (
|
|
34
|
+
if (handledByChild) {
|
|
35
|
+
Log.d("TouchInterceptWrapper", "Event handled by child $i (${child::class.java.simpleName})")
|
|
36
|
+
eventHandledOverall = true // Set to true if any child handles it
|
|
37
|
+
// Do NOT return true here, allow other children to receive the event
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
|
-
|
|
41
|
+
Log.d("TouchInterceptWrapper", "Overall event handled: $eventHandledOverall")
|
|
42
|
+
return eventHandledOverall // Return true if any child handled it, false otherwise
|
|
30
43
|
}
|
|
31
44
|
}
|
package/package.json
CHANGED