@daily-co/react-native-daily-js 0.57.0 → 0.59.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.
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Install `react-native-daily-js` along with its peer dependencies:
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm i @daily-co/react-native-daily-js @react-native-async-storage/async-storage@^1.15.7 react-native-background-timer@^2.3.1 react-native-get-random-values@^1.9.0
|
|
18
|
-
npm i --save-exact @daily-co/react-native-webrtc@
|
|
18
|
+
npm i --save-exact @daily-co/react-native-webrtc@118.0.3-daily.1
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Then, follow the below steps to set up your native project on each platform. **Note that these steps assume you're using a version of React Native that supports autolinking (>= 60).**
|
|
@@ -93,15 +93,20 @@ Add the following to `AndroidManifest.xml`:
|
|
|
93
93
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
94
94
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
95
95
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
96
|
+
|
|
96
97
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
|
98
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA"/>
|
|
99
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
|
|
100
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"/>
|
|
101
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
|
97
102
|
|
|
98
103
|
<application>
|
|
99
104
|
// ...
|
|
100
|
-
<service android:name="com.daily.reactlibrary.DailyOngoingMeetingForegroundService" android:foregroundServiceType="
|
|
105
|
+
<service android:name="com.daily.reactlibrary.DailyOngoingMeetingForegroundService" android:foregroundServiceType="camera|microphone"/>
|
|
101
106
|
</application>
|
|
102
107
|
```
|
|
103
108
|
|
|
104
|
-
> Note: above, `
|
|
109
|
+
> Note: above, `android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION` is only needed if you wish to do screen sharing.
|
|
105
110
|
|
|
106
111
|
Update your `minSdkVersion` in your top-level `build.gradle` file:
|
|
107
112
|
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
def DEFAULT_COMPILE_SDK_VERSION =
|
|
2
|
-
def DEFAULT_BUILD_TOOLS_VERSION = '
|
|
1
|
+
def DEFAULT_COMPILE_SDK_VERSION = 34
|
|
2
|
+
def DEFAULT_BUILD_TOOLS_VERSION = '34.0.0'
|
|
3
3
|
def DEFAULT_MIN_SDK_VERSION = 24
|
|
4
|
-
def DEFAULT_TARGET_SDK_VERSION =
|
|
4
|
+
def DEFAULT_TARGET_SDK_VERSION = 34
|
|
5
5
|
|
|
6
6
|
def safeExtGet(prop, fallback) {
|
|
7
7
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -26,7 +26,7 @@ buildscript {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
android {
|
|
29
|
-
|
|
29
|
+
compileSdk safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
30
30
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
31
31
|
defaultConfig {
|
|
32
32
|
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
package com.daily.reactlibrary;
|
|
2
2
|
|
|
3
|
+
import android.Manifest;
|
|
3
4
|
import android.app.Activity;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import android.content.pm.PackageManager;
|
|
7
|
+
import android.os.Build;
|
|
4
8
|
import android.os.Process;
|
|
5
9
|
import android.view.Window;
|
|
6
10
|
import android.view.WindowManager;
|
|
7
11
|
|
|
12
|
+
import androidx.core.app.ActivityCompat;
|
|
13
|
+
import androidx.core.content.ContextCompat;
|
|
14
|
+
import androidx.fragment.app.FragmentActivity;
|
|
15
|
+
|
|
16
|
+
import com.facebook.react.bridge.Arguments;
|
|
17
|
+
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
8
18
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
9
19
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
20
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
21
|
import com.facebook.react.bridge.ReactMethod;
|
|
22
|
+
import com.facebook.react.bridge.WritableMap;
|
|
23
|
+
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
24
|
+
import com.facebook.react.modules.core.PermissionListener;
|
|
12
25
|
|
|
26
|
+
import java.util.ArrayList;
|
|
27
|
+
import java.util.Arrays;
|
|
13
28
|
import java.util.HashSet;
|
|
29
|
+
import java.util.List;
|
|
14
30
|
import java.util.Set;
|
|
15
31
|
|
|
16
|
-
public class DailyNativeUtils extends ReactContextBaseJavaModule {
|
|
32
|
+
public class DailyNativeUtils extends ReactContextBaseJavaModule implements PermissionListener {
|
|
17
33
|
|
|
18
34
|
private static final String TAG = DailyNativeUtils.class.getName();
|
|
35
|
+
private static int PERMISSION_REQUEST_CODE = 666;
|
|
19
36
|
|
|
20
37
|
private final ReactApplicationContext reactContext;
|
|
21
38
|
private Set<String> requestersKeepingDeviceAwake = new HashSet<>();
|
|
22
39
|
private Set<String> requestersShowingOngoingMeetingNotification = new HashSet<>();
|
|
23
40
|
|
|
41
|
+
// Info's received to crete the notification
|
|
42
|
+
private String title;
|
|
43
|
+
private String subtitle;
|
|
44
|
+
private String iconName;
|
|
45
|
+
|
|
24
46
|
public DailyNativeUtils(ReactApplicationContext reactContext) {
|
|
25
47
|
super(reactContext);
|
|
26
48
|
this.reactContext = reactContext;
|
|
@@ -74,7 +96,10 @@ public class DailyNativeUtils extends ReactContextBaseJavaModule {
|
|
|
74
96
|
} else {
|
|
75
97
|
requestersShowingOngoingMeetingNotification.remove(requesterId);
|
|
76
98
|
}
|
|
77
|
-
|
|
99
|
+
this.title = title;
|
|
100
|
+
this.subtitle = subtitle;
|
|
101
|
+
this.iconName = iconName;
|
|
102
|
+
updateOngoingMeetingForegroundService();
|
|
78
103
|
});
|
|
79
104
|
}
|
|
80
105
|
}
|
|
@@ -88,9 +113,57 @@ public class DailyNativeUtils extends ReactContextBaseJavaModule {
|
|
|
88
113
|
}
|
|
89
114
|
}
|
|
90
115
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
@Override
|
|
117
|
+
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
|
118
|
+
if (requestCode == PERMISSION_REQUEST_CODE &&
|
|
119
|
+
Arrays.stream(grantResults).allMatch(result -> result == PackageManager.PERMISSION_GRANTED)) {
|
|
120
|
+
this.initializeOngoingMeetingForegroundService();
|
|
121
|
+
} else {
|
|
122
|
+
System.err.println("Failed to grant permissions.");
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private void checkPermissions() {
|
|
128
|
+
List<String> permissionList = new ArrayList<String>();
|
|
129
|
+
permissionList.add(Manifest.permission.CAMERA);
|
|
130
|
+
permissionList.add(Manifest.permission.RECORD_AUDIO);
|
|
131
|
+
if (Build.VERSION.SDK_INT >= 33) {
|
|
132
|
+
permissionList.add(Manifest.permission.POST_NOTIFICATIONS);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
boolean allPermissionsGranted = true;
|
|
136
|
+
for (String permission : permissionList) {
|
|
137
|
+
if (ContextCompat.checkSelfPermission(this.reactContext.getApplicationContext(), permission) != PackageManager.PERMISSION_GRANTED) {
|
|
138
|
+
allPermissionsGranted = false;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!allPermissionsGranted) {
|
|
144
|
+
Activity currentActivity = this.reactContext.getCurrentActivity();
|
|
145
|
+
if (currentActivity instanceof PermissionAwareActivity) {
|
|
146
|
+
PermissionAwareActivity permissionAware = (PermissionAwareActivity) currentActivity;
|
|
147
|
+
permissionAware.requestPermissions(permissionList.toArray(new String[0]), PERMISSION_REQUEST_CODE, this);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
// Permissions are already granted, we can initialize
|
|
151
|
+
initializeOngoingMeetingForegroundService();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private void initializeOngoingMeetingForegroundService(){
|
|
156
|
+
Activity activity = getCurrentActivity();
|
|
157
|
+
if (activity != null) {
|
|
158
|
+
activity.runOnUiThread(() -> {
|
|
159
|
+
DailyOngoingMeetingForegroundService.start(activity.getClass(), title, subtitle, iconName, reactContext);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private void updateOngoingMeetingForegroundService() {
|
|
165
|
+
if (!requestersShowingOngoingMeetingNotification.isEmpty()) {
|
|
166
|
+
this.checkPermissions();
|
|
94
167
|
} else {
|
|
95
168
|
DailyOngoingMeetingForegroundService.stop(reactContext);
|
|
96
169
|
}
|
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.59.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,20 +28,20 @@
|
|
|
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.61.1",
|
|
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"
|
|
35
35
|
},
|
|
36
36
|
"///": "WHEN ONE OF THESE CHANGE, PLEASE UPDATE README.md INSTALL SNIPPET ACCORDINGLY",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@daily-co/react-native-webrtc": "^
|
|
38
|
+
"@daily-co/react-native-webrtc": "^118.0.3-daily.1",
|
|
39
39
|
"@react-native-async-storage/async-storage": "^1.15.7",
|
|
40
40
|
"react-native-background-timer": "^2.3.1",
|
|
41
41
|
"react-native-get-random-values": "^1.9.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@daily-co/react-native-webrtc": "^
|
|
44
|
+
"@daily-co/react-native-webrtc": "^118.0.3-daily.1",
|
|
45
45
|
"@react-native-async-storage/async-storage": "^1.15.7",
|
|
46
46
|
"@types/base-64": "^1.0.0",
|
|
47
47
|
"react-native-background-timer": "^2.3.1",
|
|
@@ -87,6 +87,14 @@ export type DailyEvent =
|
|
|
87
87
|
| 'waiting-participant-removed'
|
|
88
88
|
| 'available-devices-updated'
|
|
89
89
|
| 'receive-settings-updated'
|
|
90
|
+
| 'dialin-connected'
|
|
91
|
+
| 'dialin-error'
|
|
92
|
+
| 'dialin-stopped'
|
|
93
|
+
| 'dialin-warning'
|
|
94
|
+
| 'dialout-connected'
|
|
95
|
+
| 'dialout-error'
|
|
96
|
+
| 'dialout-stopped'
|
|
97
|
+
| 'dialout-warning'
|
|
90
98
|
| 'send-settings-updated';
|
|
91
99
|
|
|
92
100
|
export type DailyMeetingState =
|
|
@@ -880,6 +888,7 @@ export interface DailyEventObjectTranscriptionMessage {
|
|
|
880
888
|
participantId: string;
|
|
881
889
|
text: string;
|
|
882
890
|
timestamp: Date;
|
|
891
|
+
rawResponse: Record<string, any>;
|
|
883
892
|
}
|
|
884
893
|
|
|
885
894
|
export interface DailyEventObjectReceiveSettingsUpdated {
|
|
@@ -925,6 +934,7 @@ export interface DailyEventObjectTranscriptionStarted {
|
|
|
925
934
|
endpointing?: number | boolean;
|
|
926
935
|
punctuate?: boolean;
|
|
927
936
|
extra?: Record<string, any>;
|
|
937
|
+
includeRawResponse?: boolean;
|
|
928
938
|
startedBy: string;
|
|
929
939
|
}
|
|
930
940
|
|
|
@@ -949,6 +959,53 @@ export interface DailyEventObjectRemoteMediaPlayerStopped {
|
|
|
949
959
|
updatedBy: string;
|
|
950
960
|
reason: DailyRemoteMediaPlayerStopReason;
|
|
951
961
|
}
|
|
962
|
+
export interface DailyEventObjectDialinConnected {
|
|
963
|
+
action: Extract<DailyEvent, 'dialin-connected'>;
|
|
964
|
+
actionTraceId?: string;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export interface DailyEventObjectDialinError {
|
|
968
|
+
action: Extract<DailyEvent, 'dialin-error'>;
|
|
969
|
+
errorMsg: string;
|
|
970
|
+
actionTraceId?: string;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
export interface DailyEventObjectDialinStopped {
|
|
974
|
+
action: Extract<DailyEvent, 'dialin-stopped'>;
|
|
975
|
+
actionTraceId?: string;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export interface DailyEventObjectDialinWarning {
|
|
979
|
+
action: Extract<DailyEvent, 'dialin-warning'>;
|
|
980
|
+
errorMsg: string;
|
|
981
|
+
actionTraceId?: string;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
export interface DailyEventObjectDialOutConnected {
|
|
985
|
+
action: Extract<DailyEvent, 'dialout-connected'>;
|
|
986
|
+
sessionId?: string;
|
|
987
|
+
actionTraceId?: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
export interface DailyEventObjectDialOutError {
|
|
991
|
+
action: Extract<DailyEvent, 'dialout-error'>;
|
|
992
|
+
errorMsg: string;
|
|
993
|
+
sessionId?: string;
|
|
994
|
+
actionTraceId?: string;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
export interface DailyEventObjectDialOutStopped {
|
|
998
|
+
action: Extract<DailyEvent, 'dialout-stopped'>;
|
|
999
|
+
sessionId?: string;
|
|
1000
|
+
actionTraceId?: string;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
export interface DailyEventObjectDialOutWarning {
|
|
1004
|
+
action: Extract<DailyEvent, 'dialout-warning'>;
|
|
1005
|
+
errorMsg: string;
|
|
1006
|
+
sessionId?: string;
|
|
1007
|
+
actionTraceId?: string;
|
|
1008
|
+
}
|
|
952
1009
|
|
|
953
1010
|
export type DailyEventObject<T extends DailyEvent = any> =
|
|
954
1011
|
T extends DailyEventObjectAppMessage['action']
|
|
@@ -1013,6 +1070,22 @@ export type DailyEventObject<T extends DailyEvent = any> =
|
|
|
1013
1070
|
? DailyEventObjectAvailableDevicesUpdated
|
|
1014
1071
|
: T extends DailyEventObjectSendSettingsUpdated['action']
|
|
1015
1072
|
? DailyEventObjectSendSettingsUpdated
|
|
1073
|
+
: T extends DailyEventObjectDialinConnected['action']
|
|
1074
|
+
? DailyEventObjectDialinConnected
|
|
1075
|
+
: T extends DailyEventObjectDialinError['action']
|
|
1076
|
+
? DailyEventObjectDialinError
|
|
1077
|
+
: T extends DailyEventObjectDialinStopped['action']
|
|
1078
|
+
? DailyEventObjectDialinStopped
|
|
1079
|
+
: T extends DailyEventObjectDialinWarning['action']
|
|
1080
|
+
? DailyEventObjectDialinWarning
|
|
1081
|
+
: T extends DailyEventObjectDialOutConnected['action']
|
|
1082
|
+
? DailyEventObjectDialOutConnected
|
|
1083
|
+
: T extends DailyEventObjectDialOutError['action']
|
|
1084
|
+
? DailyEventObjectDialOutError
|
|
1085
|
+
: T extends DailyEventObjectDialOutStopped['action']
|
|
1086
|
+
? DailyEventObjectDialOutStopped
|
|
1087
|
+
: T extends DailyEventObjectDialOutWarning['action']
|
|
1088
|
+
? DailyEventObjectDialOutWarning
|
|
1016
1089
|
: any;
|
|
1017
1090
|
|
|
1018
1091
|
export type DailyNativeInCallAudioMode = 'video' | 'voice';
|
|
@@ -1206,8 +1279,39 @@ export interface DailyTranscriptionDeepgramOptions {
|
|
|
1206
1279
|
endpointing?: number | boolean;
|
|
1207
1280
|
punctuate?: boolean;
|
|
1208
1281
|
extra?: Record<string, any>;
|
|
1282
|
+
includeRawResponse?: boolean;
|
|
1209
1283
|
}
|
|
1210
1284
|
|
|
1285
|
+
export type DailyDialOutAudioCodecs = 'PCMU' | 'OPUS' | 'G722' | 'PCMA';
|
|
1286
|
+
|
|
1287
|
+
export type DailyDialOutVideoCodecs = 'H264' | 'VP8';
|
|
1288
|
+
|
|
1289
|
+
export interface DailyDialOutCodecs {
|
|
1290
|
+
audio?: Array<DailyDialOutAudioCodecs>;
|
|
1291
|
+
video?: Array<DailyDialOutVideoCodecs>;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export interface DailyDialOutSession {
|
|
1295
|
+
sessionId: string;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
export interface DailyStartDialoutSipOptions {
|
|
1299
|
+
sipUri?: string;
|
|
1300
|
+
displayName?: string;
|
|
1301
|
+
video?: boolean;
|
|
1302
|
+
codecs?: DailyDialOutCodecs;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
export interface DailyStartDialoutPhoneOptions {
|
|
1306
|
+
phoneNumber?: string;
|
|
1307
|
+
displayName?: string;
|
|
1308
|
+
codecs?: DailyDialOutCodecs;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
export type DailyStartDialoutOptions =
|
|
1312
|
+
| DailyStartDialoutSipOptions
|
|
1313
|
+
| DailyStartDialoutPhoneOptions;
|
|
1314
|
+
|
|
1211
1315
|
export interface DailyCall {
|
|
1212
1316
|
join(properties?: DailyCallOptions): Promise<DailyParticipantsObject | void>;
|
|
1213
1317
|
leave(): Promise<void>;
|
|
@@ -1320,19 +1424,24 @@ export interface DailyCall {
|
|
|
1320
1424
|
geo(): Promise<{ current: string }>;
|
|
1321
1425
|
on<T extends DailyEvent>(
|
|
1322
1426
|
event: T,
|
|
1323
|
-
handler: (event
|
|
1427
|
+
handler: (event: DailyEventObject<T>) => void
|
|
1324
1428
|
): DailyCall;
|
|
1325
1429
|
once<T extends DailyEvent>(
|
|
1326
1430
|
event: T,
|
|
1327
|
-
handler: (event
|
|
1431
|
+
handler: (event: DailyEventObject<T>) => void
|
|
1328
1432
|
): DailyCall;
|
|
1329
1433
|
off<T extends DailyEvent>(
|
|
1330
1434
|
event: T,
|
|
1331
|
-
handler: (event
|
|
1435
|
+
handler: (event: DailyEventObject<T>) => void
|
|
1332
1436
|
): DailyCall;
|
|
1333
1437
|
properties: {
|
|
1334
1438
|
dailyConfig?: DailyAdvancedConfig;
|
|
1335
1439
|
};
|
|
1440
|
+
startDialOut(
|
|
1441
|
+
options: DailyStartDialoutOptions
|
|
1442
|
+
): Promise<{ session?: DailyDialOutSession }>;
|
|
1443
|
+
stopDialOut(options: { sessionId: string }): Promise<void>;
|
|
1444
|
+
sendDTMF(options: { sessionId: string; tones: string }): Promise<void>;
|
|
1336
1445
|
}
|
|
1337
1446
|
|
|
1338
1447
|
declare const Daily: DailyCallFactory & DailyCallStaticUtils;
|