@cloudflare/realtimekit-react-native 0.1.2-staging.6 → 0.1.2-staging.7

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.
@@ -26,6 +26,7 @@ export default class LocalMediaHandler extends EventEmitter {
26
26
  audioEnabled: boolean;
27
27
  videoEnabled: boolean;
28
28
  screenShareEnabled: boolean;
29
+ private _pendingScreenShare;
29
30
  currentDevices: {
30
31
  audio?: MediaDeviceInfo;
31
32
  video?: MediaDeviceInfo;
@@ -51,15 +51,15 @@ class LocalMediaHandler extends EventEmitter {
51
51
  return;
52
52
  const val = yield DyteHelper.isForegroundServiceRunning();
53
53
  if (!val) {
54
- if (Platform.Version >= 26) {
55
- yield DyteHelper.createNotificationChannel();
56
- }
57
54
  if (Platform.Version >= 33) {
58
55
  const res = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
59
56
  if (res !== PermissionsAndroid.RESULTS.GRANTED) {
60
57
  console.warn('Permission required for screenshare notification');
61
58
  }
62
59
  }
60
+ if (Platform.Version >= 26) {
61
+ yield DyteHelper.createNotificationChannel();
62
+ }
63
63
  try {
64
64
  yield DyteHelper.startService();
65
65
  }
@@ -75,6 +75,7 @@ class LocalMediaHandler extends EventEmitter {
75
75
  _LocalMediaHandler_appState.set(this, void 0);
76
76
  _LocalMediaHandler_appStateSubscription.set(this, void 0);
77
77
  _LocalMediaHandler_interval.set(this, void 0);
78
+ this._pendingScreenShare = false;
78
79
  this._handleAppStateChange = (nextAppState) => {
79
80
  // console.log('App state changed to : ', nextAppState);
80
81
  if (__classPrivateFieldGet(this, _LocalMediaHandler_appState, "f").match(/inactive|background/) &&
@@ -92,7 +93,9 @@ class LocalMediaHandler extends EventEmitter {
92
93
  }
93
94
  else {
94
95
  if (__classPrivateFieldGet(this, _LocalMediaHandler_interval, "f") === null) {
95
- this.configureForeground();
96
+ if (this.screenShareEnabled || this._pendingScreenShare) {
97
+ this.configureForeground();
98
+ }
96
99
  }
97
100
  __classPrivateFieldSet(this, _LocalMediaHandler_interval, BackgroundTimer.setInterval(() => { }, 1000), "f");
98
101
  __classPrivateFieldSet(this, _LocalMediaHandler_appState, nextAppState, "f");
@@ -733,6 +736,7 @@ class LocalMediaHandler extends EventEmitter {
733
736
  return;
734
737
  }
735
738
  if (Platform.OS === 'android') {
739
+ this._pendingScreenShare = true;
736
740
  yield this.configureForeground();
737
741
  try {
738
742
  this.setScreenShareTracks(yield LocalMediaUtils.getScreenShareTracks());
@@ -742,6 +746,10 @@ class LocalMediaHandler extends EventEmitter {
742
746
  console.warn('Failed to start screenshare', e);
743
747
  this.screenShareEnabled = false;
744
748
  yield DyteHelper.stopService();
749
+ this._pendingScreenShare = false;
750
+ }
751
+ finally {
752
+ this._pendingScreenShare = false;
745
753
  }
746
754
  }
747
755
  if (Platform.OS === 'ios') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/realtimekit-react-native",
3
- "version": "0.1.2-staging.6",
3
+ "version": "0.1.2-staging.7",
4
4
  "description": "Cloudflare RealtimeKit SDK for react native",
5
5
  "main": "lib/index.js",
6
6
  "author": "Cloudflare",
@@ -38,7 +38,7 @@
38
38
  "android"
39
39
  ],
40
40
  "peerDependencies": {
41
- "@cloudflare/react-native-webrtc": "~114.0.16",
41
+ "@cloudflare/react-native-webrtc": "~114.0.18",
42
42
  "@expo/config-plugins": "*",
43
43
  "react": "*",
44
44
  "react-native": "*"