@capgo/capacitor-stream-call 0.0.91 → 0.0.93

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.
@@ -1,6 +1,5 @@
1
1
  package ee.forgr.capacitor.streamcall
2
2
 
3
- import TouchInterceptWrapper
4
3
  import android.Manifest
5
4
  import android.app.Activity
6
5
  import android.app.AlertDialog
@@ -25,6 +24,7 @@ import android.view.View
25
24
  import android.view.ViewGroup
26
25
  import android.view.WindowManager
27
26
  import android.widget.FrameLayout
27
+ import java.lang.ref.WeakReference
28
28
  import androidx.compose.foundation.layout.fillMaxSize
29
29
  import androidx.compose.runtime.collectAsState
30
30
  import androidx.compose.runtime.getValue
@@ -2538,11 +2538,11 @@ class StreamCallPlugin : Plugin() {
2538
2538
 
2539
2539
  companion object {
2540
2540
  @JvmStatic fun preLoadInit(ctx: Context, app: Application) {
2541
- holder ?: run {
2541
+ holder?.get() ?: run {
2542
2542
  val p = StreamCallPlugin()
2543
2543
  p.savedContext = ctx
2544
2544
  p.initializeStreamVideo(ctx, app)
2545
- holder = p
2545
+ holder = WeakReference(p)
2546
2546
 
2547
2547
  // Register lifecycle callback to clean up when all activities are destroyed
2548
2548
  app.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
@@ -2556,7 +2556,7 @@ class StreamCallPlugin : Plugin() {
2556
2556
  activityCount--
2557
2557
  // Only clear holder when no activities remain AND no active/ringing calls
2558
2558
  if (activityCount <= 0) {
2559
- val hasActiveCalls = holder?.let { plugin ->
2559
+ val hasActiveCalls = holder?.get()?.let { plugin ->
2560
2560
  val client = plugin.streamVideoClient
2561
2561
  val hasActive = client?.state?.activeCall?.value != null
2562
2562
  val hasRinging = client?.state?.ringingCall?.value != null
@@ -2578,7 +2578,7 @@ class StreamCallPlugin : Plugin() {
2578
2578
  })
2579
2579
  }
2580
2580
  }
2581
- private var holder: StreamCallPlugin? = null
2581
+ private var holder: WeakReference<StreamCallPlugin>? = null
2582
2582
 
2583
2583
  // Constants for SharedPreferences
2584
2584
  private const val API_KEY_PREFS_NAME = "stream_video_api_key_prefs"
@@ -1,3 +1,7 @@
1
+ package ee.forgr.capacitor.streamcall
2
+
3
+ import android.content.Context
4
+ import android.util.AttributeSet
1
5
  import android.view.MotionEvent
2
6
  import android.view.ViewGroup
3
7
  import androidx.coordinatorlayout.widget.CoordinatorLayout
@@ -5,10 +9,15 @@ import android.util.Log
5
9
  import androidx.core.view.isNotEmpty
6
10
  import androidx.core.view.isVisible
7
11
 
8
- class TouchInterceptWrapper(private val originalViewGroup: ViewGroup) : CoordinatorLayout(
9
- originalViewGroup.context
10
- ) {
11
- init {
12
+ class TouchInterceptWrapper : CoordinatorLayout {
13
+
14
+ constructor(context: Context) : super(context)
15
+
16
+ constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
17
+
18
+ constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
19
+
20
+ constructor(originalViewGroup: ViewGroup) : super(originalViewGroup.context) {
12
21
  // Copy layout parameters and children
13
22
  layoutParams = originalViewGroup.layoutParams
14
23
  while (originalViewGroup.isNotEmpty()) {
@@ -80,6 +80,14 @@ class TouchInterceptView: UIView {
80
80
  const x = \(x); const y = \(y);
81
81
  const el = document.elementFromPoint(x, y);
82
82
  if (!el) return 'NO_ELEM';
83
+
84
+ // iPad fix: Force active state since iPad Safari doesn't handle :active properly
85
+ const isIPad = navigator.userAgent.includes('iPad');
86
+ if (isIPad) {
87
+ el.classList.add('active');
88
+ if (el.style.setProperty) el.style.setProperty('opacity', '0.8', 'important');
89
+ }
90
+
83
91
  const eventInit = { bubbles: true, cancelable: true, clientX: x, clientY: y };
84
92
  const touchInit = { bubbles: true, cancelable: true, touches: [{ clientX: x, clientY: y }], targetTouches: [], changedTouches: [], shiftKey: false };
85
93
  const seq = [];
@@ -95,6 +103,15 @@ class TouchInterceptView: UIView {
95
103
  seq.push(new MouseEvent('mouseup', eventInit));
96
104
  seq.push(new MouseEvent('click', eventInit));
97
105
  seq.forEach(evt => el.dispatchEvent(evt));
106
+
107
+ // iPad cleanup
108
+ if (isIPad) {
109
+ setTimeout(() => {
110
+ el.classList.remove('active');
111
+ el.style.removeProperty('opacity');
112
+ }, 100);
113
+ }
114
+
98
115
  console.log('SyntheticClick seq on', el);
99
116
  return el.tagName;
100
117
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-stream-call",
3
- "version": "0.0.91",
3
+ "version": "0.0.93",
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",