@cloudflare/realtimekit-react-native 0.1.4-staging.7 → 0.1.4-staging.8

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.
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SDK_VERSION = void 0;
7
- const SDK_VERSION = exports.SDK_VERSION = '0.1.4-staging.7';
7
+ const SDK_VERSION = exports.SDK_VERSION = '0.1.4-staging.8';
8
8
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION","exports"],"sources":["version.ts"],"sourcesContent":["export const SDK_VERSION = '0.1.4-staging.7';\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION","exports"],"sources":["version.ts"],"sourcesContent":["export const SDK_VERSION = '0.1.4-staging.8';\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,iBAAiB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export const SDK_VERSION = '0.1.4-staging.7';
1
+ export const SDK_VERSION = '0.1.4-staging.8';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION"],"sources":["version.ts"],"sourcesContent":["export const SDK_VERSION = '0.1.4-staging.7';\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION"],"sources":["version.ts"],"sourcesContent":["export const SDK_VERSION = '0.1.4-staging.8';\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.4-staging.7";
1
+ export declare const SDK_VERSION = "0.1.4-staging.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/realtimekit-react-native",
3
- "version": "0.1.4-staging.7",
3
+ "version": "0.1.4-staging.8",
4
4
  "description": "Cloudflare RealtimeKit SDK for react native",
5
5
  "main": "lib/commonjs/index",
6
6
  "author": "Cloudflare",
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_plugins_1 = require("@expo/config-plugins");
4
4
  const MICROPHONE = 'Allow $(PRODUCT_NAME) to access the microphone';
5
5
  const CAMERA = 'Allow $(PRODUCT_NAME) to access the camera';
6
- const BLUETOOTH = 'Allow $(PRODUCT_NAME) to access the bluetooth';
7
- const BLUETOOTH_ALWAYS = 'Allow $(PRODUCT_NAME) to access the bluetooth';
8
6
  const LIBRARY = 'Allow $(PRODUCT_NAME) to access the files';
9
7
  /**
10
8
  * Adds `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` to the `Info.plist`.
@@ -13,7 +11,7 @@ const LIBRARY = 'Allow $(PRODUCT_NAME) to access the files';
13
11
  * @param props.microphonePermission microphone permission message
14
12
  * @returns
15
13
  */
16
- const withIosPermissions = (c, { microphonePermission, cameraPermission, libraryPermission, bluetoothPermission, bluetoothAlwaysPermission, } = {}) => {
14
+ const withIosPermissions = (c, { microphonePermission, cameraPermission, libraryPermission } = {}) => {
17
15
  return (0, config_plugins_1.withInfoPlist)(c, (config) => {
18
16
  if (microphonePermission !== false) {
19
17
  config.modResults.NSMicrophoneUsageDescription =
@@ -27,18 +25,6 @@ const withIosPermissions = (c, { microphonePermission, cameraPermission, library
27
25
  config.modResults.NSCameraUsageDescription ||
28
26
  CAMERA;
29
27
  }
30
- if (bluetoothPermission !== false) {
31
- config.modResults.NSBluetoothPeripheralUsageDescription =
32
- bluetoothPermission ||
33
- config.modResults.NSBluetoothPeripheralUsageDescription ||
34
- BLUETOOTH;
35
- }
36
- if (bluetoothAlwaysPermission !== false) {
37
- config.modResults.NSBluetoothAlwaysUsageDescription =
38
- bluetoothAlwaysPermission ||
39
- config.modResults.NSBluetoothAlwaysUsageDescription ||
40
- BLUETOOTH_ALWAYS;
41
- }
42
28
  if (libraryPermission !== false) {
43
29
  config.modResults.NSPhotoLibraryUsageDescription =
44
30
  libraryPermission ||
@@ -81,20 +67,43 @@ const withAndroidPermissions = (config) => {
81
67
  'android.permission.SYSTEM_ALERT_WINDOW',
82
68
  'android.permission.WAKE_LOCK',
83
69
  'android.permission.FOREGROUND_SERVICE',
84
- 'android.permission.FOREGROUND_SERVICE_CAMERA',
85
- 'android.permission.FOREGROUND_SERVICE_MICROPHONE',
86
70
  'android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION',
87
71
  'android.permission.WRITE_EXTERNAL_STORAGE',
88
72
  'android.permission.READ_EXTERNAL_STORAGE',
89
73
  'android.permission.MICROPHONE',
90
74
  ]);
91
75
  };
76
+ const withAndroidScreenshare = (config) => {
77
+ return (0, config_plugins_1.withAndroidManifest)(config, (_config) => {
78
+ const manifest = _config.modResults;
79
+ const app = manifest.manifest.application?.[0];
80
+ if (app) {
81
+ // Avoid duplicate entries
82
+ const exists = (app.service || []).some((service) => service.$['android:name'] ===
83
+ 'com.cloudflare.realtimekit.ForegroundService');
84
+ if (!exists) {
85
+ app.service = [
86
+ ...(app.service || []),
87
+ {
88
+ $: {
89
+ 'android:enabled': 'true',
90
+ 'android:foregroundServiceType': 'mediaProjection',
91
+ 'android:name': 'com.cloudflare.realtimekit.ForegroundService',
92
+ },
93
+ },
94
+ ];
95
+ }
96
+ }
97
+ return _config;
98
+ });
99
+ };
92
100
  const withVoice = (config, props = {}) => {
93
101
  const _props = props ? props : {};
94
102
  config = withIosPermissions(config, _props);
95
103
  if (_props.microphonePermission !== false) {
96
104
  config = withAndroidPermissions(config);
97
105
  }
106
+ config = withAndroidScreenshare(config);
98
107
  return config;
99
108
  };
100
109
  exports.default = (0, config_plugins_1.createRunOncePlugin)(withVoice, '@cloudflare/realtimekit-react-native');
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  AndroidConfig,
3
+ AndroidManifest,
3
4
  ConfigPlugin,
4
5
  createRunOncePlugin,
6
+ withAndroidManifest,
5
7
  withInfoPlist,
6
8
  } from '@expo/config-plugins';
7
9
 
8
10
  const MICROPHONE = 'Allow $(PRODUCT_NAME) to access the microphone';
9
11
  const CAMERA = 'Allow $(PRODUCT_NAME) to access the camera';
10
- const BLUETOOTH = 'Allow $(PRODUCT_NAME) to access the bluetooth';
11
- const BLUETOOTH_ALWAYS = 'Allow $(PRODUCT_NAME) to access the bluetooth';
12
12
  const LIBRARY = 'Allow $(PRODUCT_NAME) to access the files';
13
13
 
14
14
  export type Props = {
@@ -47,13 +47,7 @@ export type Props = {
47
47
  */
48
48
  const withIosPermissions: ConfigPlugin<Props> = (
49
49
  c,
50
- {
51
- microphonePermission,
52
- cameraPermission,
53
- libraryPermission,
54
- bluetoothPermission,
55
- bluetoothAlwaysPermission,
56
- } = {}
50
+ { microphonePermission, cameraPermission, libraryPermission } = {}
57
51
  ) => {
58
52
  return withInfoPlist(c, (config) => {
59
53
  if (microphonePermission !== false) {
@@ -70,20 +64,6 @@ const withIosPermissions: ConfigPlugin<Props> = (
70
64
  CAMERA;
71
65
  }
72
66
 
73
- if (bluetoothPermission !== false) {
74
- config.modResults.NSBluetoothPeripheralUsageDescription =
75
- bluetoothPermission ||
76
- config.modResults.NSBluetoothPeripheralUsageDescription ||
77
- BLUETOOTH;
78
- }
79
-
80
- if (bluetoothAlwaysPermission !== false) {
81
- config.modResults.NSBluetoothAlwaysUsageDescription =
82
- bluetoothAlwaysPermission ||
83
- config.modResults.NSBluetoothAlwaysUsageDescription ||
84
- BLUETOOTH_ALWAYS;
85
- }
86
-
87
67
  if (libraryPermission !== false) {
88
68
  config.modResults.NSPhotoLibraryUsageDescription =
89
69
  libraryPermission ||
@@ -129,8 +109,6 @@ const withAndroidPermissions: ConfigPlugin = (config) => {
129
109
  'android.permission.SYSTEM_ALERT_WINDOW',
130
110
  'android.permission.WAKE_LOCK',
131
111
  'android.permission.FOREGROUND_SERVICE',
132
- 'android.permission.FOREGROUND_SERVICE_CAMERA',
133
- 'android.permission.FOREGROUND_SERVICE_MICROPHONE',
134
112
  'android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION',
135
113
  'android.permission.WRITE_EXTERNAL_STORAGE',
136
114
  'android.permission.READ_EXTERNAL_STORAGE',
@@ -138,12 +116,43 @@ const withAndroidPermissions: ConfigPlugin = (config) => {
138
116
  ]);
139
117
  };
140
118
 
119
+ const withAndroidScreenshare: ConfigPlugin = (config) => {
120
+ return withAndroidManifest(config, (_config) => {
121
+ const manifest = _config.modResults as AndroidManifest;
122
+ const app = manifest.manifest.application?.[0];
123
+
124
+ if (app) {
125
+ // Avoid duplicate entries
126
+ const exists = (app.service || []).some(
127
+ (service) =>
128
+ service.$['android:name'] ===
129
+ 'com.cloudflare.realtimekit.ForegroundService'
130
+ );
131
+ if (!exists) {
132
+ app.service = [
133
+ ...(app.service || []),
134
+ {
135
+ $: {
136
+ 'android:enabled': 'true',
137
+ 'android:foregroundServiceType': 'mediaProjection',
138
+ 'android:name': 'com.cloudflare.realtimekit.ForegroundService',
139
+ },
140
+ },
141
+ ];
142
+ }
143
+ }
144
+
145
+ return _config;
146
+ });
147
+ };
148
+
141
149
  const withVoice: ConfigPlugin<Props | void> = (config, props = {}) => {
142
150
  const _props = props ? props : {};
143
151
  config = withIosPermissions(config, _props);
144
152
  if (_props.microphonePermission !== false) {
145
153
  config = withAndroidPermissions(config);
146
154
  }
155
+ config = withAndroidScreenshare(config);
147
156
  return config;
148
157
  };
149
158