@daily-co/react-native-daily-js 0.61.0 → 0.63.0
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.
|
@@ -20,6 +20,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
20
20
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
21
21
|
import com.facebook.react.bridge.ReactMethod;
|
|
22
22
|
import com.facebook.react.bridge.WritableMap;
|
|
23
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
23
24
|
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
24
25
|
import com.facebook.react.modules.core.PermissionListener;
|
|
25
26
|
|
|
@@ -35,6 +36,7 @@ public class DailyNativeUtils extends ReactContextBaseJavaModule implements Perm
|
|
|
35
36
|
private static int PERMISSION_REQUEST_CODE = 666;
|
|
36
37
|
|
|
37
38
|
private final ReactApplicationContext reactContext;
|
|
39
|
+
private DeviceEventManagerModule.RCTDeviceEventEmitter eventEmitter;
|
|
38
40
|
private Set<String> requestersKeepingDeviceAwake = new HashSet<>();
|
|
39
41
|
private Set<String> requestersShowingOngoingMeetingNotification = new HashSet<>();
|
|
40
42
|
|
|
@@ -57,14 +59,17 @@ public class DailyNativeUtils extends ReactContextBaseJavaModule implements Perm
|
|
|
57
59
|
|
|
58
60
|
@Override
|
|
59
61
|
public void onHostDestroy() {
|
|
62
|
+
eventEmitter.emit("EventOnHostDestroy", Arguments.createMap());
|
|
60
63
|
DailyOngoingMeetingForegroundService.stop(reactContext);
|
|
61
|
-
// This seems extreme, but the process won't otherwise immediately stop sending
|
|
62
|
-
// audio and video
|
|
63
|
-
Process.killProcess(Process.myPid());
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
@Override
|
|
69
|
+
public void initialize() {
|
|
70
|
+
this.eventEmitter = reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
@Override
|
|
69
74
|
public String getName() {
|
|
70
75
|
return "DailyNativeUtils";
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import Daily from '../type-overrides/@daily-co/daily-js';
|
|
|
2
2
|
import DailyMediaView from './DailyMediaView';
|
|
3
3
|
import 'react-native-url-polyfill/auto';
|
|
4
4
|
import 'react-native-get-random-values';
|
|
5
|
+
export type DailyAppStateEvent = 'active' | 'inactive' | 'destroyed';
|
|
5
6
|
export default Daily;
|
|
6
7
|
export * from '../type-overrides/@daily-co/daily-js';
|
|
7
8
|
export { DailyMediaView };
|
package/dist/index.js
CHANGED
|
@@ -47,10 +47,13 @@ var dailyNativeUtilsEventEmitter = new react_native_1.NativeEventEmitter(DailyNa
|
|
|
47
47
|
var hasAudioFocus;
|
|
48
48
|
var appState;
|
|
49
49
|
var audioFocusChangeListeners = new Set();
|
|
50
|
-
var
|
|
50
|
+
var appStateChangeListeners = new Set();
|
|
51
51
|
var systemScreenCaptureStopListeners = new Set();
|
|
52
52
|
var systemScreenCaptureStartCallback;
|
|
53
53
|
function setupEventListeners() {
|
|
54
|
+
dailyNativeUtilsEventEmitter.addListener('EventOnHostDestroy', function () {
|
|
55
|
+
appStateChangeListeners.forEach(function (listener) { return listener('destroyed'); });
|
|
56
|
+
});
|
|
54
57
|
// audio focus: used by daily-js to auto-mute mic, for instance
|
|
55
58
|
if (react_native_1.Platform.OS === 'android') {
|
|
56
59
|
hasAudioFocus = true; // safe assumption, hopefully
|
|
@@ -75,7 +78,9 @@ function setupEventListeners() {
|
|
|
75
78
|
var wasActive = previousState === 'active';
|
|
76
79
|
var isActive = appState === 'active';
|
|
77
80
|
if (wasActive !== isActive) {
|
|
78
|
-
|
|
81
|
+
appStateChangeListeners.forEach(function (listener) {
|
|
82
|
+
return listener(isActive ? 'active' : 'inactive');
|
|
83
|
+
});
|
|
79
84
|
}
|
|
80
85
|
});
|
|
81
86
|
if (react_native_1.Platform.OS === 'ios') {
|
|
@@ -125,10 +130,10 @@ function setupGlobals() {
|
|
|
125
130
|
audioFocusChangeListeners.add(listener);
|
|
126
131
|
}, removeAudioFocusChangeListener: function (listener) {
|
|
127
132
|
audioFocusChangeListeners.delete(listener);
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
|
|
133
|
+
}, addAppStateChangeListener: function (listener) {
|
|
134
|
+
appStateChangeListeners.add(listener);
|
|
135
|
+
}, removeAppStateChangeListener: function (listener) {
|
|
136
|
+
appStateChangeListeners.delete(listener);
|
|
132
137
|
}, addSystemScreenCaptureStopListener: function (listener) {
|
|
133
138
|
systemScreenCaptureStopListeners.add(listener);
|
|
134
139
|
}, removeSystemScreenCaptureStopListener: function (listener) {
|
package/ios/DailyNativeUtils.m
CHANGED
|
@@ -11,6 +11,7 @@ static NSString *const NotificationScreenCaptureExtensionStarted = @"ScreenCaptu
|
|
|
11
11
|
// Event to JS layer
|
|
12
12
|
static NSString *const EventSystemScreenCaptureStop = @"EventSystemScreenCaptureStop";
|
|
13
13
|
static NSString *const EventSystemScreenCaptureStart = @"EventSystemScreenCaptureStart";
|
|
14
|
+
static NSString *const EventOnHostDestroy = @"EventOnHostDestroy";
|
|
14
15
|
|
|
15
16
|
@interface DailyNativeUtils()
|
|
16
17
|
|
|
@@ -53,10 +54,24 @@ RCT_EXPORT_MODULE()
|
|
|
53
54
|
selector:@selector(handleNotificationScreenCaptureExtensionStarted)
|
|
54
55
|
name:NotificationScreenCaptureExtensionStarted
|
|
55
56
|
object:nil];
|
|
57
|
+
|
|
58
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
59
|
+
selector:@selector(applicationWillTerminate)
|
|
60
|
+
name:UIApplicationWillTerminateNotification
|
|
61
|
+
object:nil];
|
|
56
62
|
}
|
|
57
63
|
return self;
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
- (void)applicationWillTerminate {
|
|
67
|
+
NSLog(@"App is about to terminate");
|
|
68
|
+
BOOL isStillOnMeeting = _requestersKeepingDeviceAwake.count > 0;
|
|
69
|
+
if (isStillOnMeeting) {
|
|
70
|
+
[self sendEventWithName:EventOnHostDestroy body:nil];
|
|
71
|
+
NSLog(@"Triggered the event EventOnHostDestroy");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
+ (BOOL)requiresMainQueueSetup
|
|
61
76
|
{
|
|
62
77
|
return NO;
|
|
@@ -65,7 +80,7 @@ RCT_EXPORT_MODULE()
|
|
|
65
80
|
|
|
66
81
|
- (NSArray<NSString *> *)supportedEvents
|
|
67
82
|
{
|
|
68
|
-
return @[EventSystemScreenCaptureStop, EventSystemScreenCaptureStart];
|
|
83
|
+
return @[EventSystemScreenCaptureStop, EventSystemScreenCaptureStart, EventOnHostDestroy];
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
#pragma mark Public
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daily-co/react-native-daily-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"description": "React Native library for making video calls using Daily",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"baseUrl": "https://github.com/daily-co/react-native-daily-js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@daily-co/daily-js": "^0.
|
|
31
|
+
"@daily-co/daily-js": "^0.65.0",
|
|
32
32
|
"@types/react-native-background-timer": "^2.0.0",
|
|
33
33
|
"base-64": "^1.0.0",
|
|
34
34
|
"react-native-url-polyfill": "^1.1.2"
|
|
@@ -205,7 +205,6 @@ export interface DailyAdvancedConfig {
|
|
|
205
205
|
*/
|
|
206
206
|
camSimulcastEncodings?: CamSimulcastEncoding[];
|
|
207
207
|
v2CamAndMic?: boolean;
|
|
208
|
-
experimentalGetUserMediaConstraintsModify?: (constraints: any) => void;
|
|
209
208
|
micAudioMode?: 'music' | 'speech';
|
|
210
209
|
userMediaAudioConstraints?: MediaTrackConstraints;
|
|
211
210
|
userMediaVideoConstraints?: MediaTrackConstraints;
|