@capgo/capacitor-stream-call 0.0.67 → 0.0.69
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.
|
@@ -52,6 +52,7 @@ import io.getstream.android.video.generated.models.CallMissedEvent
|
|
|
52
52
|
import io.getstream.android.video.generated.models.CallRejectedEvent
|
|
53
53
|
import io.getstream.android.video.generated.models.CallRingEvent
|
|
54
54
|
import io.getstream.android.video.generated.models.CallSessionEndedEvent
|
|
55
|
+
import io.getstream.android.video.generated.models.CallSessionParticipantCountsUpdatedEvent
|
|
55
56
|
import io.getstream.android.video.generated.models.CallSessionParticipantLeftEvent
|
|
56
57
|
import io.getstream.android.video.generated.models.CallSessionStartedEvent
|
|
57
58
|
import io.getstream.android.video.generated.models.VideoEvent
|
|
@@ -154,44 +155,6 @@ public class StreamCallPlugin : Plugin() {
|
|
|
154
155
|
val serviceIntent = Intent(activity, StreamCallBackgroundService::class.java)
|
|
155
156
|
activity.startService(serviceIntent)
|
|
156
157
|
android.util.Log.d("StreamCallPlugin", "Started StreamCallBackgroundService to keep app alive")
|
|
157
|
-
|
|
158
|
-
// Handle intents, but avoid processing the same intent twice
|
|
159
|
-
val currentIntent = activity?.intent
|
|
160
|
-
val savedIntent = pendingIntent
|
|
161
|
-
|
|
162
|
-
// Check if both intents are the same (common when app is killed and restarted)
|
|
163
|
-
val areSameIntent = currentIntent != null && savedIntent != null &&
|
|
164
|
-
currentIntent.action == savedIntent.action &&
|
|
165
|
-
try {
|
|
166
|
-
val currentCid = currentIntent.streamCallId(NotificationHandler.INTENT_EXTRA_CALL_CID)
|
|
167
|
-
val savedCid = savedIntent.streamCallId(NotificationHandler.INTENT_EXTRA_CALL_CID)
|
|
168
|
-
currentCid?.cid == savedCid?.cid
|
|
169
|
-
} catch (e: Exception) {
|
|
170
|
-
android.util.Log.w("StreamCallPlugin", "Error comparing call CIDs: ${e.message}")
|
|
171
|
-
false
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
when {
|
|
175
|
-
areSameIntent -> {
|
|
176
|
-
android.util.Log.d("StreamCallPlugin", "Current intent and saved intent are identical, processing only once")
|
|
177
|
-
if (currentIntent != null) {
|
|
178
|
-
handleOnNewIntent(currentIntent)
|
|
179
|
-
}
|
|
180
|
-
pendingIntent = null // Clear to prevent double processing
|
|
181
|
-
}
|
|
182
|
-
savedIntent != null -> {
|
|
183
|
-
android.util.Log.d("StreamCallPlugin", "Processing saved initial intent")
|
|
184
|
-
handleOnNewIntent(savedIntent)
|
|
185
|
-
pendingIntent = null
|
|
186
|
-
}
|
|
187
|
-
currentIntent != null -> {
|
|
188
|
-
android.util.Log.d("StreamCallPlugin", "Processing current activity intent")
|
|
189
|
-
handleOnNewIntent(currentIntent)
|
|
190
|
-
}
|
|
191
|
-
else -> {
|
|
192
|
-
android.util.Log.d("StreamCallPlugin", "No intents to process")
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
158
|
}
|
|
196
159
|
|
|
197
160
|
@OptIn(DelicateCoroutinesApi::class)
|
|
@@ -861,7 +824,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
861
824
|
updateCallStatusAndNotify(event.callCid, "left")
|
|
862
825
|
}
|
|
863
826
|
|
|
864
|
-
is ParticipantLeftEvent, is CallSessionParticipantLeftEvent -> {
|
|
827
|
+
is ParticipantLeftEvent, is CallSessionParticipantLeftEvent, is CallSessionParticipantCountsUpdatedEvent -> {
|
|
865
828
|
val activeCall = streamVideoClient?.state?.activeCall?.value
|
|
866
829
|
|
|
867
830
|
val callId = when (event) {
|
|
@@ -871,6 +834,9 @@ public class StreamCallPlugin : Plugin() {
|
|
|
871
834
|
is CallSessionParticipantLeftEvent -> {
|
|
872
835
|
event.callCid
|
|
873
836
|
}
|
|
837
|
+
is CallSessionParticipantCountsUpdatedEvent -> {
|
|
838
|
+
event.callCid
|
|
839
|
+
}
|
|
874
840
|
|
|
875
841
|
else -> {
|
|
876
842
|
throw RuntimeException("Unreachable code reached when getting callId")
|
|
@@ -882,7 +848,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
882
848
|
|
|
883
849
|
if (activeCall != null && activeCall.cid == callId) {
|
|
884
850
|
val connectionState = activeCall.state.connection.value
|
|
885
|
-
if (connectionState
|
|
851
|
+
if (connectionState != RealtimeConnection.Disconnected) {
|
|
886
852
|
val total = activeCall.state.participantCounts.value?.total
|
|
887
853
|
android.util.Log.d("StreamCallPlugin", "CallSessionParticipantLeftEvent: Participant left, remaining: $total");
|
|
888
854
|
if (total != null && total <= 2) {
|
|
@@ -1886,18 +1852,12 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1886
1852
|
}
|
|
1887
1853
|
|
|
1888
1854
|
companion object {
|
|
1889
|
-
private var pendingIntent: Intent? = null
|
|
1890
|
-
@JvmStatic fun saveInitialIntent(it: Intent) {
|
|
1891
|
-
pendingIntent = it
|
|
1892
|
-
}
|
|
1893
1855
|
@JvmStatic fun preLoadInit(ctx: Context, app: Application) {
|
|
1894
1856
|
holder ?: run {
|
|
1895
1857
|
val p = StreamCallPlugin()
|
|
1896
1858
|
p.savedContext = ctx
|
|
1897
1859
|
p.initializeStreamVideo(ctx, app)
|
|
1898
1860
|
holder = p
|
|
1899
|
-
// record the intent that started the process
|
|
1900
|
-
if (ctx is Activity) saveInitialIntent((ctx as Activity).intent)
|
|
1901
1861
|
}
|
|
1902
1862
|
}
|
|
1903
1863
|
private var holder: StreamCallPlugin? = null
|
package/package.json
CHANGED