one 2.0.0-beta.134.1 → 2.0.0-beta.135.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.
- package/dist/cjs/platform/audio/index.cjs +2 -1
- package/dist/cjs/platform/audio/index.native.cjs +6 -0
- package/dist/cjs/platform/audio/index.native.js +6 -0
- package/dist/cjs/platform/audio/index.native.js.map +1 -1
- package/dist/cjs/safe-area-context/SafeAreaContext.cjs +11 -13
- package/dist/cjs/safe-area-context/SafeAreaContext.native.cjs +11 -13
- package/dist/cjs/safe-area-context/SafeAreaContext.native.js +11 -13
- package/dist/cjs/safe-area-context/SafeAreaContext.native.js.map +1 -1
- package/dist/esm/platform/audio/index.mjs +2 -1
- package/dist/esm/platform/audio/index.mjs.map +1 -1
- package/dist/esm/platform/audio/index.native.js +6 -0
- package/dist/esm/platform/audio/index.native.js.map +1 -1
- package/dist/esm/safe-area-context/SafeAreaContext.mjs +11 -13
- package/dist/esm/safe-area-context/SafeAreaContext.mjs.map +1 -1
- package/dist/esm/safe-area-context/SafeAreaContext.native.js +11 -13
- package/dist/esm/safe-area-context/SafeAreaContext.native.js.map +1 -1
- package/ios/Nitro/HybridOneAudio.swift +44 -0
- package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.hpp +28 -0
- package/nitrogen/generated/ios/One-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridOneAudioSpecSwift.hpp +15 -0
- package/nitrogen/generated/ios/swift/AudioInterruptionEvent.swift +34 -0
- package/nitrogen/generated/ios/swift/AudioInterruptionType.swift +40 -0
- package/nitrogen/generated/ios/swift/Func_void_AudioInterruptionEvent.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridOneAudioSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOneAudioSpec_cxx.swift +20 -0
- package/nitrogen/generated/shared/c++/AudioInterruptionEvent.hpp +88 -0
- package/nitrogen/generated/shared/c++/AudioInterruptionType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridOneAudioSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridOneAudioSpec.hpp +5 -0
- package/package.json +10 -10
- package/src/platform/audio/index.native.ts +9 -0
- package/src/platform/audio/index.ts +4 -0
- package/src/platform/specs/OneAudio.nitro.ts +8 -0
- package/src/safe-area-context/SafeAreaContext.tsx +15 -12
- package/types/platform/audio/index.d.ts +3 -2
- package/types/platform/audio/index.d.ts.map +1 -1
- package/types/platform/audio/index.native.d.ts +3 -2
- package/types/platform/audio/index.native.d.ts.map +1 -1
- package/types/platform/specs/OneAudio.nitro.d.ts +6 -0
- package/types/platform/specs/OneAudio.nitro.d.ts.map +1 -1
- package/types/safe-area-context/SafeAreaContext.d.ts.map +1 -1
|
@@ -37,5 +37,6 @@ const Audio = Object.freeze({
|
|
|
37
37
|
getRecordingStatus: () => unavailable(),
|
|
38
38
|
pauseRecording: () => unavailable(),
|
|
39
39
|
resumeRecording: () => unavailable(),
|
|
40
|
-
stopRecording: () => unavailable()
|
|
40
|
+
stopRecording: () => unavailable(),
|
|
41
|
+
watchInterruptions: (_onEvent) => unavailable()
|
|
41
42
|
});
|
|
@@ -71,5 +71,11 @@ var Audio = Object.freeze({
|
|
|
71
71
|
},
|
|
72
72
|
stopRecording: function() {
|
|
73
73
|
return native().stopRecording().catch(import_nativeError.rethrowNativeError);
|
|
74
|
+
},
|
|
75
|
+
watchInterruptions: function(onEvent) {
|
|
76
|
+
if (typeof onEvent !== "function") {
|
|
77
|
+
throw new TypeError("Audio.watchInterruptions: onEvent must be a function");
|
|
78
|
+
}
|
|
79
|
+
return native().addInterruptionListener(onEvent);
|
|
74
80
|
}
|
|
75
81
|
});
|
|
@@ -71,6 +71,12 @@ var Audio = Object.freeze({
|
|
|
71
71
|
},
|
|
72
72
|
stopRecording: function() {
|
|
73
73
|
return native().stopRecording().catch(import_nativeError.rethrowNativeError);
|
|
74
|
+
},
|
|
75
|
+
watchInterruptions: function(onEvent) {
|
|
76
|
+
if (typeof onEvent !== "function") {
|
|
77
|
+
throw new TypeError("Audio.watchInterruptions: onEvent must be a function");
|
|
78
|
+
}
|
|
79
|
+
return native().addInterruptionListener(onEvent);
|
|
74
80
|
}
|
|
75
81
|
});
|
|
76
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/audio/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n Audio: () => Audio\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_react_native = require(\"react-native\");\nvar import_react_native_nitro_modules = require(\"react-native-nitro-modules\");\nvar import_nativeError = require(\"../nativeError\");\nvar hybrid;\nfunction native() {\n if (import_react_native.Platform.OS !== \"ios\") throw new Error(\"Audio requires an iOS native build\");\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject(\"OneAudio\");\n return hybrid;\n}\nvar Audio = Object.freeze({\n getRecordingPermissionStatus: function() {\n return native().getRecordingPermissionStatus().catch(import_nativeError.rethrowNativeError);\n },\n requestRecordingPermission: function() {\n return native().requestRecordingPermission().catch(import_nativeError.rethrowNativeError);\n },\n play: function(uri) {\n return native().play(uri).catch(import_nativeError.rethrowNativeError);\n },\n getPlaybackStatus: function() {\n return native().getPlaybackStatus().catch(import_nativeError.rethrowNativeError);\n },\n pause: function() {\n return native().pause().catch(import_nativeError.rethrowNativeError);\n },\n resume: function() {\n return native().resume().catch(import_nativeError.rethrowNativeError);\n },\n seek: function(positionMs) {\n return native().seek(positionMs).catch(import_nativeError.rethrowNativeError);\n },\n stop: function() {\n return native().stop().catch(import_nativeError.rethrowNativeError);\n },\n startRecording: function() {\n return native().startRecording().catch(import_nativeError.rethrowNativeError);\n },\n getRecordingStatus: function() {\n return native().getRecordingStatus().catch(import_nativeError.rethrowNativeError);\n },\n pauseRecording: function() {\n return native().pauseRecording().catch(import_nativeError.rethrowNativeError);\n },\n resumeRecording: function() {\n return native().resumeRecording().catch(import_nativeError.rethrowNativeError);\n },\n stopRecording: function() {\n return native().stopRecording().catch(import_nativeError.rethrowNativeError);\n }\n});\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAA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AC,KAAK,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CACpE;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CAC9E;CACA,oBAAoB,WAAW;EAC7B,OAAO,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CAClF;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CAC9E;CACA,iBAAiB,WAAW;EAC1B,OAAO,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CAC/E;CACA,eAAe,WAAW;EACxB,OAAO,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,mBAAmB,kBAAkB;CAC7E;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/platform/audio/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_native_exports = {};\n__export(index_native_exports, {\n Audio: () => Audio\n});\nmodule.exports = __toCommonJS(index_native_exports);\nvar import_react_native = require(\"react-native\");\nvar import_react_native_nitro_modules = require(\"react-native-nitro-modules\");\nvar import_nativeError = require(\"../nativeError\");\nvar hybrid;\nfunction native() {\n if (import_react_native.Platform.OS !== \"ios\") throw new Error(\"Audio requires an iOS native build\");\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject(\"OneAudio\");\n return hybrid;\n}\nvar Audio = Object.freeze({\n getRecordingPermissionStatus: function() {\n return native().getRecordingPermissionStatus().catch(import_nativeError.rethrowNativeError);\n },\n requestRecordingPermission: function() {\n return native().requestRecordingPermission().catch(import_nativeError.rethrowNativeError);\n },\n play: function(uri) {\n return native().play(uri).catch(import_nativeError.rethrowNativeError);\n },\n getPlaybackStatus: function() {\n return native().getPlaybackStatus().catch(import_nativeError.rethrowNativeError);\n },\n pause: function() {\n return native().pause().catch(import_nativeError.rethrowNativeError);\n },\n resume: function() {\n return native().resume().catch(import_nativeError.rethrowNativeError);\n },\n seek: function(positionMs) {\n return native().seek(positionMs).catch(import_nativeError.rethrowNativeError);\n },\n stop: function() {\n return native().stop().catch(import_nativeError.rethrowNativeError);\n },\n startRecording: function() {\n return native().startRecording().catch(import_nativeError.rethrowNativeError);\n },\n getRecordingStatus: function() {\n return native().getRecordingStatus().catch(import_nativeError.rethrowNativeError);\n },\n pauseRecording: function() {\n return native().pauseRecording().catch(import_nativeError.rethrowNativeError);\n },\n resumeRecording: function() {\n return native().resumeRecording().catch(import_nativeError.rethrowNativeError);\n },\n stopRecording: function() {\n return native().stopRecording().catch(import_nativeError.rethrowNativeError);\n },\n watchInterruptions: function(onEvent) {\n if (typeof onEvent !== \"function\") {\n throw new TypeError(\"Audio.watchInterruptions: onEvent must be a function\");\n }\n return native().addInterruptionListener(onEvent);\n }\n});\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QA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|
73
73
|
}, tamaguiHooks);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return curInsets;
|
|
87
|
-
});
|
|
75
|
+
setFrame((curFrame) => {
|
|
76
|
+
if (nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)) {
|
|
77
|
+
return nextFrame;
|
|
78
|
+
}
|
|
79
|
+
return curFrame;
|
|
80
|
+
});
|
|
81
|
+
setInsets((curInsets) => {
|
|
82
|
+
if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {
|
|
83
|
+
return nextInsets;
|
|
84
|
+
}
|
|
85
|
+
return curInsets;
|
|
88
86
|
});
|
|
89
87
|
}, [isRoot]);
|
|
90
88
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeSafeAreaProvider.NativeSafeAreaProvider, {
|
|
@@ -76,19 +76,17 @@ function SafeAreaProvider(param) {
|
|
|
76
76
|
frame: nextFrame
|
|
77
77
|
}, tamaguiHooks);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return curInsets;
|
|
91
|
-
});
|
|
79
|
+
setFrame(function(curFrame) {
|
|
80
|
+
if (nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)) {
|
|
81
|
+
return nextFrame;
|
|
82
|
+
}
|
|
83
|
+
return curFrame;
|
|
84
|
+
});
|
|
85
|
+
setInsets(function(curInsets) {
|
|
86
|
+
if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {
|
|
87
|
+
return nextInsets;
|
|
88
|
+
}
|
|
89
|
+
return curInsets;
|
|
92
90
|
});
|
|
93
91
|
}, [isRoot]);
|
|
94
92
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeSafeAreaProvider.NativeSafeAreaProvider, {
|
|
@@ -76,19 +76,17 @@ function SafeAreaProvider(param) {
|
|
|
76
76
|
frame: nextFrame
|
|
77
77
|
}, tamaguiHooks);
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return curInsets;
|
|
91
|
-
});
|
|
79
|
+
setFrame(function(curFrame) {
|
|
80
|
+
if (nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)) {
|
|
81
|
+
return nextFrame;
|
|
82
|
+
}
|
|
83
|
+
return curFrame;
|
|
84
|
+
});
|
|
85
|
+
setInsets(function(curInsets) {
|
|
86
|
+
if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {
|
|
87
|
+
return nextInsets;
|
|
88
|
+
}
|
|
89
|
+
return curInsets;
|
|
92
90
|
});
|
|
93
91
|
}, [isRoot]);
|
|
94
92
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeSafeAreaProvider.NativeSafeAreaProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaContext.native.js","names":[],"sources":["cjs/safe-area-context/SafeAreaContext.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SafeAreaContext_exports = {};\n__export(SafeAreaContext_exports, {\n SafeAreaConsumer: () => SafeAreaConsumer,\n SafeAreaContext: () => SafeAreaContext,\n SafeAreaFrameContext: () => SafeAreaFrameContext,\n SafeAreaInsetsContext: () => SafeAreaInsetsContext,\n SafeAreaProvider: () => SafeAreaProvider,\n useSafeArea: () => useSafeArea,\n useSafeAreaFrame: () => useSafeAreaFrame,\n useSafeAreaInsets: () => useSafeAreaInsets,\n withSafeAreaInsets: () => withSafeAreaInsets\n});\nmodule.exports = __toCommonJS(SafeAreaContext_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_NativeSafeAreaProvider = require(\"./NativeSafeAreaProvider\");\nvar import_getWindowFrame = require(\"./getWindowFrame\");\nvar import_InitialWindow = require(\"./InitialWindow\");\nvar import_tamaguiSafeArea = require(\"./tamaguiSafeArea\");\nvar isDev = process.env.NODE_ENV !== \"production\";\nvar SafeAreaInsetsContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nvar SafeAreaFrameContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nvar ZERO_INSETS = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n};\nfunction SafeAreaProvider(param) {\n var { children, initialMetrics, initialSafeAreaInsets, ...others } = param;\n var _ref, _ref1, _ref2, _ref3, _ref4;\n var parentInsets = useParentSafeAreaInsets();\n var parentFrame = useParentSafeAreaFrame();\n var isRoot = parentInsets === null;\n var [insets, setInsets] = React.useState((_ref = (_ref1 = (_ref2 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.insets) !== null && _ref2 !== void 0 ? _ref2 : initialSafeAreaInsets) !== null && _ref1 !== void 0 ? _ref1 : parentInsets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS);\n var [frame, setFrame] = React.useState((_ref3 = (_ref4 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.frame) !== null && _ref4 !== void 0 ? _ref4 : parentFrame) !== null && _ref3 !== void 0 ? _ref3 : (\n // backwards compat so we render anyway if we don't have frame.\n (0, import_getWindowFrame.getWindowFrame)()\n ));\n var onInsetsChange = React.useCallback(function(event) {\n var { nativeEvent: { frame: nextFrame, insets: nextInsets } } = event;\n if (isRoot && nextFrame) {\n (0, import_tamaguiSafeArea.feedTamaguiSafeArea)({\n insets: nextInsets,\n frame: nextFrame\n }, tamaguiHooks);\n }\n React.startTransition(function() {\n setFrame(function(curFrame) {\n if (\n // Backwards compat with old native code that won't send frame.\n nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)\n ) {\n return nextFrame;\n }\n return curFrame;\n });\n setInsets(function(curInsets) {\n if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {\n return nextInsets;\n }\n return curInsets;\n });\n });\n }, [\n isRoot\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeSafeAreaProvider.NativeSafeAreaProvider, {\n onInsetsChange,\n ...others,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SafeAreaFrameContext.Provider, {\n value: frame,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SafeAreaInsetsContext.Provider, {\n value: insets,\n children\n })\n })\n });\n}\nfunction useParentSafeAreaInsets() {\n return React.useContext(SafeAreaInsetsContext);\n}\nfunction useParentSafeAreaFrame() {\n return React.useContext(SafeAreaFrameContext);\n}\nvar NO_INSETS_ERROR = \"No safe area value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.\";\nfunction useSafeAreaInsets() {\n var insets = React.useContext(SafeAreaInsetsContext);\n if (insets == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return insets;\n}\nfunction useSafeAreaFrame() {\n var frame = React.useContext(SafeAreaFrameContext);\n if (frame == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return frame;\n}\nfunction withSafeAreaInsets(WrappedComponent) {\n return /* @__PURE__ */ React.forwardRef(function(props, ref) {\n var insets = useSafeAreaInsets();\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, {\n ...props,\n insets,\n ref\n });\n });\n}\nvar tamaguiHooks = {\n useSafeAreaInsets,\n useSafeAreaFrame\n};\n(0, import_tamaguiSafeArea.feedTamaguiSafeArea)(import_InitialWindow.initialWindowMetrics, tamaguiHooks);\nfunction useSafeArea() {\n return useSafeAreaInsets();\n}\nvar SafeAreaConsumer = SafeAreaInsetsContext.Consumer;\nvar SafeAreaContext = SafeAreaInsetsContext;\n//# sourceMappingURL=SafeAreaContext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WAAW,SAAS,OAAO,KAAK;EAC3D,IAAI,SAAS,kBAAkB;EAC/B,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;GACnE,GAAG;GACH;GACA;EACF,CAAC;CACH,CAAC;AACH;AACA,IAAI,eAAe;CACjB;CACA;AACF;CACC,GAAG,uBAAuB,oBAAmB,CAAE,qBAAqB,sBAAsB,YAAY;AACvG,SAAS,cAAc;CACrB,OAAO,kBAAkB;AAC3B;AACA,IAAI,mBAAmB,sBAAsB;AAC7C,IAAI,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"SafeAreaContext.native.js","names":[],"sources":["cjs/safe-area-context/SafeAreaContext.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar SafeAreaContext_exports = {};\n__export(SafeAreaContext_exports, {\n SafeAreaConsumer: () => SafeAreaConsumer,\n SafeAreaContext: () => SafeAreaContext,\n SafeAreaFrameContext: () => SafeAreaFrameContext,\n SafeAreaInsetsContext: () => SafeAreaInsetsContext,\n SafeAreaProvider: () => SafeAreaProvider,\n useSafeArea: () => useSafeArea,\n useSafeAreaFrame: () => useSafeAreaFrame,\n useSafeAreaInsets: () => useSafeAreaInsets,\n withSafeAreaInsets: () => withSafeAreaInsets\n});\nmodule.exports = __toCommonJS(SafeAreaContext_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar React = __toESM(require(\"react\"), 1);\nvar import_NativeSafeAreaProvider = require(\"./NativeSafeAreaProvider\");\nvar import_getWindowFrame = require(\"./getWindowFrame\");\nvar import_InitialWindow = require(\"./InitialWindow\");\nvar import_tamaguiSafeArea = require(\"./tamaguiSafeArea\");\nvar isDev = process.env.NODE_ENV !== \"production\";\nvar SafeAreaInsetsContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nvar SafeAreaFrameContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nvar ZERO_INSETS = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n};\nfunction SafeAreaProvider(param) {\n var { children, initialMetrics, initialSafeAreaInsets, ...others } = param;\n var _ref, _ref1, _ref2, _ref3, _ref4;\n var parentInsets = useParentSafeAreaInsets();\n var parentFrame = useParentSafeAreaFrame();\n var isRoot = parentInsets === null;\n var [insets, setInsets] = React.useState((_ref = (_ref1 = (_ref2 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.insets) !== null && _ref2 !== void 0 ? _ref2 : initialSafeAreaInsets) !== null && _ref1 !== void 0 ? _ref1 : parentInsets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS);\n var [frame, setFrame] = React.useState((_ref3 = (_ref4 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.frame) !== null && _ref4 !== void 0 ? _ref4 : parentFrame) !== null && _ref3 !== void 0 ? _ref3 : (\n // backwards compat so we render anyway if we don't have frame.\n (0, import_getWindowFrame.getWindowFrame)()\n ));\n var onInsetsChange = React.useCallback(function(event) {\n var { nativeEvent: { frame: nextFrame, insets: nextInsets } } = event;\n if (isRoot && nextFrame) {\n (0, import_tamaguiSafeArea.feedTamaguiSafeArea)({\n insets: nextInsets,\n frame: nextFrame\n }, tamaguiHooks);\n }\n setFrame(function(curFrame) {\n if (\n // Backwards compat with old native code that won't send frame.\n nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)\n ) {\n return nextFrame;\n }\n return curFrame;\n });\n setInsets(function(curInsets) {\n if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {\n return nextInsets;\n }\n return curInsets;\n });\n }, [\n isRoot\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NativeSafeAreaProvider.NativeSafeAreaProvider, {\n onInsetsChange,\n ...others,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SafeAreaFrameContext.Provider, {\n value: frame,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SafeAreaInsetsContext.Provider, {\n value: insets,\n children\n })\n })\n });\n}\nfunction useParentSafeAreaInsets() {\n return React.useContext(SafeAreaInsetsContext);\n}\nfunction useParentSafeAreaFrame() {\n return React.useContext(SafeAreaFrameContext);\n}\nvar NO_INSETS_ERROR = \"No safe area value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.\";\nfunction useSafeAreaInsets() {\n var insets = React.useContext(SafeAreaInsetsContext);\n if (insets == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return insets;\n}\nfunction useSafeAreaFrame() {\n var frame = React.useContext(SafeAreaFrameContext);\n if (frame == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return frame;\n}\nfunction withSafeAreaInsets(WrappedComponent) {\n return /* @__PURE__ */ React.forwardRef(function(props, ref) {\n var insets = useSafeAreaInsets();\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, {\n ...props,\n insets,\n ref\n });\n });\n}\nvar tamaguiHooks = {\n useSafeAreaInsets,\n useSafeAreaFrame\n};\n(0, import_tamaguiSafeArea.feedTamaguiSafeArea)(import_InitialWindow.initialWindowMetrics, tamaguiHooks);\nfunction useSafeArea() {\n return useSafeAreaInsets();\n}\nvar SafeAreaConsumer = SafeAreaInsetsContext.Consumer;\nvar SafeAreaContext = SafeAreaInsetsContext;\n//# sourceMappingURL=SafeAreaContext.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,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,WAAW,qBAAqB;AAC/C;AACA,SAAS,yBAAyB;CAChC,OAAO,MAAM,WAAW,oBAAoB;AAC9C;AACA,IAAI,kBAAkB;AACtB,SAAS,oBAAoB;CAC3B,IAAI,SAAS,MAAM,WAAW,qBAAqB;CACnD,IAAI,UAAU,MAAM;EAClB,MAAM,IAAI,MAAM,eAAe;CACjC;CACA,OAAO;AACT;AACA,SAAS,mBAAmB;CAC1B,IAAI,QAAQ,MAAM,WAAW,oBAAoB;CACjD,IAAI,SAAS,MAAM;EACjB,MAAM,IAAI,MAAM,eAAe;CACjC;CACA,OAAO;AACT;AACA,SAAS,mBAAmB,kBAAkB;CAC5C,OAAuB,sBAAM,WAAW,SAAS,OAAO,KAAK;EAC3D,IAAI,SAAS,kBAAkB;EAC/B,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;GACnE,GAAG;GACH;GACA;EACF,CAAC;CACH,CAAC;AACH;AACA,IAAI,eAAe;CACjB;CACA;AACF;CACC,GAAG,uBAAuB,oBAAmB,CAAE,qBAAqB,sBAAsB,YAAY;AACvG,SAAS,cAAc;CACrB,OAAO,kBAAkB;AAC3B;AACA,IAAI,mBAAmB,sBAAsB;AAC7C,IAAI,kBAAkB"}
|
|
@@ -14,7 +14,8 @@ const Audio = Object.freeze({
|
|
|
14
14
|
getRecordingStatus: () => unavailable(),
|
|
15
15
|
pauseRecording: () => unavailable(),
|
|
16
16
|
resumeRecording: () => unavailable(),
|
|
17
|
-
stopRecording: () => unavailable()
|
|
17
|
+
stopRecording: () => unavailable(),
|
|
18
|
+
watchInterruptions: (_onEvent) => unavailable()
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
export { Audio };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["esm/platform/audio/index.js"],"sourcesContent":["function unavailable() {\n throw new Error(\"Audio requires an iOS native build\");\n}\nconst Audio = Object.freeze({\n getRecordingPermissionStatus: () => unavailable(),\n requestRecordingPermission: () => unavailable(),\n play: (_uri) => unavailable(),\n getPlaybackStatus: () => unavailable(),\n pause: () => unavailable(),\n resume: () => unavailable(),\n seek: (_positionMs) => unavailable(),\n stop: () => unavailable(),\n startRecording: () => unavailable(),\n getRecordingStatus: () => unavailable(),\n pauseRecording: () => unavailable(),\n resumeRecording: () => unavailable(),\n stopRecording: () => unavailable()\n});\nexport {\n Audio\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";AAAA,SAAS,cAAc;CACrB,MAAM,IAAI,MAAM,oCAAoC;AACtD;AACA,MAAM,QAAQ,OAAO,OAAO;CAC1B,oCAAoC,YAAY;CAChD,kCAAkC,YAAY;CAC9C,OAAO,SAAS,YAAY;CAC5B,yBAAyB,YAAY;CACrC,aAAa,YAAY;CACzB,cAAc,YAAY;CAC1B,OAAO,gBAAgB,YAAY;CACnC,YAAY,YAAY;CACxB,sBAAsB,YAAY;CAClC,0BAA0B,YAAY;CACtC,sBAAsB,YAAY;CAClC,uBAAuB,YAAY;CACnC,qBAAqB,YAAY;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/platform/audio/index.js"],"sourcesContent":["function unavailable() {\n throw new Error(\"Audio requires an iOS native build\");\n}\nconst Audio = Object.freeze({\n getRecordingPermissionStatus: () => unavailable(),\n requestRecordingPermission: () => unavailable(),\n play: (_uri) => unavailable(),\n getPlaybackStatus: () => unavailable(),\n pause: () => unavailable(),\n resume: () => unavailable(),\n seek: (_positionMs) => unavailable(),\n stop: () => unavailable(),\n startRecording: () => unavailable(),\n getRecordingStatus: () => unavailable(),\n pauseRecording: () => unavailable(),\n resumeRecording: () => unavailable(),\n stopRecording: () => unavailable(),\n watchInterruptions: (_onEvent) => unavailable()\n});\nexport {\n Audio\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";AAAA,SAAS,cAAc;CACrB,MAAM,IAAI,MAAM,oCAAoC;AACtD;AACA,MAAM,QAAQ,OAAO,OAAO;CAC1B,oCAAoC,YAAY;CAChD,kCAAkC,YAAY;CAC9C,OAAO,SAAS,YAAY;CAC5B,yBAAyB,YAAY;CACrC,aAAa,YAAY;CACzB,cAAc,YAAY;CAC1B,OAAO,gBAAgB,YAAY;CACnC,YAAY,YAAY;CACxB,sBAAsB,YAAY;CAClC,0BAA0B,YAAY;CACtC,sBAAsB,YAAY;CAClC,uBAAuB,YAAY;CACnC,qBAAqB,YAAY;CACjC,qBAAqB,aAAa,YAAY;AAChD,CAAC"}
|
|
@@ -47,6 +47,12 @@ var Audio = Object.freeze({
|
|
|
47
47
|
},
|
|
48
48
|
stopRecording: function() {
|
|
49
49
|
return native().stopRecording().catch(rethrowNativeError);
|
|
50
|
+
},
|
|
51
|
+
watchInterruptions: function(onEvent) {
|
|
52
|
+
if (typeof onEvent !== "function") {
|
|
53
|
+
throw new TypeError("Audio.watchInterruptions: onEvent must be a function");
|
|
54
|
+
}
|
|
55
|
+
return native().addInterruptionListener(onEvent);
|
|
50
56
|
}
|
|
51
57
|
});
|
|
52
58
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/audio/index.native.js"],"sourcesContent":["import { Platform } from \"react-native\";\nimport { NitroModules } from \"react-native-nitro-modules\";\nimport { rethrowNativeError } from \"../nativeError\";\nvar hybrid;\nfunction native() {\n if (Platform.OS !== \"ios\") throw new Error(\"Audio requires an iOS native build\");\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject(\"OneAudio\");\n return hybrid;\n}\nvar Audio = Object.freeze({\n getRecordingPermissionStatus: function() {\n return native().getRecordingPermissionStatus().catch(rethrowNativeError);\n },\n requestRecordingPermission: function() {\n return native().requestRecordingPermission().catch(rethrowNativeError);\n },\n play: function(uri) {\n return native().play(uri).catch(rethrowNativeError);\n },\n getPlaybackStatus: function() {\n return native().getPlaybackStatus().catch(rethrowNativeError);\n },\n pause: function() {\n return native().pause().catch(rethrowNativeError);\n },\n resume: function() {\n return native().resume().catch(rethrowNativeError);\n },\n seek: function(positionMs) {\n return native().seek(positionMs).catch(rethrowNativeError);\n },\n stop: function() {\n return native().stop().catch(rethrowNativeError);\n },\n startRecording: function() {\n return native().startRecording().catch(rethrowNativeError);\n },\n getRecordingStatus: function() {\n return native().getRecordingStatus().catch(rethrowNativeError);\n },\n pauseRecording: function() {\n return native().pauseRecording().catch(rethrowNativeError);\n },\n resumeRecording: function() {\n return native().resumeRecording().catch(rethrowNativeError);\n },\n stopRecording: function() {\n return native().stopRecording().catch(rethrowNativeError);\n }\n});\nexport {\n Audio\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;;AAGA,IAAI;AACJ,SAAS,SAAS;CAChB,IAAI,SAAS,OAAO,OAAO,MAAM,IAAI,MAAM,oCAAoC;CAC/E,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,aAAa,mBAAmB,UAAU;CACnG,OAAO;AACT;AACA,IAAI,QAAQ,OAAO,OAAO;CACxB,8BAA8B,WAAW;EACvC,OAAO,OAAO,CAAC,CAAC,6BAA6B,CAAC,CAAC,MAAM,kBAAkB;CACzE;CACA,4BAA4B,WAAW;EACrC,OAAO,OAAO,CAAC,CAAC,2BAA2B,CAAC,CAAC,MAAM,kBAAkB;CACvE;CACA,MAAM,SAAS,KAAK;EAClB,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,kBAAkB;CACpD;CACA,mBAAmB,WAAW;EAC5B,OAAO,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,kBAAkB;CAC9D;CACA,OAAO,WAAW;EAChB,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,kBAAkB;CAClD;CACA,QAAQ,WAAW;EACjB,OAAO,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,kBAAkB;CACnD;CACA,MAAM,SAAS,YAAY;EACzB,OAAO,OAAO,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,MAAM,WAAW;EACf,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,kBAAkB;CACjD;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,oBAAoB,WAAW;EAC7B,OAAO,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,kBAAkB;CAC/D;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,iBAAiB,WAAW;EAC1B,OAAO,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,MAAM,kBAAkB;CAC5D;CACA,eAAe,WAAW;EACxB,OAAO,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,kBAAkB;CAC1D;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/audio/index.native.js"],"sourcesContent":["import { Platform } from \"react-native\";\nimport { NitroModules } from \"react-native-nitro-modules\";\nimport { rethrowNativeError } from \"../nativeError\";\nvar hybrid;\nfunction native() {\n if (Platform.OS !== \"ios\") throw new Error(\"Audio requires an iOS native build\");\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject(\"OneAudio\");\n return hybrid;\n}\nvar Audio = Object.freeze({\n getRecordingPermissionStatus: function() {\n return native().getRecordingPermissionStatus().catch(rethrowNativeError);\n },\n requestRecordingPermission: function() {\n return native().requestRecordingPermission().catch(rethrowNativeError);\n },\n play: function(uri) {\n return native().play(uri).catch(rethrowNativeError);\n },\n getPlaybackStatus: function() {\n return native().getPlaybackStatus().catch(rethrowNativeError);\n },\n pause: function() {\n return native().pause().catch(rethrowNativeError);\n },\n resume: function() {\n return native().resume().catch(rethrowNativeError);\n },\n seek: function(positionMs) {\n return native().seek(positionMs).catch(rethrowNativeError);\n },\n stop: function() {\n return native().stop().catch(rethrowNativeError);\n },\n startRecording: function() {\n return native().startRecording().catch(rethrowNativeError);\n },\n getRecordingStatus: function() {\n return native().getRecordingStatus().catch(rethrowNativeError);\n },\n pauseRecording: function() {\n return native().pauseRecording().catch(rethrowNativeError);\n },\n resumeRecording: function() {\n return native().resumeRecording().catch(rethrowNativeError);\n },\n stopRecording: function() {\n return native().stopRecording().catch(rethrowNativeError);\n },\n watchInterruptions: function(onEvent) {\n if (typeof onEvent !== \"function\") {\n throw new TypeError(\"Audio.watchInterruptions: onEvent must be a function\");\n }\n return native().addInterruptionListener(onEvent);\n }\n});\nexport {\n Audio\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;;AAGA,IAAI;AACJ,SAAS,SAAS;CAChB,IAAI,SAAS,OAAO,OAAO,MAAM,IAAI,MAAM,oCAAoC;CAC/E,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,aAAa,mBAAmB,UAAU;CACnG,OAAO;AACT;AACA,IAAI,QAAQ,OAAO,OAAO;CACxB,8BAA8B,WAAW;EACvC,OAAO,OAAO,CAAC,CAAC,6BAA6B,CAAC,CAAC,MAAM,kBAAkB;CACzE;CACA,4BAA4B,WAAW;EACrC,OAAO,OAAO,CAAC,CAAC,2BAA2B,CAAC,CAAC,MAAM,kBAAkB;CACvE;CACA,MAAM,SAAS,KAAK;EAClB,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,kBAAkB;CACpD;CACA,mBAAmB,WAAW;EAC5B,OAAO,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,kBAAkB;CAC9D;CACA,OAAO,WAAW;EAChB,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,kBAAkB;CAClD;CACA,QAAQ,WAAW;EACjB,OAAO,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,kBAAkB;CACnD;CACA,MAAM,SAAS,YAAY;EACzB,OAAO,OAAO,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,MAAM,WAAW;EACf,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,kBAAkB;CACjD;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,oBAAoB,WAAW;EAC7B,OAAO,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,MAAM,kBAAkB;CAC/D;CACA,gBAAgB,WAAW;EACzB,OAAO,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,MAAM,kBAAkB;CAC3D;CACA,iBAAiB,WAAW;EAC1B,OAAO,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,MAAM,kBAAkB;CAC5D;CACA,eAAe,WAAW;EACxB,OAAO,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,kBAAkB;CAC1D;CACA,oBAAoB,SAAS,SAAS;EACpC,IAAI,OAAO,YAAY,YAAY;GACjC,MAAM,IAAI,UAAU,sDAAsD;EAC5E;EACA,OAAO,OAAO,CAAC,CAAC,wBAAwB,OAAO;CACjD;AACF,CAAC"}
|
|
@@ -34,19 +34,17 @@ function SafeAreaProvider({ children, initialMetrics, initialSafeAreaInsets, ...
|
|
|
34
34
|
frame: nextFrame
|
|
35
35
|
}, tamaguiHooks);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return curInsets;
|
|
49
|
-
});
|
|
37
|
+
setFrame((curFrame) => {
|
|
38
|
+
if (nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)) {
|
|
39
|
+
return nextFrame;
|
|
40
|
+
}
|
|
41
|
+
return curFrame;
|
|
42
|
+
});
|
|
43
|
+
setInsets((curInsets) => {
|
|
44
|
+
if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {
|
|
45
|
+
return nextInsets;
|
|
46
|
+
}
|
|
47
|
+
return curInsets;
|
|
50
48
|
});
|
|
51
49
|
}, [isRoot]);
|
|
52
50
|
return /* @__PURE__ */ jsx(NativeSafeAreaProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaContext.js","names":[],"sources":["esm/safe-area-context/SafeAreaContext.js"],"sourcesContent":["import * as React from \"react\";\nimport { NativeSafeAreaProvider } from \"./NativeSafeAreaProvider\";\nimport { getWindowFrame } from \"./getWindowFrame\";\nimport { initialWindowMetrics } from \"./InitialWindow\";\nimport { feedTamaguiSafeArea } from \"./tamaguiSafeArea\";\nimport { jsx } from \"react/jsx-runtime\";\nconst isDev = process.env.NODE_ENV !== \"production\";\nconst SafeAreaInsetsContext = React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nconst SafeAreaFrameContext = React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nconst ZERO_INSETS = { top: 0, bottom: 0, left: 0, right: 0 };\nfunction SafeAreaProvider({\n children,\n initialMetrics,\n initialSafeAreaInsets,\n ...others\n}) {\n const parentInsets = useParentSafeAreaInsets();\n const parentFrame = useParentSafeAreaFrame();\n const isRoot = parentInsets === null;\n const [insets, setInsets] = React.useState(\n initialMetrics?.insets ?? initialSafeAreaInsets ?? parentInsets ?? ZERO_INSETS\n );\n const [frame, setFrame] = React.useState(\n initialMetrics?.frame ?? parentFrame ?? // backwards compat so we render anyway if we don't have frame.\n getWindowFrame()\n );\n const onInsetsChange = React.useCallback((event) => {\n
|
|
1
|
+
{"version":3,"file":"SafeAreaContext.js","names":[],"sources":["esm/safe-area-context/SafeAreaContext.js"],"sourcesContent":["import * as React from \"react\";\nimport { NativeSafeAreaProvider } from \"./NativeSafeAreaProvider\";\nimport { getWindowFrame } from \"./getWindowFrame\";\nimport { initialWindowMetrics } from \"./InitialWindow\";\nimport { feedTamaguiSafeArea } from \"./tamaguiSafeArea\";\nimport { jsx } from \"react/jsx-runtime\";\nconst isDev = process.env.NODE_ENV !== \"production\";\nconst SafeAreaInsetsContext = React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nconst SafeAreaFrameContext = React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nconst ZERO_INSETS = { top: 0, bottom: 0, left: 0, right: 0 };\nfunction SafeAreaProvider({\n children,\n initialMetrics,\n initialSafeAreaInsets,\n ...others\n}) {\n const parentInsets = useParentSafeAreaInsets();\n const parentFrame = useParentSafeAreaFrame();\n const isRoot = parentInsets === null;\n const [insets, setInsets] = React.useState(\n initialMetrics?.insets ?? initialSafeAreaInsets ?? parentInsets ?? ZERO_INSETS\n );\n const [frame, setFrame] = React.useState(\n initialMetrics?.frame ?? parentFrame ?? // backwards compat so we render anyway if we don't have frame.\n getWindowFrame()\n );\n const onInsetsChange = React.useCallback(\n (event) => {\n const {\n nativeEvent: { frame: nextFrame, insets: nextInsets }\n } = event;\n if (isRoot && nextFrame) {\n feedTamaguiSafeArea({ insets: nextInsets, frame: nextFrame }, tamaguiHooks);\n }\n setFrame((curFrame) => {\n if (\n // Backwards compat with old native code that won't send frame.\n nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)\n ) {\n return nextFrame;\n }\n return curFrame;\n });\n setInsets((curInsets) => {\n if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {\n return nextInsets;\n }\n return curInsets;\n });\n },\n [isRoot]\n );\n return /* @__PURE__ */ jsx(NativeSafeAreaProvider, { onInsetsChange, ...others, children: /* @__PURE__ */ jsx(SafeAreaFrameContext.Provider, { value: frame, children: /* @__PURE__ */ jsx(SafeAreaInsetsContext.Provider, { value: insets, children }) }) });\n}\nfunction useParentSafeAreaInsets() {\n return React.useContext(SafeAreaInsetsContext);\n}\nfunction useParentSafeAreaFrame() {\n return React.useContext(SafeAreaFrameContext);\n}\nconst NO_INSETS_ERROR = \"No safe area value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.\";\nfunction useSafeAreaInsets() {\n const insets = React.useContext(SafeAreaInsetsContext);\n if (insets == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return insets;\n}\nfunction useSafeAreaFrame() {\n const frame = React.useContext(SafeAreaFrameContext);\n if (frame == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return frame;\n}\nfunction withSafeAreaInsets(WrappedComponent) {\n return React.forwardRef((props, ref) => {\n const insets = useSafeAreaInsets();\n return /* @__PURE__ */ jsx(WrappedComponent, { ...props, insets, ref });\n });\n}\nconst tamaguiHooks = { useSafeAreaInsets, useSafeAreaFrame };\nfeedTamaguiSafeArea(initialWindowMetrics, tamaguiHooks);\nfunction useSafeArea() {\n return useSafeAreaInsets();\n}\nconst SafeAreaConsumer = SafeAreaInsetsContext.Consumer;\nconst SafeAreaContext = SafeAreaInsetsContext;\nexport {\n SafeAreaConsumer,\n SafeAreaContext,\n SafeAreaFrameContext,\n SafeAreaInsetsContext,\n SafeAreaProvider,\n useSafeArea,\n useSafeAreaFrame,\n useSafeAreaInsets,\n withSafeAreaInsets\n};\n//# sourceMappingURL=SafeAreaContext.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AACvC,MAAM,wBAAwB,MAAM,cAAc,IAAI;AACtD,IAAI,OAAO;CACT,sBAAsB,cAAc;AACtC;AACA,MAAM,uBAAuB,MAAM,cAAc,IAAI;AACrD,IAAI,OAAO;CACT,qBAAqB,cAAc;AACrC;AACA,MAAM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,kBAAkB;AACxB,SAAS,oBAAoB;CAC3B,MAAM,SAAS,MAAM,WAAW,qBAAqB;CACrD,IAAI,UAAU,MAAM;EAClB,MAAM,IAAI,MAAM,eAAe;CACjC;CACA,OAAO;AACT;AACA,SAAS,mBAAmB;CAC1B,MAAM,QAAQ,MAAM,WAAW,oBAAoB;CACnD,IAAI,SAAS,MAAM;EACjB,MAAM,IAAI,MAAM,eAAe;CACjC;CACA,OAAO;AACT;AACA,SAAS,mBAAmB,kBAAkB;CAC5C,OAAO,MAAM,YAAY,OAAO,QAAQ;EACtC,MAAM,SAAS,kBAAkB;EACjC,OAAuB,oBAAI,kBAAkB;GAAE,GAAG;GAAO;GAAQ;EAAI,CAAC;CACxE,CAAC;AACH;AACA,MAAM,eAAe;CAAE;CAAmB;AAAiB;AAC3D,oBAAoB,sBAAsB,YAAY;AACtD,SAAS,cAAc;CACrB,OAAO,kBAAkB;AAC3B;AACA,MAAM,mBAAmB,sBAAsB;AAC/C,MAAM,kBAAkB"}
|
|
@@ -36,19 +36,17 @@ function SafeAreaProvider(param) {
|
|
|
36
36
|
frame: nextFrame
|
|
37
37
|
}, tamaguiHooks);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return curInsets;
|
|
51
|
-
});
|
|
39
|
+
setFrame(function(curFrame) {
|
|
40
|
+
if (nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)) {
|
|
41
|
+
return nextFrame;
|
|
42
|
+
}
|
|
43
|
+
return curFrame;
|
|
44
|
+
});
|
|
45
|
+
setInsets(function(curInsets) {
|
|
46
|
+
if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {
|
|
47
|
+
return nextInsets;
|
|
48
|
+
}
|
|
49
|
+
return curInsets;
|
|
52
50
|
});
|
|
53
51
|
}, [isRoot]);
|
|
54
52
|
return /* @__PURE__ */ jsx(NativeSafeAreaProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaContext.native.js","names":[],"sources":["esm/safe-area-context/SafeAreaContext.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { NativeSafeAreaProvider } from \"./NativeSafeAreaProvider\";\nimport { getWindowFrame } from \"./getWindowFrame\";\nimport { initialWindowMetrics } from \"./InitialWindow\";\nimport { feedTamaguiSafeArea } from \"./tamaguiSafeArea\";\nvar isDev = process.env.NODE_ENV !== \"production\";\nvar SafeAreaInsetsContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nvar SafeAreaFrameContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nvar ZERO_INSETS = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n};\nfunction SafeAreaProvider(param) {\n var { children, initialMetrics, initialSafeAreaInsets, ...others } = param;\n var _ref, _ref1, _ref2, _ref3, _ref4;\n var parentInsets = useParentSafeAreaInsets();\n var parentFrame = useParentSafeAreaFrame();\n var isRoot = parentInsets === null;\n var [insets, setInsets] = React.useState((_ref = (_ref1 = (_ref2 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.insets) !== null && _ref2 !== void 0 ? _ref2 : initialSafeAreaInsets) !== null && _ref1 !== void 0 ? _ref1 : parentInsets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS);\n var [frame, setFrame] = React.useState((_ref3 = (_ref4 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.frame) !== null && _ref4 !== void 0 ? _ref4 : parentFrame) !== null && _ref3 !== void 0 ? _ref3 : (\n // backwards compat so we render anyway if we don't have frame.\n getWindowFrame()\n ));\n var onInsetsChange = React.useCallback(function(event) {\n var { nativeEvent: { frame: nextFrame, insets: nextInsets } } = event;\n if (isRoot && nextFrame) {\n feedTamaguiSafeArea({\n insets: nextInsets,\n frame: nextFrame\n }, tamaguiHooks);\n }\n
|
|
1
|
+
{"version":3,"file":"SafeAreaContext.native.js","names":[],"sources":["esm/safe-area-context/SafeAreaContext.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { NativeSafeAreaProvider } from \"./NativeSafeAreaProvider\";\nimport { getWindowFrame } from \"./getWindowFrame\";\nimport { initialWindowMetrics } from \"./InitialWindow\";\nimport { feedTamaguiSafeArea } from \"./tamaguiSafeArea\";\nvar isDev = process.env.NODE_ENV !== \"production\";\nvar SafeAreaInsetsContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaInsetsContext.displayName = \"SafeAreaInsetsContext\";\n}\nvar SafeAreaFrameContext = /* @__PURE__ */ React.createContext(null);\nif (isDev) {\n SafeAreaFrameContext.displayName = \"SafeAreaFrameContext\";\n}\nvar ZERO_INSETS = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n};\nfunction SafeAreaProvider(param) {\n var { children, initialMetrics, initialSafeAreaInsets, ...others } = param;\n var _ref, _ref1, _ref2, _ref3, _ref4;\n var parentInsets = useParentSafeAreaInsets();\n var parentFrame = useParentSafeAreaFrame();\n var isRoot = parentInsets === null;\n var [insets, setInsets] = React.useState((_ref = (_ref1 = (_ref2 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.insets) !== null && _ref2 !== void 0 ? _ref2 : initialSafeAreaInsets) !== null && _ref1 !== void 0 ? _ref1 : parentInsets) !== null && _ref !== void 0 ? _ref : ZERO_INSETS);\n var [frame, setFrame] = React.useState((_ref3 = (_ref4 = initialMetrics === null || initialMetrics === void 0 ? void 0 : initialMetrics.frame) !== null && _ref4 !== void 0 ? _ref4 : parentFrame) !== null && _ref3 !== void 0 ? _ref3 : (\n // backwards compat so we render anyway if we don't have frame.\n getWindowFrame()\n ));\n var onInsetsChange = React.useCallback(function(event) {\n var { nativeEvent: { frame: nextFrame, insets: nextInsets } } = event;\n if (isRoot && nextFrame) {\n feedTamaguiSafeArea({\n insets: nextInsets,\n frame: nextFrame\n }, tamaguiHooks);\n }\n setFrame(function(curFrame) {\n if (\n // Backwards compat with old native code that won't send frame.\n nextFrame && (nextFrame.height !== curFrame.height || nextFrame.width !== curFrame.width || nextFrame.x !== curFrame.x || nextFrame.y !== curFrame.y)\n ) {\n return nextFrame;\n }\n return curFrame;\n });\n setInsets(function(curInsets) {\n if (!curInsets || nextInsets.bottom !== curInsets.bottom || nextInsets.left !== curInsets.left || nextInsets.right !== curInsets.right || nextInsets.top !== curInsets.top) {\n return nextInsets;\n }\n return curInsets;\n });\n }, [\n isRoot\n ]);\n return /* @__PURE__ */ _jsx(NativeSafeAreaProvider, {\n onInsetsChange,\n ...others,\n children: /* @__PURE__ */ _jsx(SafeAreaFrameContext.Provider, {\n value: frame,\n children: /* @__PURE__ */ _jsx(SafeAreaInsetsContext.Provider, {\n value: insets,\n children\n })\n })\n });\n}\nfunction useParentSafeAreaInsets() {\n return React.useContext(SafeAreaInsetsContext);\n}\nfunction useParentSafeAreaFrame() {\n return React.useContext(SafeAreaFrameContext);\n}\nvar NO_INSETS_ERROR = \"No safe area value available. Make sure you are rendering `<SafeAreaProvider>` at the top of your app.\";\nfunction useSafeAreaInsets() {\n var insets = React.useContext(SafeAreaInsetsContext);\n if (insets == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return insets;\n}\nfunction useSafeAreaFrame() {\n var frame = React.useContext(SafeAreaFrameContext);\n if (frame == null) {\n throw new Error(NO_INSETS_ERROR);\n }\n return frame;\n}\nfunction withSafeAreaInsets(WrappedComponent) {\n return /* @__PURE__ */ React.forwardRef(function(props, ref) {\n var insets = useSafeAreaInsets();\n return /* @__PURE__ */ _jsx(WrappedComponent, {\n ...props,\n insets,\n ref\n });\n });\n}\nvar tamaguiHooks = {\n useSafeAreaInsets,\n useSafeAreaFrame\n};\nfeedTamaguiSafeArea(initialWindowMetrics, tamaguiHooks);\nfunction useSafeArea() {\n return useSafeAreaInsets();\n}\nvar SafeAreaConsumer = SafeAreaInsetsContext.Consumer;\nvar SafeAreaContext = SafeAreaInsetsContext;\nexport {\n SafeAreaConsumer,\n SafeAreaContext,\n SafeAreaFrameContext,\n SafeAreaInsetsContext,\n SafeAreaProvider,\n useSafeArea,\n useSafeAreaFrame,\n useSafeAreaInsets,\n withSafeAreaInsets\n};\n//# sourceMappingURL=SafeAreaContext.js.map\n"],"mappings":";;;;;;;;AAMA,IAAI,QAAQ,QAAQ,IAAI,aAAa;AACrC,IAAI,wBAAwC,sBAAM,cAAc,IAAI;AACpE,IAAI,OAAO;CACT,sBAAsB,cAAc;AACtC;AACA,IAAI,uBAAuC,sBAAM,cAAc,IAAI;AACnE,IAAI,OAAO;CACT,qBAAqB,cAAc;AACrC;AACA,IAAI,cAAc;CAChB,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AACA,SAAS,iBAAiB,OAAO;CAC/B,IAAI,EAAE,UAAU,gBAAgB,uBAAuB,GAAG,WAAW;CACrE,IAAI,MAAM,OAAO,OAAO,OAAO;CAC/B,IAAI,eAAe,wBAAwB;CAC3C,IAAI,cAAc,uBAAuB;CACzC,IAAI,SAAS,iBAAiB;CAC9B,IAAI,CAAC,QAAQ,aAAa,MAAM,UAAU,QAAQ,SAAS,QAAQ,mBAAmB,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe,YAAY,QAAQ,UAAU,KAAK,IAAI,QAAQ,2BAA2B,QAAQ,UAAU,KAAK,IAAI,QAAQ,kBAAkB,QAAQ,SAAS,KAAK,IAAI,OAAO,WAAW;CAC7T,IAAI,CAAC,OAAO,YAAY,MAAM,UAAU,SAAS,QAAQ,mBAAmB,Q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IAAI,SAAS,MAAM;EACjB,MAAM,IAAI,MAAM,eAAe;CACjC;CACA,OAAO;AACT;AACA,SAAS,mBAAmB,kBAAkB;CAC5C,OAAuB,sBAAM,WAAW,SAAS,OAAO,KAAK;EAC3D,IAAI,SAAS,kBAAkB;EAC/B,OAAuB,oBAAK,kBAAkB;GAC5C,GAAG;GACH;GACA;EACF,CAAC;CACH,CAAC;AACH;AACA,IAAI,eAAe;CACjB;CACA;AACF;AACA,oBAAoB,sBAAsB,YAAY;AACtD,SAAS,cAAc;CACrB,OAAO,kBAAkB;AAC3B;AACA,IAAI,mBAAmB,sBAAsB;AAC7C,IAAI,kBAAkB"}
|
|
@@ -33,9 +33,21 @@ final class HybridOneAudio: HybridOneAudioSpec {
|
|
|
33
33
|
private var playbackEnded = false
|
|
34
34
|
private var endObserver: NSObjectProtocol?
|
|
35
35
|
private var recorder: AVAudioRecorder?
|
|
36
|
+
private var interruptionListeners: [UUID: (AudioInterruptionEvent) -> Void] = [:]
|
|
37
|
+
private var interruptionObserver: NSObjectProtocol?
|
|
38
|
+
|
|
39
|
+
override init() {
|
|
40
|
+
super.init()
|
|
41
|
+
interruptionObserver = NotificationCenter.default.addObserver(
|
|
42
|
+
forName: AVAudioSession.interruptionNotification, object: nil, queue: .main
|
|
43
|
+
) { [weak self] note in
|
|
44
|
+
self?.handleInterruption(note)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
36
47
|
|
|
37
48
|
deinit {
|
|
38
49
|
if let endObserver { NotificationCenter.default.removeObserver(endObserver) }
|
|
50
|
+
if let interruptionObserver { NotificationCenter.default.removeObserver(interruptionObserver) }
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
func getRecordingPermissionStatus() throws -> Promise<AudioRecordingPermission> {
|
|
@@ -218,6 +230,38 @@ final class HybridOneAudio: HybridOneAudioSpec {
|
|
|
218
230
|
}
|
|
219
231
|
}
|
|
220
232
|
|
|
233
|
+
func addInterruptionListener(
|
|
234
|
+
onEvent: @escaping (AudioInterruptionEvent) -> Void
|
|
235
|
+
) throws -> () -> Void {
|
|
236
|
+
let id = UUID()
|
|
237
|
+
DispatchQueue.main.async {
|
|
238
|
+
self.interruptionListeners[id] = onEvent
|
|
239
|
+
}
|
|
240
|
+
return { [weak self] in
|
|
241
|
+
DispatchQueue.main.async {
|
|
242
|
+
guard let self else { return }
|
|
243
|
+
self.interruptionListeners.removeValue(forKey: id)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
private func handleInterruption(_ note: Notification) {
|
|
249
|
+
guard let raw = note.userInfo?[AVAudioSessionInterruptionTypeKey] as? UInt,
|
|
250
|
+
let kind = AVAudioSession.InterruptionType(rawValue: raw)
|
|
251
|
+
else { return }
|
|
252
|
+
if kind == .began {
|
|
253
|
+
player?.pause()
|
|
254
|
+
if player != nil { playbackPaused = true }
|
|
255
|
+
recorder?.pause()
|
|
256
|
+
}
|
|
257
|
+
let options = AVAudioSession.InterruptionOptions(
|
|
258
|
+
rawValue: note.userInfo?[AVAudioSessionInterruptionOptionKey] as? UInt ?? 0)
|
|
259
|
+
let event = AudioInterruptionEvent(
|
|
260
|
+
type: kind == .began ? .began : .ended,
|
|
261
|
+
shouldResume: kind == .ended && options.contains(.shouldResume))
|
|
262
|
+
for listener in Array(interruptionListeners.values) { listener(event) }
|
|
263
|
+
}
|
|
264
|
+
|
|
221
265
|
private func playbackStatus() -> AudioPlaybackStatus {
|
|
222
266
|
guard let player, let item = player.currentItem else {
|
|
223
267
|
return AudioPlaybackStatus(
|
|
@@ -195,6 +195,14 @@ namespace margelo::nitro::one::bridge::swift {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
// pragma MARK: std::function<void(const AudioInterruptionEvent& /* event */)>
|
|
199
|
+
Func_void_AudioInterruptionEvent create_Func_void_AudioInterruptionEvent(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
200
|
+
auto swiftClosure = One::Func_void_AudioInterruptionEvent::fromUnsafe(swiftClosureWrapper);
|
|
201
|
+
return [swiftClosure = std::move(swiftClosure)](const AudioInterruptionEvent& event) mutable -> void {
|
|
202
|
+
swiftClosure.call(event);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
198
206
|
// pragma MARK: std::shared_ptr<HybridOneAudioSpec>
|
|
199
207
|
std::shared_ptr<HybridOneAudioSpec> create_std__shared_ptr_HybridOneAudioSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
200
208
|
One::HybridOneAudioSpec_cxx swiftPart = One::HybridOneAudioSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -26,6 +26,10 @@ namespace margelo::nitro::one { enum class AppleCredentialState; }
|
|
|
26
26
|
namespace margelo::nitro::one { enum class AppleRealUserStatus; }
|
|
27
27
|
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
28
28
|
namespace NitroModules { class ArrayBufferHolder; }
|
|
29
|
+
// Forward declaration of `AudioInterruptionEvent` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::one { struct AudioInterruptionEvent; }
|
|
31
|
+
// Forward declaration of `AudioInterruptionType` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::one { enum class AudioInterruptionType; }
|
|
29
33
|
// Forward declaration of `AudioPlaybackState` to properly resolve imports.
|
|
30
34
|
namespace margelo::nitro::one { enum class AudioPlaybackState; }
|
|
31
35
|
// Forward declaration of `AudioPlaybackStatus` to properly resolve imports.
|
|
@@ -302,6 +306,8 @@ namespace One { class HybridOneUpdatesSpec_cxx; }
|
|
|
302
306
|
#include "AppleAuthScope.hpp"
|
|
303
307
|
#include "AppleCredentialState.hpp"
|
|
304
308
|
#include "AppleRealUserStatus.hpp"
|
|
309
|
+
#include "AudioInterruptionEvent.hpp"
|
|
310
|
+
#include "AudioInterruptionType.hpp"
|
|
305
311
|
#include "AudioPlaybackState.hpp"
|
|
306
312
|
#include "AudioPlaybackStatus.hpp"
|
|
307
313
|
#include "AudioRecordingPermission.hpp"
|
|
@@ -1024,6 +1030,28 @@ namespace margelo::nitro::one::bridge::swift {
|
|
|
1024
1030
|
return Func_void_AudioRecordingResult_Wrapper(std::move(value));
|
|
1025
1031
|
}
|
|
1026
1032
|
|
|
1033
|
+
// pragma MARK: std::function<void(const AudioInterruptionEvent& /* event */)>
|
|
1034
|
+
/**
|
|
1035
|
+
* Specialized version of `std::function<void(const AudioInterruptionEvent&)>`.
|
|
1036
|
+
*/
|
|
1037
|
+
using Func_void_AudioInterruptionEvent = std::function<void(const AudioInterruptionEvent& /* event */)>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Wrapper class for a `std::function<void(const AudioInterruptionEvent& / * event * /)>`, this can be used from Swift.
|
|
1040
|
+
*/
|
|
1041
|
+
class Func_void_AudioInterruptionEvent_Wrapper final {
|
|
1042
|
+
public:
|
|
1043
|
+
explicit Func_void_AudioInterruptionEvent_Wrapper(std::function<void(const AudioInterruptionEvent& /* event */)>&& func): _function(std::make_unique<std::function<void(const AudioInterruptionEvent& /* event */)>>(std::move(func))) {}
|
|
1044
|
+
inline void call(AudioInterruptionEvent event) const noexcept {
|
|
1045
|
+
_function->operator()(event);
|
|
1046
|
+
}
|
|
1047
|
+
private:
|
|
1048
|
+
std::unique_ptr<std::function<void(const AudioInterruptionEvent& /* event */)>> _function;
|
|
1049
|
+
} SWIFT_NONCOPYABLE;
|
|
1050
|
+
Func_void_AudioInterruptionEvent create_Func_void_AudioInterruptionEvent(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
1051
|
+
inline Func_void_AudioInterruptionEvent_Wrapper wrap_Func_void_AudioInterruptionEvent(Func_void_AudioInterruptionEvent value) noexcept {
|
|
1052
|
+
return Func_void_AudioInterruptionEvent_Wrapper(std::move(value));
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1027
1055
|
// pragma MARK: std::shared_ptr<HybridOneAudioSpec>
|
|
1028
1056
|
/**
|
|
1029
1057
|
* Specialized version of `std::shared_ptr<HybridOneAudioSpec>`.
|
|
@@ -26,6 +26,10 @@ namespace margelo::nitro::one { struct AppleAuthSignInOptions; }
|
|
|
26
26
|
namespace margelo::nitro::one { enum class AppleCredentialState; }
|
|
27
27
|
// Forward declaration of `AppleRealUserStatus` to properly resolve imports.
|
|
28
28
|
namespace margelo::nitro::one { enum class AppleRealUserStatus; }
|
|
29
|
+
// Forward declaration of `AudioInterruptionEvent` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::one { struct AudioInterruptionEvent; }
|
|
31
|
+
// Forward declaration of `AudioInterruptionType` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::one { enum class AudioInterruptionType; }
|
|
29
33
|
// Forward declaration of `AudioPlaybackState` to properly resolve imports.
|
|
30
34
|
namespace margelo::nitro::one { enum class AudioPlaybackState; }
|
|
31
35
|
// Forward declaration of `AudioPlaybackStatus` to properly resolve imports.
|
|
@@ -285,6 +289,8 @@ namespace margelo::nitro::one { enum class UserInterfaceSizeClass; }
|
|
|
285
289
|
#include "AppleAuthSignInOptions.hpp"
|
|
286
290
|
#include "AppleCredentialState.hpp"
|
|
287
291
|
#include "AppleRealUserStatus.hpp"
|
|
292
|
+
#include "AudioInterruptionEvent.hpp"
|
|
293
|
+
#include "AudioInterruptionType.hpp"
|
|
288
294
|
#include "AudioPlaybackState.hpp"
|
|
289
295
|
#include "AudioPlaybackStatus.hpp"
|
|
290
296
|
#include "AudioRecordingPermission.hpp"
|
|
@@ -24,6 +24,10 @@ namespace margelo::nitro::one { struct AudioRecordingStatus; }
|
|
|
24
24
|
namespace margelo::nitro::one { enum class AudioRecordingState; }
|
|
25
25
|
// Forward declaration of `AudioRecordingResult` to properly resolve imports.
|
|
26
26
|
namespace margelo::nitro::one { struct AudioRecordingResult; }
|
|
27
|
+
// Forward declaration of `AudioInterruptionEvent` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::one { struct AudioInterruptionEvent; }
|
|
29
|
+
// Forward declaration of `AudioInterruptionType` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::one { enum class AudioInterruptionType; }
|
|
27
31
|
|
|
28
32
|
#include "AudioRecordingPermission.hpp"
|
|
29
33
|
#include <NitroModules/Promise.hpp>
|
|
@@ -34,6 +38,9 @@ namespace margelo::nitro::one { struct AudioRecordingResult; }
|
|
|
34
38
|
#include "AudioRecordingStatus.hpp"
|
|
35
39
|
#include "AudioRecordingState.hpp"
|
|
36
40
|
#include "AudioRecordingResult.hpp"
|
|
41
|
+
#include <functional>
|
|
42
|
+
#include "AudioInterruptionEvent.hpp"
|
|
43
|
+
#include "AudioInterruptionType.hpp"
|
|
37
44
|
|
|
38
45
|
#include "One-Swift-Cxx-Umbrella.hpp"
|
|
39
46
|
|
|
@@ -189,6 +196,14 @@ namespace margelo::nitro::one {
|
|
|
189
196
|
auto __value = std::move(__result.value());
|
|
190
197
|
return __value;
|
|
191
198
|
}
|
|
199
|
+
inline std::function<void()> addInterruptionListener(const std::function<void(const AudioInterruptionEvent& /* event */)>& onEvent) override {
|
|
200
|
+
auto __result = _swiftPart.addInterruptionListener(onEvent);
|
|
201
|
+
if (__result.hasError()) [[unlikely]] {
|
|
202
|
+
std::rethrow_exception(__result.error());
|
|
203
|
+
}
|
|
204
|
+
auto __value = std::move(__result.value());
|
|
205
|
+
return __value;
|
|
206
|
+
}
|
|
192
207
|
|
|
193
208
|
private:
|
|
194
209
|
One::HybridOneAudioSpec_cxx _swiftPart;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AudioInterruptionEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `AudioInterruptionEvent`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias AudioInterruptionEvent = margelo.nitro.one.AudioInterruptionEvent
|
|
14
|
+
|
|
15
|
+
public extension AudioInterruptionEvent {
|
|
16
|
+
private typealias bridge = margelo.nitro.one.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `AudioInterruptionEvent`.
|
|
20
|
+
*/
|
|
21
|
+
init(type: AudioInterruptionType, shouldResume: Bool) {
|
|
22
|
+
self.init(type, shouldResume)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var type: AudioInterruptionType {
|
|
27
|
+
return self.__type
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var shouldResume: Bool {
|
|
32
|
+
return self.__shouldResume
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AudioInterruptionType.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `AudioInterruptionType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias AudioInterruptionType = margelo.nitro.one.AudioInterruptionType
|
|
12
|
+
|
|
13
|
+
public extension AudioInterruptionType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a AudioInterruptionType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "ended":
|
|
21
|
+
self = .ended
|
|
22
|
+
case "began":
|
|
23
|
+
self = .began
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this AudioInterruptionType represents.
|
|
31
|
+
*/
|
|
32
|
+
var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .ended:
|
|
35
|
+
return "ended"
|
|
36
|
+
case .began:
|
|
37
|
+
return "began"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_AudioInterruptionEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ event: AudioInterruptionEvent) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_AudioInterruptionEvent {
|
|
15
|
+
public typealias bridge = margelo.nitro.one.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ event: AudioInterruptionEvent) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ event: AudioInterruptionEvent) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(event: AudioInterruptionEvent) -> Void {
|
|
25
|
+
self.closure(event)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_AudioInterruptionEvent`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_AudioInterruptionEvent>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_AudioInterruptionEvent {
|
|
44
|
+
return Unmanaged<Func_void_AudioInterruptionEvent>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -26,6 +26,7 @@ public protocol HybridOneAudioSpec_protocol: HybridObject {
|
|
|
26
26
|
func pauseRecording() throws -> Promise<AudioRecordingStatus>
|
|
27
27
|
func resumeRecording() throws -> Promise<AudioRecordingStatus>
|
|
28
28
|
func stopRecording() throws -> Promise<AudioRecordingResult>
|
|
29
|
+
func addInterruptionListener(onEvent: @escaping (_ event: AudioInterruptionEvent) -> Void) throws -> () -> Void
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
public extension HybridOneAudioSpec_protocol {
|
|
@@ -370,4 +370,24 @@ open class HybridOneAudioSpec_cxx {
|
|
|
370
370
|
return bridge.create_Result_std__shared_ptr_Promise_AudioRecordingResult___(__exceptionPtr)
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
+
|
|
374
|
+
@inline(__always)
|
|
375
|
+
public final func addInterruptionListener(onEvent: bridge.Func_void_AudioInterruptionEvent) -> bridge.Result_std__function_void____ {
|
|
376
|
+
do {
|
|
377
|
+
let __result = try self.__implementation.addInterruptionListener(onEvent: { () -> (AudioInterruptionEvent) -> Void in
|
|
378
|
+
let __wrappedFunction = bridge.wrap_Func_void_AudioInterruptionEvent(onEvent)
|
|
379
|
+
return { (__event: AudioInterruptionEvent) -> Void in
|
|
380
|
+
__wrappedFunction.call(__event)
|
|
381
|
+
}
|
|
382
|
+
}())
|
|
383
|
+
let __resultCpp = { () -> bridge.Func_void in
|
|
384
|
+
let __closureWrapper = Func_void(__result)
|
|
385
|
+
return bridge.create_Func_void(__closureWrapper.toUnsafe())
|
|
386
|
+
}()
|
|
387
|
+
return bridge.create_Result_std__function_void____(__resultCpp)
|
|
388
|
+
} catch (let __error) {
|
|
389
|
+
let __exceptionPtr = __error.toCpp()
|
|
390
|
+
return bridge.create_Result_std__function_void____(__exceptionPtr)
|
|
391
|
+
}
|
|
392
|
+
}
|
|
373
393
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AudioInterruptionEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `AudioInterruptionType` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::one { enum class AudioInterruptionType; }
|
|
33
|
+
|
|
34
|
+
#include "AudioInterruptionType.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::one {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (AudioInterruptionEvent).
|
|
40
|
+
*/
|
|
41
|
+
struct AudioInterruptionEvent final {
|
|
42
|
+
public:
|
|
43
|
+
AudioInterruptionType type SWIFT_PRIVATE;
|
|
44
|
+
bool shouldResume SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
AudioInterruptionEvent() = default;
|
|
48
|
+
explicit AudioInterruptionEvent(AudioInterruptionType type, bool shouldResume): type(type), shouldResume(shouldResume) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const AudioInterruptionEvent& lhs, const AudioInterruptionEvent& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::one
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ AudioInterruptionEvent <> JS AudioInterruptionEvent (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::one::AudioInterruptionEvent> final {
|
|
61
|
+
static inline margelo::nitro::one::AudioInterruptionEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::one::AudioInterruptionEvent(
|
|
64
|
+
JSIConverter<margelo::nitro::one::AudioInterruptionType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
65
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldResume")))
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::AudioInterruptionEvent& arg) {
|
|
69
|
+
jsi::Object obj(runtime);
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::one::AudioInterruptionType>::toJSI(runtime, arg.type));
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "shouldResume"), JSIConverter<bool>::toJSI(runtime, arg.shouldResume));
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
74
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
75
|
+
if (!value.isObject()) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
jsi::Object obj = value.getObject(runtime);
|
|
79
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (!JSIConverter<margelo::nitro::one::AudioInterruptionType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
83
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldResume")))) return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AudioInterruptionType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::one {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (AudioInterruptionType).
|
|
30
|
+
*/
|
|
31
|
+
enum class AudioInterruptionType {
|
|
32
|
+
ENDED SWIFT_NAME(ended) = 0,
|
|
33
|
+
BEGAN SWIFT_NAME(began) = 1,
|
|
34
|
+
} CLOSED_ENUM;
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro::one
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro {
|
|
39
|
+
|
|
40
|
+
// C++ AudioInterruptionType <> JS AudioInterruptionType (union)
|
|
41
|
+
template <>
|
|
42
|
+
struct JSIConverter<margelo::nitro::one::AudioInterruptionType> final {
|
|
43
|
+
static inline margelo::nitro::one::AudioInterruptionType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
44
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
45
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
46
|
+
case hashString("ended"): return margelo::nitro::one::AudioInterruptionType::ENDED;
|
|
47
|
+
case hashString("began"): return margelo::nitro::one::AudioInterruptionType::BEGAN;
|
|
48
|
+
default: [[unlikely]]
|
|
49
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum AudioInterruptionType - invalid value!");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::one::AudioInterruptionType arg) {
|
|
53
|
+
switch (arg) {
|
|
54
|
+
case margelo::nitro::one::AudioInterruptionType::ENDED: return JSIConverter<std::string>::toJSI(runtime, "ended");
|
|
55
|
+
case margelo::nitro::one::AudioInterruptionType::BEGAN: return JSIConverter<std::string>::toJSI(runtime, "began");
|
|
56
|
+
default: [[unlikely]]
|
|
57
|
+
throw std::invalid_argument("Cannot convert AudioInterruptionType to JS - invalid value: "
|
|
58
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
62
|
+
if (!value.isString()) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
66
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
67
|
+
case hashString("ended"):
|
|
68
|
+
case hashString("began"):
|
|
69
|
+
return true;
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro
|
|
@@ -27,6 +27,7 @@ namespace margelo::nitro::one {
|
|
|
27
27
|
prototype.registerHybridMethod("pauseRecording", &HybridOneAudioSpec::pauseRecording);
|
|
28
28
|
prototype.registerHybridMethod("resumeRecording", &HybridOneAudioSpec::resumeRecording);
|
|
29
29
|
prototype.registerHybridMethod("stopRecording", &HybridOneAudioSpec::stopRecording);
|
|
30
|
+
prototype.registerHybridMethod("addInterruptionListener", &HybridOneAudioSpec::addInterruptionListener);
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -21,6 +21,8 @@ namespace margelo::nitro::one { struct AudioPlaybackStatus; }
|
|
|
21
21
|
namespace margelo::nitro::one { struct AudioRecordingStatus; }
|
|
22
22
|
// Forward declaration of `AudioRecordingResult` to properly resolve imports.
|
|
23
23
|
namespace margelo::nitro::one { struct AudioRecordingResult; }
|
|
24
|
+
// Forward declaration of `AudioInterruptionEvent` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::one { struct AudioInterruptionEvent; }
|
|
24
26
|
|
|
25
27
|
#include "AudioRecordingPermission.hpp"
|
|
26
28
|
#include <NitroModules/Promise.hpp>
|
|
@@ -28,6 +30,8 @@ namespace margelo::nitro::one { struct AudioRecordingResult; }
|
|
|
28
30
|
#include <string>
|
|
29
31
|
#include "AudioRecordingStatus.hpp"
|
|
30
32
|
#include "AudioRecordingResult.hpp"
|
|
33
|
+
#include <functional>
|
|
34
|
+
#include "AudioInterruptionEvent.hpp"
|
|
31
35
|
|
|
32
36
|
namespace margelo::nitro::one {
|
|
33
37
|
|
|
@@ -73,6 +77,7 @@ namespace margelo::nitro::one {
|
|
|
73
77
|
virtual std::shared_ptr<Promise<AudioRecordingStatus>> pauseRecording() = 0;
|
|
74
78
|
virtual std::shared_ptr<Promise<AudioRecordingStatus>> resumeRecording() = 0;
|
|
75
79
|
virtual std::shared_ptr<Promise<AudioRecordingResult>> stopRecording() = 0;
|
|
80
|
+
virtual std::function<void()> addInterruptionListener(const std::function<void(const AudioInterruptionEvent& /* event */)>& onEvent) = 0;
|
|
76
81
|
|
|
77
82
|
protected:
|
|
78
83
|
// Hybrid Setup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "one",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.135.1",
|
|
4
4
|
"description": "One is a React framework for web, iOS, and Android apps.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"sideEffects": [
|
|
@@ -208,18 +208,18 @@
|
|
|
208
208
|
"@react-navigation/native-stack": "8.0.0-alpha.52",
|
|
209
209
|
"@react-navigation/routers": "8.0.0-alpha.17",
|
|
210
210
|
"@ungap/structured-clone": "^1.2.0",
|
|
211
|
-
"@vxrn/color-scheme": "2.0.0-beta.
|
|
212
|
-
"@vxrn/compiler": "2.0.0-beta.
|
|
213
|
-
"@vxrn/resolve": "2.0.0-beta.
|
|
214
|
-
"@vxrn/tslib-lite": "2.0.0-beta.
|
|
215
|
-
"@vxrn/use-isomorphic-layout-effect": "2.0.0-beta.
|
|
216
|
-
"@vxrn/utils": "2.0.0-beta.
|
|
217
|
-
"@vxrn/vite-plugin-metro": "2.0.0-beta.
|
|
211
|
+
"@vxrn/color-scheme": "2.0.0-beta.135.1",
|
|
212
|
+
"@vxrn/compiler": "2.0.0-beta.135.1",
|
|
213
|
+
"@vxrn/resolve": "2.0.0-beta.135.1",
|
|
214
|
+
"@vxrn/tslib-lite": "2.0.0-beta.135.1",
|
|
215
|
+
"@vxrn/use-isomorphic-layout-effect": "2.0.0-beta.135.1",
|
|
216
|
+
"@vxrn/utils": "2.0.0-beta.135.1",
|
|
217
|
+
"@vxrn/vite-plugin-metro": "2.0.0-beta.135.1",
|
|
218
218
|
"babel-dead-code-elimination": "1.0.10",
|
|
219
219
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
220
220
|
"citty": "^0.1.6",
|
|
221
221
|
"core-js": "^3.38.1",
|
|
222
|
-
"create-vxrn": "2.0.0-beta.
|
|
222
|
+
"create-vxrn": "2.0.0-beta.135.1",
|
|
223
223
|
"escape-string-regexp": "^5.0.0",
|
|
224
224
|
"fast-deep-equal": "^3.1.3",
|
|
225
225
|
"fast-glob": "^3.3.3",
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"tsconfig-paths": "^4",
|
|
242
242
|
"use-latest-callback": "^0.2.3",
|
|
243
243
|
"vite": "^8.2.2",
|
|
244
|
-
"vxrn": "2.0.0-beta.
|
|
244
|
+
"vxrn": "2.0.0-beta.135.1",
|
|
245
245
|
"web-streams-polyfill": "^4.3.0",
|
|
246
246
|
"ws": "^8.21.0",
|
|
247
247
|
"xxhashjs": "^0.2.2"
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
AudioRecordingPermission,
|
|
7
7
|
AudioRecordingResult,
|
|
8
8
|
AudioRecordingStatus,
|
|
9
|
+
AudioInterruptionEvent,
|
|
9
10
|
OneAudio,
|
|
10
11
|
} from '../specs/OneAudio.nitro'
|
|
11
12
|
|
|
@@ -16,6 +17,8 @@ export type {
|
|
|
16
17
|
AudioRecordingResult,
|
|
17
18
|
AudioRecordingState,
|
|
18
19
|
AudioRecordingStatus,
|
|
20
|
+
AudioInterruptionEvent,
|
|
21
|
+
AudioInterruptionType,
|
|
19
22
|
} from '../specs/OneAudio.nitro'
|
|
20
23
|
|
|
21
24
|
let hybrid: OneAudio | undefined
|
|
@@ -50,4 +53,10 @@ export const Audio = Object.freeze({
|
|
|
50
53
|
native().resumeRecording().catch(rethrowNativeError),
|
|
51
54
|
stopRecording: (): Promise<AudioRecordingResult> =>
|
|
52
55
|
native().stopRecording().catch(rethrowNativeError),
|
|
56
|
+
watchInterruptions: (onEvent: (event: AudioInterruptionEvent) => void): (() => void) => {
|
|
57
|
+
if (typeof onEvent !== 'function') {
|
|
58
|
+
throw new TypeError('Audio.watchInterruptions: onEvent must be a function')
|
|
59
|
+
}
|
|
60
|
+
return native().addInterruptionListener(onEvent)
|
|
61
|
+
},
|
|
53
62
|
})
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
AudioRecordingPermission,
|
|
4
4
|
AudioRecordingResult,
|
|
5
5
|
AudioRecordingStatus,
|
|
6
|
+
AudioInterruptionEvent,
|
|
6
7
|
} from '../specs/OneAudio.nitro'
|
|
7
8
|
|
|
8
9
|
export type {
|
|
@@ -12,6 +13,8 @@ export type {
|
|
|
12
13
|
AudioRecordingResult,
|
|
13
14
|
AudioRecordingState,
|
|
14
15
|
AudioRecordingStatus,
|
|
16
|
+
AudioInterruptionEvent,
|
|
17
|
+
AudioInterruptionType,
|
|
15
18
|
} from '../specs/OneAudio.nitro'
|
|
16
19
|
|
|
17
20
|
function unavailable(): never {
|
|
@@ -32,4 +35,5 @@ export const Audio = Object.freeze({
|
|
|
32
35
|
pauseRecording: (): Promise<AudioRecordingStatus> => unavailable(),
|
|
33
36
|
resumeRecording: (): Promise<AudioRecordingStatus> => unavailable(),
|
|
34
37
|
stopRecording: (): Promise<AudioRecordingResult> => unavailable(),
|
|
38
|
+
watchInterruptions: (_onEvent: (event: AudioInterruptionEvent) => void): (() => void) => unavailable(),
|
|
35
39
|
})
|
|
@@ -24,6 +24,13 @@ export interface AudioRecordingResult {
|
|
|
24
24
|
size: number
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export type AudioInterruptionType = 'began' | 'ended'
|
|
28
|
+
|
|
29
|
+
export interface AudioInterruptionEvent {
|
|
30
|
+
type: AudioInterruptionType
|
|
31
|
+
shouldResume: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
export interface OneAudio extends HybridObject<{ ios: 'swift' }> {
|
|
28
35
|
getRecordingPermissionStatus(): Promise<AudioRecordingPermission>
|
|
29
36
|
requestRecordingPermission(): Promise<AudioRecordingPermission>
|
|
@@ -38,4 +45,5 @@ export interface OneAudio extends HybridObject<{ ios: 'swift' }> {
|
|
|
38
45
|
pauseRecording(): Promise<AudioRecordingStatus>
|
|
39
46
|
resumeRecording(): Promise<AudioRecordingStatus>
|
|
40
47
|
stopRecording(): Promise<AudioRecordingResult>
|
|
48
|
+
addInterruptionListener(onEvent: (event: AudioInterruptionEvent) => void): () => void
|
|
41
49
|
}
|
|
@@ -51,16 +51,18 @@ export function SafeAreaProvider({
|
|
|
51
51
|
// backwards compat so we render anyway if we don't have frame.
|
|
52
52
|
getWindowFrame()
|
|
53
53
|
)
|
|
54
|
-
const onInsetsChange = React.useCallback(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
const onInsetsChange = React.useCallback(
|
|
55
|
+
(event: InsetChangedEvent) => {
|
|
56
|
+
const {
|
|
57
|
+
nativeEvent: { frame: nextFrame, insets: nextInsets },
|
|
58
|
+
} = event
|
|
59
|
+
|
|
60
|
+
if (isRoot && nextFrame) {
|
|
61
|
+
feedTamaguiSafeArea({ insets: nextInsets, frame: nextFrame }, tamaguiHooks)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// urgent, as upstream: a transition here stalls behind the urgent renders a
|
|
65
|
+
// rotation or fold keeps making, so the new window renders with the old insets.
|
|
64
66
|
setFrame((curFrame) => {
|
|
65
67
|
if (
|
|
66
68
|
// Backwards compat with old native code that won't send frame.
|
|
@@ -87,8 +89,9 @@ export function SafeAreaProvider({
|
|
|
87
89
|
}
|
|
88
90
|
return curInsets
|
|
89
91
|
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
+
},
|
|
93
|
+
[isRoot]
|
|
94
|
+
)
|
|
92
95
|
|
|
93
96
|
return (
|
|
94
97
|
<NativeSafeAreaProvider onInsetsChange={onInsetsChange} {...others}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingStatus } from '../specs/OneAudio.nitro';
|
|
2
|
-
export type { AudioPlaybackState, AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingState, AudioRecordingStatus, } from '../specs/OneAudio.nitro';
|
|
1
|
+
import type { AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingStatus, AudioInterruptionEvent } from '../specs/OneAudio.nitro';
|
|
2
|
+
export type { AudioPlaybackState, AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingState, AudioRecordingStatus, AudioInterruptionEvent, AudioInterruptionType, } from '../specs/OneAudio.nitro';
|
|
3
3
|
export declare const Audio: Readonly<{
|
|
4
4
|
getRecordingPermissionStatus: () => Promise<AudioRecordingPermission>;
|
|
5
5
|
requestRecordingPermission: () => Promise<AudioRecordingPermission>;
|
|
@@ -14,5 +14,6 @@ export declare const Audio: Readonly<{
|
|
|
14
14
|
pauseRecording: () => Promise<AudioRecordingStatus>;
|
|
15
15
|
resumeRecording: () => Promise<AudioRecordingStatus>;
|
|
16
16
|
stopRecording: () => Promise<AudioRecordingResult>;
|
|
17
|
+
watchInterruptions: (_onEvent: (event: AudioInterruptionEvent) => void) => (() => void);
|
|
17
18
|
}>;
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAA;AAMhC,eAAO,MAAM,KAAK;wCACkB,OAAO,CAAC,wBAAwB,CAAC;sCACnC,OAAO,CAAC,wBAAwB,CAAC;iBACpD,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAAC;6BAC3B,OAAO,CAAC,mBAAmB,CAAC;iBACxC,OAAO,CAAC,mBAAmB,CAAC;kBAC3B,OAAO,CAAC,mBAAmB,CAAC;wBACpB,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAAC;gBAC/C,OAAO,CAAC,IAAI,CAAC;0BACH,OAAO,CAAC,oBAAoB,CAAC;8BACzB,OAAO,CAAC,oBAAoB,CAAC;0BACjC,OAAO,CAAC,oBAAoB,CAAC;2BAC5B,OAAO,CAAC,oBAAoB,CAAC;yBAC/B,OAAO,CAAC,oBAAoB,CAAC;mCACjB,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;EACrF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingStatus } from '../specs/OneAudio.nitro';
|
|
2
|
-
export type { AudioPlaybackState, AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingState, AudioRecordingStatus, } from '../specs/OneAudio.nitro';
|
|
1
|
+
import type { AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingStatus, AudioInterruptionEvent } from '../specs/OneAudio.nitro';
|
|
2
|
+
export type { AudioPlaybackState, AudioPlaybackStatus, AudioRecordingPermission, AudioRecordingResult, AudioRecordingState, AudioRecordingStatus, AudioInterruptionEvent, AudioInterruptionType, } from '../specs/OneAudio.nitro';
|
|
3
3
|
export declare const Audio: Readonly<{
|
|
4
4
|
getRecordingPermissionStatus: () => Promise<AudioRecordingPermission>;
|
|
5
5
|
requestRecordingPermission: () => Promise<AudioRecordingPermission>;
|
|
@@ -14,5 +14,6 @@ export declare const Audio: Readonly<{
|
|
|
14
14
|
pauseRecording: () => Promise<AudioRecordingStatus>;
|
|
15
15
|
resumeRecording: () => Promise<AudioRecordingStatus>;
|
|
16
16
|
stopRecording: () => Promise<AudioRecordingResult>;
|
|
17
|
+
watchInterruptions: (onEvent: (event: AudioInterruptionEvent) => void) => (() => void);
|
|
17
18
|
}>;
|
|
18
19
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/platform/audio/index.native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/platform/audio/index.native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAA;AAUhC,eAAO,MAAM,KAAK;wCACkB,OAAO,CAAC,wBAAwB,CAAC;sCAEnC,OAAO,CAAC,wBAAwB,CAAC;gBAErD,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAAC;6BAE1B,OAAO,CAAC,mBAAmB,CAAC;iBAExC,OAAO,CAAC,mBAAmB,CAAC;kBAC3B,OAAO,CAAC,mBAAmB,CAAC;uBACrB,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAAC;gBAE9C,OAAO,CAAC,IAAI,CAAC;0BACH,OAAO,CAAC,oBAAoB,CAAC;8BAEzB,OAAO,CAAC,oBAAoB,CAAC;0BAEjC,OAAO,CAAC,oBAAoB,CAAC;2BAE5B,OAAO,CAAC,oBAAoB,CAAC;yBAE/B,OAAO,CAAC,oBAAoB,CAAC;kCAElB,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;EAMpF,CAAA"}
|
|
@@ -19,6 +19,11 @@ export interface AudioRecordingResult {
|
|
|
19
19
|
durationMs: number;
|
|
20
20
|
size: number;
|
|
21
21
|
}
|
|
22
|
+
export type AudioInterruptionType = 'began' | 'ended';
|
|
23
|
+
export interface AudioInterruptionEvent {
|
|
24
|
+
type: AudioInterruptionType;
|
|
25
|
+
shouldResume: boolean;
|
|
26
|
+
}
|
|
22
27
|
export interface OneAudio extends HybridObject<{
|
|
23
28
|
ios: 'swift';
|
|
24
29
|
}> {
|
|
@@ -35,5 +40,6 @@ export interface OneAudio extends HybridObject<{
|
|
|
35
40
|
pauseRecording(): Promise<AudioRecordingStatus>;
|
|
36
41
|
resumeRecording(): Promise<AudioRecordingStatus>;
|
|
37
42
|
stopRecording(): Promise<AudioRecordingResult>;
|
|
43
|
+
addInterruptionListener(onEvent: (event: AudioInterruptionEvent) => void): () => void;
|
|
38
44
|
}
|
|
39
45
|
//# sourceMappingURL=OneAudio.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneAudio.nitro.d.ts","sourceRoot":"","sources":["../../../src/platform/specs/OneAudio.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAA;AAC5E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;AAC/F,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,kBAAkB,CAAA;IACzB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,mBAAmB,CAAA;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAS,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;IAC9D,4BAA4B,IAAI,OAAO,CAAC,wBAA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OAAO,CAAC,oBAAoB,CAAC,CAAA;IAC9C,uBAAuB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CACtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaContext.d.ts","sourceRoot":"","sources":["../../src/safe-area-context/SafeAreaContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,UAAU,EAAqB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAIpF,eAAO,MAAM,qBAAqB,kCAA+C,CAAA;AAKjF,eAAO,MAAM,oBAAoB,4BAAyC,CAAA;AAK1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC/B;;OAEG;IACH,qBAAqB,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;CAC1C;AAID,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,qBAAqB,EACrB,GAAG,MAAM,EACV,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"SafeAreaContext.d.ts","sourceRoot":"","sources":["../../src/safe-area-context/SafeAreaContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,UAAU,EAAqB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAIpF,eAAO,MAAM,qBAAqB,kCAA+C,CAAA;AAKjF,eAAO,MAAM,oBAAoB,4BAAyC,CAAA;AAK1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC/B;;OAEG;IACH,qBAAqB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