@capgo/capacitor-stream-call 0.0.67 → 0.0.68
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.
|
@@ -154,44 +154,6 @@ public class StreamCallPlugin : Plugin() {
|
|
|
154
154
|
val serviceIntent = Intent(activity, StreamCallBackgroundService::class.java)
|
|
155
155
|
activity.startService(serviceIntent)
|
|
156
156
|
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
157
|
}
|
|
196
158
|
|
|
197
159
|
@OptIn(DelicateCoroutinesApi::class)
|
|
@@ -1886,18 +1848,12 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1886
1848
|
}
|
|
1887
1849
|
|
|
1888
1850
|
companion object {
|
|
1889
|
-
private var pendingIntent: Intent? = null
|
|
1890
|
-
@JvmStatic fun saveInitialIntent(it: Intent) {
|
|
1891
|
-
pendingIntent = it
|
|
1892
|
-
}
|
|
1893
1851
|
@JvmStatic fun preLoadInit(ctx: Context, app: Application) {
|
|
1894
1852
|
holder ?: run {
|
|
1895
1853
|
val p = StreamCallPlugin()
|
|
1896
1854
|
p.savedContext = ctx
|
|
1897
1855
|
p.initializeStreamVideo(ctx, app)
|
|
1898
1856
|
holder = p
|
|
1899
|
-
// record the intent that started the process
|
|
1900
|
-
if (ctx is Activity) saveInitialIntent((ctx as Activity).intent)
|
|
1901
1857
|
}
|
|
1902
1858
|
}
|
|
1903
1859
|
private var holder: StreamCallPlugin? = null
|
package/package.json
CHANGED