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

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.9';
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.9';\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.9';
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.9';\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.9";
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.9",
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,60 @@ 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
+ };
100
+ const withAndroidBlobProviderAuthority = (config) => {
101
+ return (0, config_plugins_1.withStringsXml)(config, async (_config) => {
102
+ // Avoid duplicates
103
+ const existing = _config.modResults.resources.string?.find((item) => item.$.name === 'blob_provider_authority');
104
+ if (!existing) {
105
+ _config.modResults.resources.string = [
106
+ ...(_config.modResults.resources.string || []),
107
+ {
108
+ $: { name: 'blob_provider_authority' },
109
+ _: 'com.cloudflare.realtimekit.expo.blobs',
110
+ },
111
+ ];
112
+ }
113
+ return _config;
114
+ });
115
+ };
92
116
  const withVoice = (config, props = {}) => {
93
117
  const _props = props ? props : {};
94
118
  config = withIosPermissions(config, _props);
95
119
  if (_props.microphonePermission !== false) {
96
120
  config = withAndroidPermissions(config);
97
121
  }
122
+ config = withAndroidScreenshare(config);
123
+ config = withAndroidBlobProviderAuthority(config);
98
124
  return config;
99
125
  };
100
126
  exports.default = (0, config_plugins_1.createRunOncePlugin)(withVoice, '@cloudflare/realtimekit-react-native');
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  AndroidConfig,
3
+ AndroidManifest,
3
4
  ConfigPlugin,
4
5
  createRunOncePlugin,
6
+ withAndroidManifest,
5
7
  withInfoPlist,
8
+ withStringsXml,
6
9
  } from '@expo/config-plugins';
7
10
 
8
11
  const MICROPHONE = 'Allow $(PRODUCT_NAME) to access the microphone';
9
12
  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
13
  const LIBRARY = 'Allow $(PRODUCT_NAME) to access the files';
13
14
 
14
15
  export type Props = {
@@ -47,13 +48,7 @@ export type Props = {
47
48
  */
48
49
  const withIosPermissions: ConfigPlugin<Props> = (
49
50
  c,
50
- {
51
- microphonePermission,
52
- cameraPermission,
53
- libraryPermission,
54
- bluetoothPermission,
55
- bluetoothAlwaysPermission,
56
- } = {}
51
+ { microphonePermission, cameraPermission, libraryPermission } = {}
57
52
  ) => {
58
53
  return withInfoPlist(c, (config) => {
59
54
  if (microphonePermission !== false) {
@@ -70,20 +65,6 @@ const withIosPermissions: ConfigPlugin<Props> = (
70
65
  CAMERA;
71
66
  }
72
67
 
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
68
  if (libraryPermission !== false) {
88
69
  config.modResults.NSPhotoLibraryUsageDescription =
89
70
  libraryPermission ||
@@ -129,8 +110,6 @@ const withAndroidPermissions: ConfigPlugin = (config) => {
129
110
  'android.permission.SYSTEM_ALERT_WINDOW',
130
111
  'android.permission.WAKE_LOCK',
131
112
  'android.permission.FOREGROUND_SERVICE',
132
- 'android.permission.FOREGROUND_SERVICE_CAMERA',
133
- 'android.permission.FOREGROUND_SERVICE_MICROPHONE',
134
113
  'android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION',
135
114
  'android.permission.WRITE_EXTERNAL_STORAGE',
136
115
  'android.permission.READ_EXTERNAL_STORAGE',
@@ -138,12 +117,63 @@ const withAndroidPermissions: ConfigPlugin = (config) => {
138
117
  ]);
139
118
  };
140
119
 
120
+ const withAndroidScreenshare: ConfigPlugin = (config) => {
121
+ return withAndroidManifest(config, (_config) => {
122
+ const manifest = _config.modResults as AndroidManifest;
123
+ const app = manifest.manifest.application?.[0];
124
+
125
+ if (app) {
126
+ // Avoid duplicate entries
127
+ const exists = (app.service || []).some(
128
+ (service) =>
129
+ service.$['android:name'] ===
130
+ 'com.cloudflare.realtimekit.ForegroundService'
131
+ );
132
+ if (!exists) {
133
+ app.service = [
134
+ ...(app.service || []),
135
+ {
136
+ $: {
137
+ 'android:enabled': 'true',
138
+ 'android:foregroundServiceType': 'mediaProjection',
139
+ 'android:name': 'com.cloudflare.realtimekit.ForegroundService',
140
+ },
141
+ },
142
+ ];
143
+ }
144
+ }
145
+
146
+ return _config;
147
+ });
148
+ };
149
+
150
+ const withAndroidBlobProviderAuthority: ConfigPlugin = (config) => {
151
+ return withStringsXml(config, async (_config) => {
152
+ // Avoid duplicates
153
+ const existing = _config.modResults.resources.string?.find(
154
+ (item) => item.$.name === 'blob_provider_authority'
155
+ );
156
+ if (!existing) {
157
+ _config.modResults.resources.string = [
158
+ ...(_config.modResults.resources.string || []),
159
+ {
160
+ $: { name: 'blob_provider_authority' },
161
+ _: 'com.cloudflare.realtimekit.expo.blobs',
162
+ },
163
+ ];
164
+ }
165
+ return _config;
166
+ });
167
+ };
168
+
141
169
  const withVoice: ConfigPlugin<Props | void> = (config, props = {}) => {
142
170
  const _props = props ? props : {};
143
171
  config = withIosPermissions(config, _props);
144
172
  if (_props.microphonePermission !== false) {
145
173
  config = withAndroidPermissions(config);
146
174
  }
175
+ config = withAndroidScreenshare(config);
176
+ config = withAndroidBlobProviderAuthority(config);
147
177
  return config;
148
178
  };
149
179