Browse Source

fix(ios) fix conference failing when proximity sensor is near

React Native links timers to the display, so they cannot run when the display is
not running. Builtin timers already take being in the background into account,
but not the proximity sensor.

Credits: https://github.com/react-native-webrtc/react-native-callkeep/issues/143

Fixes: https://github.com/jitsi/jitsi-meet/issues/9619
factor2
Saúl Ibarra Corretgé 4 years ago
parent
commit
10cc3b2b31
1 changed files with 33 additions and 0 deletions
  1. 33
    0
      patches/react-native+0.61.5-jitsi.2.patch

+ 33
- 0
patches/react-native+0.61.5-jitsi.2.patch View File

@@ -11,6 +11,39 @@ index bd48f44..d243ed0 100644
11 11
                                 withDispatchGroup:(dispatch_group_t)dispatchGroup
12 12
                                  lazilyDiscovered:(BOOL)lazilyDiscovered
13 13
  {
14
+diff --git a/node_modules/react-native/React/Modules/RCTTiming.m b/node_modules/react-native/React/Modules/RCTTiming.m
15
+index 8a09022..265d7b6 100644
16
+--- a/node_modules/react-native/React/Modules/RCTTiming.m
17
++++ b/node_modules/react-native/React/Modules/RCTTiming.m
18
+@@ -130,6 +130,11 @@ - (void)setBridge:(RCTBridge *)bridge
19
+                                                object:nil];
20
+   }
21
+
22
++  [[NSNotificationCenter defaultCenter] addObserver:self
23
++                                           selector:@selector(proximityChanged)
24
++                                               name:UIDeviceProximityStateDidChangeNotification
25
++                                             object:nil];
26
++
27
+   _bridge = bridge;
28
+ }
29
+
30
+@@ -276,6 +281,16 @@ - (void)didUpdateFrame:(RCTFrameUpdate *)update
31
+   }
32
+ }
33
+
34
++-(void)proximityChanged
35
++{
36
++  BOOL near = [UIDevice currentDevice].proximityState;
37
++  if (near) {
38
++    [self appDidMoveToBackground];
39
++  } else {
40
++    [self appDidMoveToForeground];
41
++  }
42
++}
43
++
44
+ - (void)scheduleSleepTimer:(NSDate *)sleepTarget
45
+ {
46
+   @synchronized (self) {
14 47
 diff --git a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm b/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
15 48
 index 3cb73b5..e4a14b4 100644
16 49
 --- a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm

Loading…
Cancel
Save