@sendbird/uikit-react-native 3.11.0 → 3.11.1

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.
Files changed (37) hide show
  1. package/README.md +7 -5
  2. package/lib/commonjs/platform/createMediaService.expo.js +83 -12
  3. package/lib/commonjs/platform/createMediaService.expo.js.map +1 -1
  4. package/lib/commonjs/platform/createPlayerService.expo.js +214 -113
  5. package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -1
  6. package/lib/commonjs/platform/createRecorderService.expo.js +248 -130
  7. package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -1
  8. package/lib/commonjs/utils/expoBackwardUtils.js +23 -0
  9. package/lib/commonjs/utils/expoBackwardUtils.js.map +1 -1
  10. package/lib/commonjs/utils/expoPermissionGranted.js.map +1 -1
  11. package/lib/commonjs/version.js +1 -1
  12. package/lib/commonjs/version.js.map +1 -1
  13. package/lib/module/platform/createMediaService.expo.js +82 -13
  14. package/lib/module/platform/createMediaService.expo.js.map +1 -1
  15. package/lib/module/platform/createPlayerService.expo.js +214 -113
  16. package/lib/module/platform/createPlayerService.expo.js.map +1 -1
  17. package/lib/module/platform/createRecorderService.expo.js +249 -131
  18. package/lib/module/platform/createRecorderService.expo.js.map +1 -1
  19. package/lib/module/utils/expoBackwardUtils.js +23 -0
  20. package/lib/module/utils/expoBackwardUtils.js.map +1 -1
  21. package/lib/module/utils/expoPermissionGranted.js.map +1 -1
  22. package/lib/module/version.js +1 -1
  23. package/lib/module/version.js.map +1 -1
  24. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
  25. package/lib/typescript/src/platform/createMediaService.expo.d.ts +2 -2
  26. package/lib/typescript/src/platform/createPlayerService.expo.d.ts +2 -2
  27. package/lib/typescript/src/platform/createRecorderService.expo.d.ts +2 -2
  28. package/lib/typescript/src/utils/expoBackwardUtils.d.ts +10 -0
  29. package/lib/typescript/src/utils/expoPermissionGranted.d.ts +1 -1
  30. package/lib/typescript/src/version.d.ts +1 -1
  31. package/package.json +16 -5
  32. package/src/platform/createMediaService.expo.tsx +87 -9
  33. package/src/platform/createPlayerService.expo.tsx +242 -109
  34. package/src/platform/createRecorderService.expo.tsx +267 -110
  35. package/src/utils/expoBackwardUtils.ts +29 -0
  36. package/src/utils/expoPermissionGranted.ts +3 -1
  37. package/src/version.ts +1 -1
@@ -7,153 +7,271 @@ exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _uikitUtils = require("@sendbird/uikit-utils");
9
9
  var _VoiceMessageConfig = _interopRequireDefault(require("../libs/VoiceMessageConfig"));
10
+ var _expoBackwardUtils = _interopRequireDefault(require("../utils/expoBackwardUtils"));
10
11
  var _expoPermissionGranted = _interopRequireDefault(require("../utils/expoPermissionGranted"));
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
15
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- const createExpoRecorderService = ({
16
- avModule
17
- }) => {
18
- class VoiceRecorder {
19
- constructor() {
20
- _defineProperty(this, "uri", undefined);
21
- _defineProperty(this, "state", 'idle');
22
- _defineProperty(this, "options", {
23
- minDuration: _VoiceMessageConfig.default.DEFAULT.RECORDER.MIN_DURATION,
24
- maxDuration: _VoiceMessageConfig.default.DEFAULT.RECORDER.MAX_DURATION,
25
- extension: _VoiceMessageConfig.default.DEFAULT.RECORDER.EXTENSION
16
+ class BaseAudioRecorderAdapter {
17
+ constructor() {
18
+ _defineProperty(this, "uri", undefined);
19
+ _defineProperty(this, "state", 'idle');
20
+ _defineProperty(this, "options", {
21
+ minDuration: _VoiceMessageConfig.default.DEFAULT.RECORDER.MIN_DURATION,
22
+ maxDuration: _VoiceMessageConfig.default.DEFAULT.RECORDER.MAX_DURATION,
23
+ extension: _VoiceMessageConfig.default.DEFAULT.RECORDER.EXTENSION
24
+ });
25
+ _defineProperty(this, "_audioSettings", {
26
+ sampleRate: _VoiceMessageConfig.default.DEFAULT.RECORDER.SAMPLE_RATE,
27
+ bitRate: _VoiceMessageConfig.default.DEFAULT.RECORDER.BIT_RATE,
28
+ numberOfChannels: _VoiceMessageConfig.default.DEFAULT.RECORDER.CHANNELS
29
+ // encoding: mpeg4_aac
30
+ });
31
+ _defineProperty(this, "_recordingSubscribers", new Set());
32
+ _defineProperty(this, "_stateSubscribers", new Set());
33
+ // NOTE: In Android, even when startRecorder() is awaited, if stop() is executed immediately afterward, an error occurs
34
+ _defineProperty(this, "_recordStartedAt", 0);
35
+ _defineProperty(this, "_getRecorderStopSafeBuffer", () => {
36
+ const minWaitingTime = 500;
37
+ const elapsedTime = Date.now() - this._recordStartedAt;
38
+ if (elapsedTime > minWaitingTime) return 0;else return minWaitingTime - elapsedTime;
39
+ });
40
+ _defineProperty(this, "setState", state => {
41
+ this.state = state;
42
+ this._stateSubscribers.forEach(callback => {
43
+ callback(state);
26
44
  });
27
- // NOTE: In Android, even when startRecorder() is awaited, if stop() is executed immediately afterward, an error occurs
28
- _defineProperty(this, "_recordStartedAt", 0);
29
- _defineProperty(this, "_getRecorderStopSafeBuffer", () => {
30
- const minWaitingTime = 500;
31
- const elapsedTime = Date.now() - this._recordStartedAt;
32
- if (elapsedTime > minWaitingTime) return 0;else return minWaitingTime - elapsedTime;
33
- });
34
- _defineProperty(this, "_recorder", new avModule.Audio.Recording());
35
- _defineProperty(this, "_recordingSubscribers", new Set());
36
- _defineProperty(this, "_stateSubscribers", new Set());
37
- _defineProperty(this, "_audioSettings", {
38
- sampleRate: _VoiceMessageConfig.default.DEFAULT.RECORDER.SAMPLE_RATE,
39
- bitRate: _VoiceMessageConfig.default.DEFAULT.RECORDER.BIT_RATE,
40
- numberOfChannels: _VoiceMessageConfig.default.DEFAULT.RECORDER.CHANNELS
41
- // encoding: mpeg4_aac
42
- });
43
- _defineProperty(this, "_audioOptions", {
44
- android: {
45
- ...this._audioSettings,
46
- extension: `.${this.options.extension}`,
47
- audioEncoder: avModule.Audio.AndroidAudioEncoder.AAC,
48
- outputFormat: avModule.Audio.AndroidOutputFormat.MPEG_4
49
- },
50
- ios: {
51
- ...this._audioSettings,
52
- extension: `.${this.options.extension}`,
53
- outputFormat: avModule.Audio.IOSOutputFormat.MPEG4AAC,
54
- audioQuality: avModule.Audio.IOSAudioQuality.HIGH
55
- },
56
- web: {}
45
+ });
46
+ _defineProperty(this, "addRecordingListener", callback => {
47
+ this._recordingSubscribers.add(callback);
48
+ return () => {
49
+ this._recordingSubscribers.delete(callback);
50
+ };
51
+ });
52
+ _defineProperty(this, "addStateListener", callback => {
53
+ this._stateSubscribers.add(callback);
54
+ return () => {
55
+ this._stateSubscribers.delete(callback);
56
+ };
57
+ });
58
+ _defineProperty(this, "convertRecordPath", uri => {
59
+ return uri;
60
+ });
61
+ }
62
+ }
63
+ class LegacyExpoAVRecorderAdapter extends BaseAudioRecorderAdapter {
64
+ constructor(avModule) {
65
+ super();
66
+ _defineProperty(this, "avModule", void 0);
67
+ _defineProperty(this, "_recorder", void 0);
68
+ _defineProperty(this, "_audioOptions", void 0);
69
+ _defineProperty(this, "prepare", async () => {
70
+ this.setState('preparing');
71
+ if (_reactNative.Platform.OS === 'ios') {
72
+ await this.avModule.Audio.setAudioModeAsync({
73
+ allowsRecordingIOS: true,
74
+ playsInSilentModeIOS: true
75
+ });
76
+ }
77
+ if (this._recorder._isDoneRecording) {
78
+ this._recorder = new this.avModule.Audio.Recording();
79
+ }
80
+ this._recorder.setProgressUpdateInterval(100);
81
+ this._recorder.setOnRecordingStatusUpdate(status => {
82
+ const completed = status.durationMillis >= this.options.maxDuration;
83
+ if (completed) this.stop();
84
+ if (status.isRecording) {
85
+ this._recordingSubscribers.forEach(callback => {
86
+ callback({
87
+ currentTime: status.durationMillis,
88
+ completed: completed
89
+ });
90
+ });
91
+ }
57
92
  });
58
- _defineProperty(this, "prepare", async () => {
59
- this.setState('preparing');
93
+ await this._recorder.prepareToRecordAsync(this._audioOptions);
94
+ });
95
+ _defineProperty(this, "requestPermission", async () => {
96
+ const status = await this.avModule.Audio.getPermissionsAsync();
97
+ if ((0, _expoPermissionGranted.default)([status])) {
98
+ return true;
99
+ } else {
100
+ const status = await this.avModule.Audio.requestPermissionsAsync();
101
+ return (0, _expoPermissionGranted.default)([status]);
102
+ }
103
+ });
104
+ _defineProperty(this, "record", async () => {
105
+ if ((0, _uikitUtils.matchesOneOf)(this.state, ['idle', 'completed'])) {
106
+ try {
107
+ await this.prepare();
108
+ await this._recorder.startAsync();
109
+ if (_reactNative.Platform.OS === 'android') {
110
+ this._recordStartedAt = Date.now();
111
+ }
112
+ const uri = this._recorder.getURI();
113
+ if (uri) this.uri = uri;
114
+ this.setState('recording');
115
+ } catch (e) {
116
+ this.setState('idle');
117
+ throw e;
118
+ }
119
+ }
120
+ });
121
+ _defineProperty(this, "stop", async () => {
122
+ if ((0, _uikitUtils.matchesOneOf)(this.state, ['recording'])) {
123
+ if (_reactNative.Platform.OS === 'android') {
124
+ const buffer = this._getRecorderStopSafeBuffer();
125
+ if (buffer > 0) await (0, _uikitUtils.sleep)(buffer);
126
+ }
127
+ await this._recorder.stopAndUnloadAsync();
60
128
  if (_reactNative.Platform.OS === 'ios') {
61
- await avModule.Audio.setAudioModeAsync({
62
- allowsRecordingIOS: true,
63
- playsInSilentModeIOS: true
129
+ await this.avModule.Audio.setAudioModeAsync({
130
+ allowsRecordingIOS: false,
131
+ playsInSilentModeIOS: false
64
132
  });
65
133
  }
66
- if (this._recorder._isDoneRecording) {
67
- this._recorder = new avModule.Audio.Recording();
68
- }
69
- this._recorder.setProgressUpdateInterval(100);
70
- this._recorder.setOnRecordingStatusUpdate(status => {
71
- const completed = status.durationMillis >= this.options.maxDuration;
72
- if (completed) this.stop();
73
- if (status.isRecording) {
74
- this._recordingSubscribers.forEach(callback => {
75
- callback({
76
- currentTime: status.durationMillis,
77
- completed: completed
78
- });
134
+ this.setState('completed');
135
+ }
136
+ });
137
+ _defineProperty(this, "reset", async () => {
138
+ await this.stop();
139
+ this.uri = undefined;
140
+ this._recordingSubscribers.clear();
141
+ this._recorder = new this.avModule.Audio.Recording();
142
+ this.setState('idle');
143
+ });
144
+ this.avModule = avModule;
145
+ this._recorder = new avModule.Audio.Recording();
146
+ this._audioOptions = {
147
+ android: {
148
+ ...this._audioSettings,
149
+ extension: `.${this.options.extension}`,
150
+ audioEncoder: avModule.Audio.AndroidAudioEncoder.AAC,
151
+ outputFormat: avModule.Audio.AndroidOutputFormat.MPEG_4
152
+ },
153
+ ios: {
154
+ ...this._audioSettings,
155
+ extension: `.${this.options.extension}`,
156
+ outputFormat: avModule.Audio.IOSOutputFormat.MPEG4AAC,
157
+ audioQuality: avModule.Audio.IOSAudioQuality.HIGH
158
+ },
159
+ web: {}
160
+ };
161
+ }
162
+ }
163
+ class ExpoAudioRecorderAdapter extends BaseAudioRecorderAdapter {
164
+ constructor(audioModule) {
165
+ super();
166
+ _defineProperty(this, "audioModule", void 0);
167
+ _defineProperty(this, "recorder", null);
168
+ _defineProperty(this, "recordingUpdateInterval", null);
169
+ _defineProperty(this, "setListener", () => {
170
+ if (!this.recorder) return;
171
+ this.recordingUpdateInterval = setInterval(() => {
172
+ if (this.recorder && this.recorder.isRecording) {
173
+ const currentTime = this.recorder.currentTime * 1000;
174
+ const completed = currentTime >= this.options.maxDuration;
175
+ if (completed) {
176
+ this.stop().catch(error => {
177
+ _uikitUtils.Logger.warn('[RecorderService.Expo] Failed to stop in update interval', error);
79
178
  });
80
179
  }
81
- });
82
- await this._recorder.prepareToRecordAsync(this._audioOptions);
83
- });
84
- _defineProperty(this, "setState", state => {
85
- this.state = state;
86
- this._stateSubscribers.forEach(callback => {
87
- callback(state);
88
- });
89
- });
90
- _defineProperty(this, "requestPermission", async () => {
91
- const status = await avModule.Audio.getPermissionsAsync();
92
- if ((0, _expoPermissionGranted.default)([status])) {
93
- return true;
94
- } else {
95
- const status = await avModule.Audio.requestPermissionsAsync();
96
- return (0, _expoPermissionGranted.default)([status]);
97
- }
98
- });
99
- _defineProperty(this, "addRecordingListener", callback => {
100
- this._recordingSubscribers.add(callback);
101
- return () => {
102
- this._recordingSubscribers.delete(callback);
103
- };
104
- });
105
- _defineProperty(this, "addStateListener", callback => {
106
- this._stateSubscribers.add(callback);
107
- return () => {
108
- this._stateSubscribers.delete(callback);
109
- };
110
- });
111
- _defineProperty(this, "record", async () => {
112
- if ((0, _uikitUtils.matchesOneOf)(this.state, ['idle', 'completed'])) {
113
- try {
114
- await this.prepare();
115
- await this._recorder.startAsync();
116
- if (_reactNative.Platform.OS === 'android') {
117
- this._recordStartedAt = Date.now();
118
- }
119
- const uri = this._recorder.getURI();
120
- if (uri) this.uri = uri;
121
- this.setState('recording');
122
- } catch (e) {
123
- this.setState('idle');
124
- throw e;
125
- }
180
+ this._recordingSubscribers.forEach(callback => {
181
+ callback({
182
+ currentTime,
183
+ completed
184
+ });
185
+ });
126
186
  }
127
- });
128
- _defineProperty(this, "stop", async () => {
129
- if ((0, _uikitUtils.matchesOneOf)(this.state, ['recording'])) {
187
+ }, 100);
188
+ });
189
+ _defineProperty(this, "removeListener", () => {
190
+ if (this.recordingUpdateInterval) {
191
+ clearInterval(this.recordingUpdateInterval);
192
+ this.recordingUpdateInterval = null;
193
+ }
194
+ });
195
+ _defineProperty(this, "prepare", async () => {
196
+ this.setState('preparing');
197
+ if (_reactNative.Platform.OS === 'ios') {
198
+ await this.audioModule.setAudioModeAsync({
199
+ allowsRecording: true,
200
+ playsInSilentMode: true
201
+ });
202
+ }
203
+ const recordingOptions = {
204
+ ...this._audioSettings,
205
+ extension: `.${this.options.extension}`
206
+ };
207
+ this.recorder = new this.audioModule.AudioModule.AudioRecorder(recordingOptions);
208
+ await this.recorder.prepareToRecordAsync();
209
+ });
210
+ _defineProperty(this, "requestPermission", async () => {
211
+ const status = await this.audioModule.getRecordingPermissionsAsync();
212
+ if ((0, _expoPermissionGranted.default)([status])) {
213
+ return true;
214
+ } else {
215
+ const status = await this.audioModule.requestRecordingPermissionsAsync();
216
+ return (0, _expoPermissionGranted.default)([status]);
217
+ }
218
+ });
219
+ _defineProperty(this, "record", async () => {
220
+ if ((0, _uikitUtils.matchesOneOf)(this.state, ['idle', 'completed'])) {
221
+ try {
222
+ var _this$recorder, _this$recorder2;
223
+ await this.prepare();
224
+ this.setListener();
225
+ (_this$recorder = this.recorder) === null || _this$recorder === void 0 || _this$recorder.record();
130
226
  if (_reactNative.Platform.OS === 'android') {
131
- const buffer = this._getRecorderStopSafeBuffer();
132
- if (buffer > 0) await (0, _uikitUtils.sleep)(buffer);
227
+ this._recordStartedAt = Date.now();
133
228
  }
134
- await this._recorder.stopAndUnloadAsync();
135
- if (_reactNative.Platform.OS === 'ios') {
136
- await avModule.Audio.setAudioModeAsync({
137
- allowsRecordingIOS: false,
138
- playsInSilentModeIOS: false
139
- });
140
- }
141
- this.setState('completed');
229
+ const uri = (_this$recorder2 = this.recorder) === null || _this$recorder2 === void 0 ? void 0 : _this$recorder2.uri;
230
+ if (uri) this.uri = uri;
231
+ this.setState('recording');
232
+ } catch (e) {
233
+ this.setState('idle');
234
+ this.removeListener();
235
+ throw e;
142
236
  }
143
- });
144
- _defineProperty(this, "reset", async () => {
145
- await this.stop();
146
- this.uri = undefined;
147
- this._recordingSubscribers.clear();
148
- this._recorder = new avModule.Audio.Recording();
149
- this.setState('idle');
150
- });
151
- _defineProperty(this, "convertRecordPath", uri => {
152
- return uri;
153
- });
154
- }
237
+ }
238
+ });
239
+ _defineProperty(this, "stop", async () => {
240
+ if ((0, _uikitUtils.matchesOneOf)(this.state, ['recording'])) {
241
+ var _this$recorder3;
242
+ if (_reactNative.Platform.OS === 'android') {
243
+ const buffer = this._getRecorderStopSafeBuffer();
244
+ if (buffer > 0) await (0, _uikitUtils.sleep)(buffer);
245
+ }
246
+ await ((_this$recorder3 = this.recorder) === null || _this$recorder3 === void 0 ? void 0 : _this$recorder3.stop());
247
+ this.removeListener();
248
+ if (_reactNative.Platform.OS === 'ios') {
249
+ await this.audioModule.setAudioModeAsync({
250
+ allowsRecording: false,
251
+ playsInSilentMode: false
252
+ });
253
+ }
254
+ this.setState('completed');
255
+ }
256
+ });
257
+ _defineProperty(this, "reset", async () => {
258
+ await this.stop();
259
+ this.recorder = null;
260
+ this.uri = undefined;
261
+ this._recordingSubscribers.clear();
262
+ this._stateSubscribers.clear();
263
+ this.setState('idle');
264
+ });
265
+ this.audioModule = audioModule;
266
+ }
267
+ }
268
+ const createExpoRecorderService = ({
269
+ avModule
270
+ }) => {
271
+ if (_expoBackwardUtils.default.expoAV.isLegacyAVModule(avModule)) {
272
+ _uikitUtils.Logger.warn('[RecorderService.Expo] expo-av is deprecated and will be removed in Expo 54. Please migrate to expo-audio.');
155
273
  }
156
- return new VoiceRecorder();
274
+ return _expoBackwardUtils.default.expoAV.isAudioModule(avModule) ? new ExpoAudioRecorderAdapter(avModule) : new LegacyExpoAVRecorderAdapter(avModule);
157
275
  };
158
276
  var _default = exports.default = createExpoRecorderService;
159
277
  //# sourceMappingURL=createRecorderService.expo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_uikitUtils","_VoiceMessageConfig","_interopRequireDefault","_expoPermissionGranted","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","createExpoRecorderService","avModule","VoiceRecorder","constructor","undefined","minDuration","VoiceMessageConfig","DEFAULT","RECORDER","MIN_DURATION","maxDuration","MAX_DURATION","extension","EXTENSION","minWaitingTime","elapsedTime","Date","now","_recordStartedAt","Audio","Recording","Set","sampleRate","SAMPLE_RATE","bitRate","BIT_RATE","numberOfChannels","CHANNELS","android","_audioSettings","options","audioEncoder","AndroidAudioEncoder","AAC","outputFormat","AndroidOutputFormat","MPEG_4","ios","IOSOutputFormat","MPEG4AAC","audioQuality","IOSAudioQuality","HIGH","web","setState","Platform","OS","setAudioModeAsync","allowsRecordingIOS","playsInSilentModeIOS","_recorder","_isDoneRecording","setProgressUpdateInterval","setOnRecordingStatusUpdate","status","completed","durationMillis","stop","isRecording","_recordingSubscribers","forEach","callback","currentTime","prepareToRecordAsync","_audioOptions","state","_stateSubscribers","getPermissionsAsync","expoPermissionGranted","requestPermissionsAsync","add","delete","matchesOneOf","prepare","startAsync","uri","getURI","buffer","_getRecorderStopSafeBuffer","sleep","stopAndUnloadAsync","clear","_default","exports"],"sources":["createRecorderService.expo.tsx"],"sourcesContent":["import * as ExpoAV from 'expo-av';\nimport type { RecordingOptions } from 'expo-av/build/Audio/Recording.types';\nimport { Platform } from 'react-native';\n\nimport { matchesOneOf, sleep } from '@sendbird/uikit-utils';\n\nimport VoiceMessageConfig from '../libs/VoiceMessageConfig';\nimport expoPermissionGranted from '../utils/expoPermissionGranted';\nimport type { RecorderServiceInterface, Unsubscribe } from './types';\n\ntype RecordingListener = Parameters<RecorderServiceInterface['addRecordingListener']>[number];\ntype StateListener = Parameters<RecorderServiceInterface['addStateListener']>[number];\ntype Modules = {\n avModule: typeof ExpoAV;\n};\nconst createExpoRecorderService = ({ avModule }: Modules): RecorderServiceInterface => {\n class VoiceRecorder implements RecorderServiceInterface {\n public uri: RecorderServiceInterface['uri'] = undefined;\n public state: RecorderServiceInterface['state'] = 'idle';\n public options: RecorderServiceInterface['options'] = {\n minDuration: VoiceMessageConfig.DEFAULT.RECORDER.MIN_DURATION,\n maxDuration: VoiceMessageConfig.DEFAULT.RECORDER.MAX_DURATION,\n extension: VoiceMessageConfig.DEFAULT.RECORDER.EXTENSION,\n };\n\n // NOTE: In Android, even when startRecorder() is awaited, if stop() is executed immediately afterward, an error occurs\n private _recordStartedAt = 0;\n private _getRecorderStopSafeBuffer = () => {\n const minWaitingTime = 500;\n const elapsedTime = Date.now() - this._recordStartedAt;\n if (elapsedTime > minWaitingTime) return 0;\n else return minWaitingTime - elapsedTime;\n };\n\n private _recorder = new avModule.Audio.Recording();\n private readonly _recordingSubscribers = new Set<RecordingListener>();\n private readonly _stateSubscribers = new Set<StateListener>();\n private readonly _audioSettings = {\n sampleRate: VoiceMessageConfig.DEFAULT.RECORDER.SAMPLE_RATE,\n bitRate: VoiceMessageConfig.DEFAULT.RECORDER.BIT_RATE,\n numberOfChannels: VoiceMessageConfig.DEFAULT.RECORDER.CHANNELS,\n // encoding: mpeg4_aac\n };\n private readonly _audioOptions: RecordingOptions = {\n android: {\n ...this._audioSettings,\n extension: `.${this.options.extension}`,\n audioEncoder: avModule.Audio.AndroidAudioEncoder.AAC,\n outputFormat: avModule.Audio.AndroidOutputFormat.MPEG_4,\n },\n ios: {\n ...this._audioSettings,\n extension: `.${this.options.extension}`,\n outputFormat: avModule.Audio.IOSOutputFormat.MPEG4AAC,\n audioQuality: avModule.Audio.IOSAudioQuality.HIGH,\n },\n web: {},\n };\n\n private prepare = async () => {\n this.setState('preparing');\n if (Platform.OS === 'ios') {\n await avModule.Audio.setAudioModeAsync({ allowsRecordingIOS: true, playsInSilentModeIOS: true });\n }\n\n if (this._recorder._isDoneRecording) {\n this._recorder = new avModule.Audio.Recording();\n }\n this._recorder.setProgressUpdateInterval(100);\n this._recorder.setOnRecordingStatusUpdate((status) => {\n const completed = status.durationMillis >= this.options.maxDuration;\n if (completed) this.stop();\n if (status.isRecording) {\n this._recordingSubscribers.forEach((callback) => {\n callback({ currentTime: status.durationMillis, completed: completed });\n });\n }\n });\n await this._recorder.prepareToRecordAsync(this._audioOptions);\n };\n\n private setState = (state: RecorderServiceInterface['state']) => {\n this.state = state;\n this._stateSubscribers.forEach((callback) => {\n callback(state);\n });\n };\n\n public requestPermission = async (): Promise<boolean> => {\n const status = await avModule.Audio.getPermissionsAsync();\n if (expoPermissionGranted([status])) {\n return true;\n } else {\n const status = await avModule.Audio.requestPermissionsAsync();\n return expoPermissionGranted([status]);\n }\n };\n\n public addRecordingListener = (callback: RecordingListener): Unsubscribe => {\n this._recordingSubscribers.add(callback);\n return () => {\n this._recordingSubscribers.delete(callback);\n };\n };\n\n public addStateListener = (callback: StateListener): Unsubscribe => {\n this._stateSubscribers.add(callback);\n return () => {\n this._stateSubscribers.delete(callback);\n };\n };\n\n public record = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['idle', 'completed'])) {\n try {\n await this.prepare();\n await this._recorder.startAsync();\n\n if (Platform.OS === 'android') {\n this._recordStartedAt = Date.now();\n }\n\n const uri = this._recorder.getURI();\n if (uri) this.uri = uri;\n this.setState('recording');\n } catch (e) {\n this.setState('idle');\n throw e;\n }\n }\n };\n\n public stop = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['recording'])) {\n if (Platform.OS === 'android') {\n const buffer = this._getRecorderStopSafeBuffer();\n if (buffer > 0) await sleep(buffer);\n }\n\n await this._recorder.stopAndUnloadAsync();\n if (Platform.OS === 'ios') {\n await avModule.Audio.setAudioModeAsync({ allowsRecordingIOS: false, playsInSilentModeIOS: false });\n }\n this.setState('completed');\n }\n };\n\n public reset = async (): Promise<void> => {\n await this.stop();\n this.uri = undefined;\n this._recordingSubscribers.clear();\n this._recorder = new avModule.Audio.Recording();\n this.setState('idle');\n };\n\n public convertRecordPath = (uri: string): string => {\n return uri;\n };\n }\n\n return new VoiceRecorder();\n};\n\nexport default createExpoRecorderService;\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAAmE,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,G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itUtils","_VoiceMessageConfig","_interopRequireDefault","_expoBackwardUtils","_expoPermissionGranted","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","BaseAudioRecorderAdapter","constructor","undefined","minDuration","VoiceMessageConfig","DEFAULT","RECORDER","MIN_DURATION","maxDuration","MAX_DURATION","extension","EXTENSION","sampleRate","SAMPLE_RATE","bitRate","BIT_RATE","numberOfChannels","CHANNELS","Set","minWaitingTime","elapsedTime","Date","now","_recordStartedAt","state","_stateSubscribers","forEach","callback","_recordingSubscribers","add","delete","uri","LegacyExpoAVRecorderAdapter","avModule","setState","Platform","OS","Audio","setAudioModeAsync","allowsRecordingIOS","playsInSilentModeIOS","_recorder","_isDoneRecording","Recording","setProgressUpdateInterval","setOnRecordingStatusUpdate","status","completed","durationMillis","options","stop","isRecording","currentTime","prepareToRecordAsync","_audioOptions","getPermissionsAsync","expoPermissionGranted","requestPermissionsAsync","matchesOneOf","prepare","startAsync","getURI","buffer","_getRecorderStopSafeBuffer","sleep","stopAndUnloadAsync","clear","android","_audioSettings","audioEncoder","AndroidAudioEncoder","AAC","outputFormat","AndroidOutputFormat","MPEG_4","ios","IOSOutputFormat","MPEG4AAC","audioQuality","IOSAudioQuality","HIGH","web","ExpoAudioRecorderAdapter","audioModule","recorder","recordingUpdateInterval","setInterval","catch","error","Logger","warn","clearInterval","allowsRecording","playsInSilentMode","recordingOptions","AudioModule","AudioRecorder","getRecordingPermissionsAsync","requestRecordingPermissionsAsync","_this$recorder","_this$recorder2","setListener","record","removeListener","_this$recorder3","createExpoRecorderService","expoBackwardUtils","expoAV","isLegacyAVModule","isAudioModule","_default","exports"],"sources":["createRecorderService.expo.tsx"],"sourcesContent":["import type * as ExpoAudio from 'expo-audio';\nimport type * as ExpoAV from 'expo-av';\nimport { Platform } from 'react-native';\n\nimport { Logger, matchesOneOf, sleep } from '@sendbird/uikit-utils';\n\nimport VoiceMessageConfig from '../libs/VoiceMessageConfig';\nimport expoBackwardUtils from '../utils/expoBackwardUtils';\nimport type { ExpoAudioModule } from '../utils/expoBackwardUtils';\nimport expoPermissionGranted from '../utils/expoPermissionGranted';\nimport type { RecorderServiceInterface, Unsubscribe } from './types';\n\ntype RecordingListener = Parameters<RecorderServiceInterface['addRecordingListener']>[number];\ntype StateListener = Parameters<RecorderServiceInterface['addStateListener']>[number];\ntype Modules = {\n avModule: ExpoAudioModule;\n};\n\ninterface AudioRecorderAdapter {\n requestPermission(): Promise<boolean>;\n record(): Promise<void>;\n stop(): Promise<void>;\n reset(): Promise<void>;\n addRecordingListener(callback: RecordingListener): Unsubscribe;\n addStateListener(callback: StateListener): Unsubscribe;\n convertRecordPath(uri: string): string;\n readonly state: RecorderServiceInterface['state'];\n readonly options: RecorderServiceInterface['options'];\n uri?: string;\n}\n\nabstract class BaseAudioRecorderAdapter implements AudioRecorderAdapter {\n public uri: RecorderServiceInterface['uri'] = undefined;\n public state: RecorderServiceInterface['state'] = 'idle';\n public options: RecorderServiceInterface['options'] = {\n minDuration: VoiceMessageConfig.DEFAULT.RECORDER.MIN_DURATION,\n maxDuration: VoiceMessageConfig.DEFAULT.RECORDER.MAX_DURATION,\n extension: VoiceMessageConfig.DEFAULT.RECORDER.EXTENSION,\n };\n\n protected readonly _audioSettings = {\n sampleRate: VoiceMessageConfig.DEFAULT.RECORDER.SAMPLE_RATE,\n bitRate: VoiceMessageConfig.DEFAULT.RECORDER.BIT_RATE,\n numberOfChannels: VoiceMessageConfig.DEFAULT.RECORDER.CHANNELS,\n // encoding: mpeg4_aac\n };\n protected readonly _recordingSubscribers = new Set<RecordingListener>();\n protected readonly _stateSubscribers = new Set<StateListener>();\n\n // NOTE: In Android, even when startRecorder() is awaited, if stop() is executed immediately afterward, an error occurs\n protected _recordStartedAt = 0;\n protected _getRecorderStopSafeBuffer = () => {\n const minWaitingTime = 500;\n const elapsedTime = Date.now() - this._recordStartedAt;\n if (elapsedTime > minWaitingTime) return 0;\n else return minWaitingTime - elapsedTime;\n };\n protected setState = (state: RecorderServiceInterface['state']) => {\n this.state = state;\n this._stateSubscribers.forEach((callback) => {\n callback(state);\n });\n };\n\n public addRecordingListener = (callback: RecordingListener): Unsubscribe => {\n this._recordingSubscribers.add(callback);\n return () => {\n this._recordingSubscribers.delete(callback);\n };\n };\n\n public addStateListener = (callback: StateListener): Unsubscribe => {\n this._stateSubscribers.add(callback);\n return () => {\n this._stateSubscribers.delete(callback);\n };\n };\n\n public convertRecordPath = (uri: string): string => {\n return uri;\n };\n\n abstract requestPermission(): Promise<boolean>;\n abstract record(): Promise<void>;\n abstract stop(): Promise<void>;\n abstract reset(): Promise<void>;\n}\n\nclass LegacyExpoAVRecorderAdapter extends BaseAudioRecorderAdapter {\n private readonly avModule: typeof ExpoAV;\n\n private _recorder: ExpoAV.Audio.Recording;\n private readonly _audioOptions: ExpoAV.Audio.RecordingOptions;\n\n constructor(avModule: typeof ExpoAV) {\n super();\n this.avModule = avModule;\n this._recorder = new avModule.Audio.Recording();\n this._audioOptions = {\n android: {\n ...this._audioSettings,\n extension: `.${this.options.extension}`,\n audioEncoder: avModule.Audio.AndroidAudioEncoder.AAC,\n outputFormat: avModule.Audio.AndroidOutputFormat.MPEG_4,\n },\n ios: {\n ...this._audioSettings,\n extension: `.${this.options.extension}`,\n outputFormat: avModule.Audio.IOSOutputFormat.MPEG4AAC,\n audioQuality: avModule.Audio.IOSAudioQuality.HIGH,\n },\n web: {},\n };\n }\n\n private prepare = async () => {\n this.setState('preparing');\n if (Platform.OS === 'ios') {\n await this.avModule.Audio.setAudioModeAsync({ allowsRecordingIOS: true, playsInSilentModeIOS: true });\n }\n\n if (this._recorder._isDoneRecording) {\n this._recorder = new this.avModule.Audio.Recording();\n }\n this._recorder.setProgressUpdateInterval(100);\n this._recorder.setOnRecordingStatusUpdate((status) => {\n const completed = status.durationMillis >= this.options.maxDuration;\n if (completed) this.stop();\n if (status.isRecording) {\n this._recordingSubscribers.forEach((callback) => {\n callback({ currentTime: status.durationMillis, completed: completed });\n });\n }\n });\n await this._recorder.prepareToRecordAsync(this._audioOptions);\n };\n\n public requestPermission = async (): Promise<boolean> => {\n const status = await this.avModule.Audio.getPermissionsAsync();\n if (expoPermissionGranted([status])) {\n return true;\n } else {\n const status = await this.avModule.Audio.requestPermissionsAsync();\n return expoPermissionGranted([status]);\n }\n };\n\n public record = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['idle', 'completed'])) {\n try {\n await this.prepare();\n await this._recorder.startAsync();\n\n if (Platform.OS === 'android') {\n this._recordStartedAt = Date.now();\n }\n\n const uri = this._recorder.getURI();\n if (uri) this.uri = uri;\n this.setState('recording');\n } catch (e) {\n this.setState('idle');\n throw e;\n }\n }\n };\n\n public stop = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['recording'])) {\n if (Platform.OS === 'android') {\n const buffer = this._getRecorderStopSafeBuffer();\n if (buffer > 0) await sleep(buffer);\n }\n\n await this._recorder.stopAndUnloadAsync();\n if (Platform.OS === 'ios') {\n await this.avModule.Audio.setAudioModeAsync({ allowsRecordingIOS: false, playsInSilentModeIOS: false });\n }\n this.setState('completed');\n }\n };\n\n public reset = async (): Promise<void> => {\n await this.stop();\n this.uri = undefined;\n this._recordingSubscribers.clear();\n this._recorder = new this.avModule.Audio.Recording();\n this.setState('idle');\n };\n}\n\nclass ExpoAudioRecorderAdapter extends BaseAudioRecorderAdapter {\n private readonly audioModule: typeof ExpoAudio;\n private recorder: ExpoAudio.AudioRecorder | null = null;\n private recordingUpdateInterval: NodeJS.Timeout | null = null;\n\n constructor(audioModule: typeof ExpoAudio) {\n super();\n this.audioModule = audioModule;\n }\n\n private setListener = () => {\n if (!this.recorder) return;\n\n this.recordingUpdateInterval = setInterval(() => {\n if (this.recorder && this.recorder.isRecording) {\n const currentTime = this.recorder.currentTime * 1000;\n const completed = currentTime >= this.options.maxDuration;\n\n if (completed) {\n this.stop().catch((error) => {\n Logger.warn('[RecorderService.Expo] Failed to stop in update interval', error);\n });\n }\n\n this._recordingSubscribers.forEach((callback) => {\n callback({ currentTime, completed });\n });\n }\n }, 100);\n };\n\n private removeListener = () => {\n if (this.recordingUpdateInterval) {\n clearInterval(this.recordingUpdateInterval);\n this.recordingUpdateInterval = null;\n }\n };\n\n private prepare = async () => {\n this.setState('preparing');\n if (Platform.OS === 'ios') {\n await this.audioModule.setAudioModeAsync({\n allowsRecording: true,\n playsInSilentMode: true,\n });\n }\n\n const recordingOptions = {\n ...this._audioSettings,\n extension: `.${this.options.extension}`,\n };\n\n this.recorder = new this.audioModule.AudioModule.AudioRecorder(recordingOptions);\n await this.recorder.prepareToRecordAsync();\n };\n\n public requestPermission = async (): Promise<boolean> => {\n const status = await this.audioModule.getRecordingPermissionsAsync();\n if (expoPermissionGranted([status])) {\n return true;\n } else {\n const status = await this.audioModule.requestRecordingPermissionsAsync();\n return expoPermissionGranted([status]);\n }\n };\n\n public record = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['idle', 'completed'])) {\n try {\n await this.prepare();\n this.setListener();\n this.recorder?.record();\n\n if (Platform.OS === 'android') {\n this._recordStartedAt = Date.now();\n }\n\n const uri = this.recorder?.uri;\n if (uri) this.uri = uri;\n this.setState('recording');\n } catch (e) {\n this.setState('idle');\n this.removeListener();\n throw e;\n }\n }\n };\n\n public stop = async (): Promise<void> => {\n if (matchesOneOf(this.state, ['recording'])) {\n if (Platform.OS === 'android') {\n const buffer = this._getRecorderStopSafeBuffer();\n if (buffer > 0) await sleep(buffer);\n }\n\n await this.recorder?.stop();\n this.removeListener();\n if (Platform.OS === 'ios') {\n await this.audioModule.setAudioModeAsync({\n allowsRecording: false,\n playsInSilentMode: false,\n });\n }\n this.setState('completed');\n }\n };\n\n public reset = async (): Promise<void> => {\n await this.stop();\n this.recorder = null;\n this.uri = undefined;\n this._recordingSubscribers.clear();\n this._stateSubscribers.clear();\n this.setState('idle');\n };\n}\n\nconst createExpoRecorderService = ({ avModule }: Modules): RecorderServiceInterface => {\n if (expoBackwardUtils.expoAV.isLegacyAVModule(avModule)) {\n Logger.warn(\n '[RecorderService.Expo] expo-av is deprecated and will be removed in Expo 54. Please migrate to expo-audio.',\n );\n }\n\n return expoBackwardUtils.expoAV.isAudioModule(avModule)\n ? new ExpoAudioRecorderAdapter(avModule)\n : new LegacyExpoAVRecorderAdapter(avModule);\n};\n\nexport default createExpoRecorderService;\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAEA,IAAAK,sBAAA,GAAAF,sBAAA,CAAAH,OAAA;AAAmE,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd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
81
81
  },
82
+ expoAV: {
83
+ isLegacyAVModule(module) {
84
+ try {
85
+ return 'Video' in module && 'Audio' in module && typeof module.Video === 'function';
86
+ } catch {
87
+ return false;
88
+ }
89
+ },
90
+ isAudioModule(module) {
91
+ try {
92
+ return 'useAudioRecorder' in module && typeof module.useAudioRecorder === 'function';
93
+ } catch {
94
+ return false;
95
+ }
96
+ },
97
+ isVideoModule(module) {
98
+ try {
99
+ return 'VideoView' in module && 'useVideoPlayer' in module && typeof module.useVideoPlayer === 'function';
100
+ } catch {
101
+ return false;
102
+ }
103
+ }
104
+ },
82
105
  toFileSize(info) {
83
106
  if ('size' in info) {
84
107
  return info.size;
@@ -1 +1 @@
1
- {"version":3,"names":["_normalizeFile","_interopRequireDefault","require","e","__esModule","default","expoBackwardUtils","imagePicker","isCanceled","result","canceled","cancelled","toFilePickerResponses","fsModule","assets","promises","map","fileName","name","fileSize","size","type","uri","normalizeFile","Promise","all","fileInfo","getInfoAsync","response","toFileSize","documentPicker","mimeType","info","_default","exports"],"sources":["expoBackwardUtils.ts"],"sourcesContent":["import type * as ExpoDocumentPicker from 'expo-document-picker';\nimport type * as ExpoFs from 'expo-file-system';\nimport type * as ExpoImagePicker from 'expo-image-picker';\n\nimport type { FilePickerResponse } from '../platform/types';\nimport normalizeFile from './normalizeFile';\n\nconst expoBackwardUtils = {\n imagePicker: {\n isCanceled(result: ExpoImagePicker.ImagePickerResult) {\n // @ts-expect-error backward compatibility\n return result.canceled ?? result.cancelled;\n },\n async toFilePickerResponses(\n result: ExpoImagePicker.ImagePickerResult,\n fsModule: typeof ExpoFs,\n ): Promise<FilePickerResponse[]> {\n if (result.assets) {\n const assets = result.assets || [];\n const promises = assets.map(({ fileName: name, fileSize: size, type, uri }) =>\n normalizeFile({ uri, size, name, type }),\n );\n\n return Promise.all(promises);\n } else if ('uri' in result && typeof result.uri === 'string') {\n const fileInfo = await fsModule.getInfoAsync(result.uri);\n const response = await normalizeFile({ uri: result.uri, size: expoBackwardUtils.toFileSize(fileInfo) });\n return [response];\n } else {\n return [];\n }\n },\n },\n documentPicker: {\n isCanceled(result: ExpoDocumentPicker.DocumentPickerResult) {\n // @ts-expect-error backward compatibility\n return result.canceled ?? result.type === 'cancel';\n },\n async toFilePickerResponses(result: ExpoDocumentPicker.DocumentPickerResult): Promise<FilePickerResponse[]> {\n if (result.assets) {\n const assets = result.assets || [];\n const promises = assets.map(({ name, size, mimeType, uri }) =>\n normalizeFile({ uri, size, name, type: mimeType }),\n );\n\n return Promise.all(promises);\n } else if ('uri' in result && typeof result.uri === 'string') {\n // @ts-expect-error backward compatibility\n const { mimeType, uri, size, name } = result;\n const response = await normalizeFile({ uri, size, name, type: mimeType });\n\n return [response];\n } else {\n return [];\n }\n },\n },\n toFileSize(info: ExpoFs.FileInfo) {\n if ('size' in info) {\n return info.size;\n } else {\n return 0;\n }\n },\n};\n\nexport default expoBackwardUtils;\n"],"mappings":";;;;;;AAKA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C,MAAMG,iBAAiB,GAAG;EACxBC,WAAW,EAAE;IACXC,UAAUA,CAACC,MAAyC,EAAE;MACpD;MACA,OAAOA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACE,SAAS;IAC5C,CAAC;IACD,MAAMC,qBAAqBA,CACzBH,MAAyC,EACzCI,QAAuB,EACQ;MAC/B,IAAIJ,MAAM,CAACK,MAAM,EAAE;QACjB,MAAMA,MAAM,GAAGL,MAAM,CAACK,MAAM,IAAI,EAAE;QAClC,MAAMC,QAAQ,GAAGD,MAAM,CAACE,GAAG,CAAC,CAAC;UAAEC,QAAQ,EAAEC,IAAI;UAAEC,QAAQ,EAAEC,IAAI;UAAEC,IAAI;UAAEC;QAAI,CAAC,KACxE,IAAAC,sBAAa,EAAC;UAAED,GAAG;UAAEF,IAA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AAEF;QAAK,CAAC,GAAGT,MAAM;QAC5C,MAAMmB,QAAQ,GAAG,MAAM,IAAAL,sBAAa,EAAC;UAAED,GAAG;UAAEF,IAAI;UAAEF,IAAI;UAAEG,IAAI,EAAEU;QAAS,CAAC,CAAC;QAEzE,OAAO,CAACH,QAAQ,CAAC;MACnB,CAAC,MAAM;QACL,OAAO,EAAE;MACX;IACF;EACF,CAAC;EACDC,UAAUA,CAACG,IAAqB,EAAE;IAChC,IAAI,MAAM,IAAIA,IAAI,EAAE;MAClB,OAAOA,IAAI,CAACZ,IAAI;IAClB,CAAC,MAAM;MACL,OAAO,CAAC;IACV;EACF;AACF,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEaC,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_normalizeFile","_interopRequireDefault","require","e","__esModule","default","expoBackwardUtils","imagePicker","isCanceled","result","canceled","cancelled","toFilePickerResponses","fsModule","assets","promises","map","fileName","name","fileSize","size","type","uri","normalizeFile","Promise","all","fileInfo","getInfoAsync","response","toFileSize","documentPicker","mimeType","expoAV","isLegacyAVModule","module","Video","isAudioModule","useAudioRecorder","isVideoModule","useVideoPlayer","info","_default","exports"],"sources":["expoBackwardUtils.ts"],"sourcesContent":["import type * as ExpoAudio from 'expo-audio';\nimport type * as ExpoAV from 'expo-av';\nimport type * as ExpoDocumentPicker from 'expo-document-picker';\nimport type * as ExpoFs from 'expo-file-system';\nimport type * as ExpoImagePicker from 'expo-image-picker';\nimport type * as ExpoVideo from 'expo-video';\n\nimport type { FilePickerResponse } from '../platform/types';\nimport normalizeFile from './normalizeFile';\n\nconst expoBackwardUtils = {\n imagePicker: {\n isCanceled(result: ExpoImagePicker.ImagePickerResult) {\n // @ts-expect-error backward compatibility\n return result.canceled ?? result.cancelled;\n },\n async toFilePickerResponses(\n result: ExpoImagePicker.ImagePickerResult,\n fsModule: typeof ExpoFs,\n ): Promise<FilePickerResponse[]> {\n if (result.assets) {\n const assets = result.assets || [];\n const promises = assets.map(({ fileName: name, fileSize: size, type, uri }) =>\n normalizeFile({ uri, size, name, type }),\n );\n\n return Promise.all(promises);\n } else if ('uri' in result && typeof result.uri === 'string') {\n const fileInfo = await fsModule.getInfoAsync(result.uri);\n const response = await normalizeFile({ uri: result.uri, size: expoBackwardUtils.toFileSize(fileInfo) });\n return [response];\n } else {\n return [];\n }\n },\n },\n documentPicker: {\n isCanceled(result: ExpoDocumentPicker.DocumentPickerResult) {\n // @ts-expect-error backward compatibility\n return result.canceled ?? result.type === 'cancel';\n },\n async toFilePickerResponses(result: ExpoDocumentPicker.DocumentPickerResult): Promise<FilePickerResponse[]> {\n if (result.assets) {\n const assets = result.assets || [];\n const promises = assets.map(({ name, size, mimeType, uri }) =>\n normalizeFile({ uri, size, name, type: mimeType }),\n );\n\n return Promise.all(promises);\n } else if ('uri' in result && typeof result.uri === 'string') {\n // @ts-expect-error backward compatibility\n const { mimeType, uri, size, name } = result;\n const response = await normalizeFile({ uri, size, name, type: mimeType });\n\n return [response];\n } else {\n return [];\n }\n },\n },\n expoAV: {\n isLegacyAVModule(module: ExpoAudioModule | ExpoVideoModule): module is typeof ExpoAV {\n try {\n return 'Video' in module && 'Audio' in module && typeof module.Video === 'function';\n } catch {\n return false;\n }\n },\n isAudioModule(module: ExpoAudioModule): module is typeof ExpoAudio {\n try {\n return 'useAudioRecorder' in module && typeof module.useAudioRecorder === 'function';\n } catch {\n return false;\n }\n },\n isVideoModule(module: ExpoVideoModule): module is typeof ExpoVideo {\n try {\n return 'VideoView' in module && 'useVideoPlayer' in module && typeof module.useVideoPlayer === 'function';\n } catch {\n return false;\n }\n },\n },\n toFileSize(info: ExpoFs.FileInfo) {\n if ('size' in info) {\n return info.size;\n } else {\n return 0;\n }\n },\n};\n\nexport type ExpoAudioModule = typeof ExpoAV | typeof ExpoAudio;\nexport type ExpoVideoModule = typeof ExpoAV | typeof ExpoVideo;\n\nexport default expoBackwardUtils;\n"],"mappings":";;;;;;AAQA,IA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B,KAAK,UAAU;MACtF,CAAC,CAAC,MAAM;QACN,OAAO,KAAK;MACd;IACF,CAAC;IACDC,aAAaA,CAACJ,MAAuB,EAA8B;MACjE,IAAI;QACF,OAAO,WAAW,IAAIA,MAAM,IAAI,gBAAgB,IAAIA,MAAM,IAAI,OAAOA,MAAM,CAACK,cAAc,KAAK,UAAU;MAC3G,CAAC,CAAC,MAAM;QACN,OAAO,KAAK;MACd;IACF;EACF,CAAC;EACDV,UAAUA,CAACW,IAAqB,EAAE;IAChC,IAAI,MAAM,IAAIA,IAAI,EAAE;MAClB,OAAOA,IAAI,CAACpB,IAAI;IAClB,CAAC,MAAM;MACL,OAAO,CAAC;IACV;EACF;AACF,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAKaC,iBAAiB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["expoPermissionGranted","stats","limitedCallback","every","res","accessPrivileges","granted","status","_res$ios","ios","_default","exports","default"],"sources":["expoPermissionGranted.ts"],"sourcesContent":["import type { NotificationPermissionsStatus } from 'expo-notifications';\n\nexport interface ExpoPermissionResponse {\n canAskAgain: boolean;\n granted: boolean;\n status: 'denied' | 'granted' | 'undetermined';\n}\n\nexport interface ExpoMediaLibraryPermissionResponse extends ExpoPermissionResponse {\n accessPrivileges?: 'all' | 'limited' | 'none';\n}\nexport interface ExpoPushPermissionResponse extends ExpoPermissionResponse, NotificationPermissionsStatus {}\n\nconst expoPermissionGranted = (\n stats: Array<ExpoMediaLibraryPermissionResponse | ExpoPushPermissionResponse | ExpoPermissionResponse>,\n limitedCallback?: () => void,\n) => {\n return stats.every((res) => {\n if ('accessPrivileges' in res) {\n if (res.accessPrivileges === 'limited') limitedCallback?.();\n return (\n res.granted || res.status === 'granted' || res.accessPrivileges === 'all' || res.accessPrivileges === 'limited'\n );\n }\n if ('ios' in res) {\n // NOT_DETERMINED = 0,\n // DENIED = 1,\n // AUTHORIZED = 2,\n // PROVISIONAL = 3,\n // EPHEMERAL = 4,\n return (\n res.granted || res.status === 'granted' || (res.ios?.status && (res.ios.status === 2 || res.ios.status === 3))\n );\n }\n return res.granted || res.status === 'granted';\n });\n};\n\nexport default expoPermissionGranted;\n"],"mappings":";;;;;;AAaA,MAAMA,qBAAqB,GAAGA,CAC5BC,KAAsG,EACtGC,eAA4B,KACzB;EACH,OAAOD,KAAK,CAACE,KAAK,CAAEC,GAAG,IAAK;IAC1B,IAAI,kBAAkB,IAAIA,GAAG,EAAE;MAC7B,IAAIA,GAAG,CAACC,gBAAgB,KAAK,SAAS,EAAEH,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAG,CAAC;MAC3D,OACEE,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS,IAAIH,GAAG,CAACC,gBAAgB,KAAK,KAAK,IAAID,GAAG,CAACC,gBAAgB,KAAK,SAAS;IAEnH;IACA,IAAI,KAAK,IAAID,GAAG,EAAE;MAAA,IAAAI,QAAA;MAChB;MACA;MACA;MACA;MACA;MACA,OACEJ,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS,IAAK,EAAAC,QAAA,GAAAJ,GAAG,CAACK,GAAG,cAAAD,QAAA,uBAAPA,QAAA,CAASD,MAAM,MAAKH,GAAG,CAACK,GAAG,CAACF,MAAM,KAAK,CAAC,IAAIH,GAAG,CAACK,GAAG,CAACF,MAAM,KAAK,CAAC,CAAE;IAElH;IACA,OAAOH,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS;EAChD,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["expoPermissionGranted","stats","limitedCallback","every","res","accessPrivileges","granted","status","_res$ios","ios","_default","exports","default"],"sources":["expoPermissionGranted.ts"],"sourcesContent":["import type { NotificationPermissionsStatus } from 'expo-notifications';\n\nexport interface ExpoPermissionResponse {\n canAskAgain: boolean;\n granted: boolean;\n status: 'denied' | 'granted' | 'undetermined';\n}\n\nexport interface ExpoMediaLibraryPermissionResponse extends ExpoPermissionResponse {\n accessPrivileges?: 'all' | 'limited' | 'none';\n}\nexport interface ExpoPushPermissionResponse\n extends Omit<ExpoPermissionResponse, 'status'>,\n NotificationPermissionsStatus {}\n\nconst expoPermissionGranted = (\n stats: Array<ExpoMediaLibraryPermissionResponse | ExpoPushPermissionResponse | ExpoPermissionResponse>,\n limitedCallback?: () => void,\n) => {\n return stats.every((res) => {\n if ('accessPrivileges' in res) {\n if (res.accessPrivileges === 'limited') limitedCallback?.();\n return (\n res.granted || res.status === 'granted' || res.accessPrivileges === 'all' || res.accessPrivileges === 'limited'\n );\n }\n if ('ios' in res) {\n // NOT_DETERMINED = 0,\n // DENIED = 1,\n // AUTHORIZED = 2,\n // PROVISIONAL = 3,\n // EPHEMERAL = 4,\n return (\n res.granted || res.status === 'granted' || (res.ios?.status && (res.ios.status === 2 || res.ios.status === 3))\n );\n }\n return res.granted || res.status === 'granted';\n });\n};\n\nexport default expoPermissionGranted;\n"],"mappings":";;;;;;AAeA,MAAMA,qBAAqB,GAAGA,CAC5BC,KAAsG,EACtGC,eAA4B,KACzB;EACH,OAAOD,KAAK,CAACE,KAAK,CAAEC,GAAG,IAAK;IAC1B,IAAI,kBAAkB,IAAIA,GAAG,EAAE;MAC7B,IAAIA,GAAG,CAACC,gBAAgB,KAAK,SAAS,EAAEH,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAG,CAAC;MAC3D,OACEE,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS,IAAIH,GAAG,CAACC,gBAAgB,KAAK,KAAK,IAAID,GAAG,CAACC,gBAAgB,KAAK,SAAS;IAEnH;IACA,IAAI,KAAK,IAAID,GAAG,EAAE;MAAA,IAAAI,QAAA;MAChB;MACA;MACA;MACA;MACA;MACA,OACEJ,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS,IAAK,EAAAC,QAAA,GAAAJ,GAAG,CAACK,GAAG,cAAAD,QAAA,uBAAPA,QAAA,CAASD,MAAM,MAAKH,GAAG,CAACK,GAAG,CAACF,MAAM,KAAK,CAAC,IAAIH,GAAG,CAACK,GAAG,CAACF,MAAM,KAAK,CAAC,CAAE;IAElH;IACA,OAAOH,GAAG,CAACE,OAAO,IAAIF,GAAG,CAACG,MAAM,KAAK,SAAS;EAChD,CAAC,CAAC;AACJ,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,qBAAqB","ignoreList":[]}
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- const VERSION = '3.11.0';
7
+ const VERSION = '3.11.1';
8
8
  var _default = exports.default = VERSION;
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.11.0';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACVH,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.11.1';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACVH,OAAO","ignoreList":[]}