diff --git a/packages/expo-dev-launcher/android/src/debug/assets/expo_dev_launcher_android.bundle b/packages/expo-dev-launcher/android/src/debug/assets/expo_dev_launcher_android.bundle index 7e7b24cd74372..5d7af50e462a6 100644 --- a/packages/expo-dev-launcher/android/src/debug/assets/expo_dev_launcher_android.bundle +++ b/packages/expo-dev-launcher/android/src/debug/assets/expo_dev_launcher_android.bundle @@ -644,7 +644,7 @@ __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0});va __d((function(g,_r,_i,_a,m,_e,d){var e=_r(d[0]);Object.defineProperty(_e,"__esModule",{value:!0}),_e.SafeAreaInsetsContext=_e.SafeAreaFrameContext=_e.SafeAreaContext=_e.SafeAreaConsumer=void 0,_e.SafeAreaProvider=function(e){var t,u,l,f,v,y=e.children,h=e.initialMetrics,b=e.initialSafeAreaInsets,O=e.style,w=n.useContext(s),S=n.useContext(c),j=n.useState(null!=(t=null!=(u=null!=(l=null==h?void 0:h.insets)?l:b)?u:w)?t:null),x=(0,r.default)(j,2),C=x[0],P=x[1],A=n.useState(null!=(f=null!=(v=null==h?void 0:h.frame)?v:S)?f:{x:0,y:0,width:a.Dimensions.get('window').width,height:a.Dimensions.get('window').height}),_=(0,r.default)(A,2),D=_[0],M=_[1],k=n.useCallback((function(e){var t=e.nativeEvent,r=t.frame,n=t.insets;!r||r.height===D.height&&r.width===D.width&&r.x===D.x&&r.y===D.y||M(r),C&&n.bottom===C.bottom&&n.left===C.left&&n.right===C.right&&n.top===C.top||P(n)}),[D,C]);return(0,i.jsx)(o.default,{style:[p.fill,O],onInsetsChange:k,children:null!=C?(0,i.jsx)(c.Provider,{value:D,children:(0,i.jsx)(s.Provider,{value:C,children:y})}):null})},_e.useSafeArea=function(){return v()},_e.useSafeAreaFrame=function(){var e=n.useContext(c);if(null==e)throw new Error('No safe area frame value available. Make sure you are rendering `` at the top of your app.');return e},_e.useSafeAreaInsets=v,_e.withSafeAreaInsets=function(e){return n.forwardRef((function(t,r){return(0,i.jsx)(y,{children:function(n){return(0,i.jsx)(e,f(f({},t),{},{insets:n,ref:r}))}})}))};var t=e(_r(d[1])),r=e(_r(d[2])),n=(function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n})(_r(d[3])),a=_r(d[4]),o=e(_r(d[5])),i=_r(d[6]);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var r=1;r` at the top of your app.');return e}var y=_e.SafeAreaConsumer=s.Consumer;_e.SafeAreaContext=s}),587,[22,41,53,107,2,588,240]); __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0]);e.default=(0,t.requireNativeViewManager)('RNCSafeAreaProvider')}),588,[589]); __d((function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0});var n={SyntheticPlatformEmitter:!0,DeviceEventEmitter:!0,EventEmitter:!0,NativeModulesProxy:!0,requireNativeViewManager:!0,Platform:!0,CodedError:!0,UnavailabilityError:!0,uuid:!0};Object.defineProperty(e,"CodedError",{enumerable:!0,get:function(){return b.CodedError}}),Object.defineProperty(e,"DeviceEventEmitter",{enumerable:!0,get:function(){return o.DeviceEventEmitter}}),Object.defineProperty(e,"EventEmitter",{enumerable:!0,get:function(){return u.EventEmitter}}),Object.defineProperty(e,"NativeModulesProxy",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"Platform",{enumerable:!0,get:function(){return l.default}}),e.SyntheticPlatformEmitter=void 0,Object.defineProperty(e,"UnavailabilityError",{enumerable:!0,get:function(){return y.UnavailabilityError}}),Object.defineProperty(e,"requireNativeViewManager",{enumerable:!0,get:function(){return f.requireNativeViewManager}}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return p.default}});var o=r(d[1]),u=r(d[2]),c=t(r(d[3])),f=r(d[4]),l=t(r(d[5])),b=r(d[6]),y=r(d[7]);r(d[8]),r(d[9]);var p=t(r(d[10])),v=r(d[11]);Object.keys(v).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===v[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return v[t]}}))}));var O=r(d[12]);Object.keys(O).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===O[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return O[t]}}))}));var E=r(d[13]);Object.keys(E).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===E[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return E[t]}}))}));var P=r(d[14]);Object.keys(P).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===P[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return P[t]}}))}));var j=r(d[15]);Object.keys(j).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===j[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return j[t]}}))}));e.SyntheticPlatformEmitter=o.DeviceEventEmitter}),589,[22,2,590,591,592,594,596,597,598,600,601,593,605,606,607,608]); -__d((function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.EventEmitter=void 0;var n=t(r(d[1])),s=t(r(d[2])),o=t(r(d[3])),v=t(r(d[4])),u=r(d[5]),l='@@nativeEmitterSubscription@@';e.EventEmitter=(function(){function t(n){(0,s.default)(this,t),this._listenerCount=0,n.__expo_module_name__&&u.NativeModules.EXReactNativeEventEmitter&&(n.addListener=function(){for(var t,s=arguments.length,o=new Array(s),v=0;v=0,"EventEmitter must have a non-negative number of listeners"),!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving()}},{key:"removeSubscription",value:function(t){var n=t[l];n&&('remove'in n&&n.remove(),this._listenerCount--,delete t[l],t.remove=function(){},!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving())}},{key:"emit",value:function(t){for(var n,s=arguments.length,o=new Array(s>1?s-1:0),v=1;v=0,"EventEmitter must have a non-negative number of listeners"),!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving()}},{key:"removeSubscription",value:function(t){var n=t[l];n&&('remove'in n&&n.remove(),this._listenerCount--,delete t[l],t.remove=function(){},!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving())}},{key:"emit",value:function(t){for(var n,s=arguments.length,o=new Array(s>1?s-1:0),v=1;v` at the top of your app.');return e},_e.useSafeAreaInsets=v,_e.withSafeAreaInsets=function(e){return n.forwardRef((function(t,r){return(0,i.jsx)(y,{children:function(n){return(0,i.jsx)(e,f(f({},t),{},{insets:n,ref:r}))}})}))};var t=e(_r(d[1])),r=e(_r(d[2])),n=(function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var i=a?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n})(_r(d[3])),a=_r(d[4]),o=e(_r(d[5])),i=_r(d[6]);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var r=1;r` at the top of your app.');return e}var y=_e.SafeAreaConsumer=s.Consumer;_e.SafeAreaContext=s}),585,[22,41,53,107,2,586,242]); __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=r(d[0]);e.default=(0,t.requireNativeViewManager)('RNCSafeAreaProvider')}),586,[587]); __d((function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0});var n={SyntheticPlatformEmitter:!0,DeviceEventEmitter:!0,EventEmitter:!0,NativeModulesProxy:!0,requireNativeViewManager:!0,Platform:!0,CodedError:!0,UnavailabilityError:!0,uuid:!0};Object.defineProperty(e,"CodedError",{enumerable:!0,get:function(){return b.CodedError}}),Object.defineProperty(e,"DeviceEventEmitter",{enumerable:!0,get:function(){return o.DeviceEventEmitter}}),Object.defineProperty(e,"EventEmitter",{enumerable:!0,get:function(){return u.EventEmitter}}),Object.defineProperty(e,"NativeModulesProxy",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"Platform",{enumerable:!0,get:function(){return l.default}}),e.SyntheticPlatformEmitter=void 0,Object.defineProperty(e,"UnavailabilityError",{enumerable:!0,get:function(){return y.UnavailabilityError}}),Object.defineProperty(e,"requireNativeViewManager",{enumerable:!0,get:function(){return f.requireNativeViewManager}}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return p.default}});var o=r(d[1]),u=r(d[2]),c=t(r(d[3])),f=r(d[4]),l=t(r(d[5])),b=r(d[6]),y=r(d[7]);r(d[8]),r(d[9]);var p=t(r(d[10])),v=r(d[11]);Object.keys(v).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===v[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return v[t]}}))}));var O=r(d[12]);Object.keys(O).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===O[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return O[t]}}))}));var E=r(d[13]);Object.keys(E).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===E[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return E[t]}}))}));var P=r(d[14]);Object.keys(P).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===P[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return P[t]}}))}));var j=r(d[15]);Object.keys(j).forEach((function(t){"default"!==t&&"__esModule"!==t&&(Object.prototype.hasOwnProperty.call(n,t)||t in e&&e[t]===j[t]||Object.defineProperty(e,t,{enumerable:!0,get:function(){return j[t]}}))}));e.SyntheticPlatformEmitter=o.DeviceEventEmitter}),587,[22,2,588,589,590,592,594,595,596,598,599,591,603,604,605,606]); -__d((function(g,r,i,a,m,e,d){var t=r(d[0]);Object.defineProperty(e,"__esModule",{value:!0}),e.EventEmitter=void 0;var n=t(r(d[1])),o=t(r(d[2])),s=t(r(d[3])),v=t(r(d[4])),u=r(d[5]),l='@@nativeEmitterSubscription@@';e.EventEmitter=(function(){function t(n){(0,o.default)(this,t),this._listenerCount=0,n.__expo_module_name__&&u.NativeModules.EXReactNativeEventEmitter&&(n.addListener=function(){for(var t,o=arguments.length,s=new Array(o),v=0;v=0,"EventEmitter must have a non-negative number of listeners"),this._listenerCount}},{key:"removeSubscription",value:function(t){var n=t[l];n&&('remove'in n&&n.remove(),this._listenerCount--,delete t[l],t.remove=function(){},this._listenerCount)}},{key:"emit",value:function(t){for(var n,o=arguments.length,s=new Array(o>1?o-1:0),v=1;v=0,"EventEmitter must have a non-negative number of listeners"),this._listenerCount}},{key:"removeSubscription",value:function(t){var n=t[l];n&&('remove'in n&&n.remove(),this._listenerCount--,delete t[l],t.remove=function(){},this._listenerCount)}},{key:"emit",value:function(t){for(var n,s=arguments.length,o=new Array(s>1?s-1:0),u=1;u {\n if (webOrientationLock === WebOrientationLock.UNKNOWN) {\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`\n );\n }\n if (screen.orientation && screen.orientation.lock) {\n await screen.orientation.lock(webOrientationLock);\n } else if (\n screen['lockOrientation'] ||\n screen['mozLockOrientation'] ||\n screen['msLockOrientation']\n ) {\n const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);\n const lockOrientation =\n screen['lockOrientation'] || screen['mozLockOrientation'] || screen['msLockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = lockOrientation.call(screen, legacyLock);\n if (!isSuccess) {\n throw new Error(\n `Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`\n );\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support locking screen orientation.`\n );\n }\n}\n\nlet _lastWebOrientationLock: WebOrientationLock = WebOrientationLock.UNKNOWN;\n\nexport default {\n async supportsOrientationLockAsync(orientationLock: OrientationLock): Promise {\n return orientationLock in OrientationLockAPIToWeb;\n },\n async getPlatformOrientationLockAsync(): Promise {\n return _lastWebOrientationLock;\n },\n async getOrientationAsync(): Promise {\n const webOrientation =\n screen['msOrientation'] || (screen.orientation || screen['mozOrientation'] || {}).type;\n if (!webOrientation) {\n return Orientation.UNKNOWN;\n }\n return OrientationWebToAPI[webOrientation];\n },\n async lockAsync(orientationLock: OrientationLock): Promise {\n const webOrientationLock = OrientationLockAPIToWeb[orientationLock];\n if (!webOrientationLock) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n await _lockAsync(webOrientationLock);\n },\n async lockPlatformAsync(webOrientationLock: WebOrientationLock): Promise {\n await _lockAsync(webOrientationLock);\n _lastWebOrientationLock = webOrientationLock;\n },\n async unlockAsync(): Promise {\n if (screen.orientation && screen.orientation.unlock) {\n screen.orientation.unlock();\n } else if (\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation']\n ) {\n const unlockOrientation =\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = unlockOrientation.call(screen);\n if (!isSuccess) {\n throw new Error(`Unlocking screen orientation on device was denied`);\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support unlocking screen orientation.`\n );\n }\n },\n};\n"]} \ No newline at end of file +{"version":3,"file":"ExpoScreenOrientation.web.js","sourceRoot":"","sources":["../src/ExpoScreenOrientation.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,MAAM,uBAAuB,GAEzB;IACF,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO;IACrD,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,GAAG;IAC7C,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,QAAQ;IACvD,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,gBAAgB;IAClE,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC,kBAAkB;IACtE,CAAC,eAAe,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;QAC9B,CAAC;aAAM,IACL,MAAM,CAAC,mBAAmB,CAAC;YAC3B,MAAM,CAAC,sBAAsB,CAAC;YAC9B,MAAM,CAAC,qBAAqB,CAAC,EAC7B,CAAC;YACD,MAAM,iBAAiB,GACrB,MAAM,CAAC,mBAAmB,CAAC;gBAC3B,MAAM,CAAC,sBAAsB,CAAC;gBAC9B,MAAM,CAAC,qBAAqB,CAAC,CAAC;YAChC,0FAA0F;YAC1F,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { DeviceEventEmitter, Platform } from 'expo-modules-core';\n\nimport { getOrientationLockAsync, getOrientationAsync } from './ScreenOrientation';\nimport {\n Orientation,\n OrientationLock,\n WebOrientationLock,\n WebOrientation,\n} from './ScreenOrientation.types';\n\nconst OrientationLockAPIToWeb: {\n [lock: string]: WebOrientationLock;\n} = {\n [OrientationLock.DEFAULT]: WebOrientationLock.NATURAL,\n [OrientationLock.ALL]: WebOrientationLock.ANY,\n [OrientationLock.PORTRAIT]: WebOrientationLock.PORTRAIT,\n [OrientationLock.PORTRAIT_UP]: WebOrientationLock.PORTRAIT_PRIMARY,\n [OrientationLock.PORTRAIT_DOWN]: WebOrientationLock.PORTRAIT_SECONDARY,\n [OrientationLock.LANDSCAPE]: WebOrientationLock.LANDSCAPE,\n [OrientationLock.LANDSCAPE_LEFT]: WebOrientationLock.LANDSCAPE_PRIMARY,\n [OrientationLock.LANDSCAPE_RIGHT]: WebOrientationLock.LANDSCAPE_SECONDARY,\n};\n\nconst OrientationWebToAPI: {\n [orientationWeb: string]: Orientation;\n} = {\n [WebOrientation.PORTRAIT_PRIMARY]: Orientation.PORTRAIT_UP,\n [WebOrientation.PORTRAIT_SECONDARY]: Orientation.PORTRAIT_DOWN,\n [WebOrientation.LANDSCAPE_PRIMARY]: Orientation.LANDSCAPE_LEFT,\n [WebOrientation.LANDSCAPE_SECONDARY]: Orientation.LANDSCAPE_RIGHT,\n};\n\ndeclare const window: Window;\n\nconst screen: Screen = Platform.canUseViewport ? window.screen : ({} as Screen);\nconst orientation: ScreenOrientation | null = Platform.canUseViewport\n ? screen.orientation || (screen as any).msOrientation || null\n : null;\n\nasync function emitOrientationEvent() {\n const [orientationLock, orientation] = await Promise.all([\n getOrientationLockAsync(),\n getOrientationAsync(),\n ]);\n DeviceEventEmitter.emit('expoDidUpdateDimensions', {\n orientationLock,\n orientationInfo: { orientation },\n });\n}\n\nif (Platform.canUseEventListeners) {\n if (orientation && orientation.addEventListener) {\n orientation.addEventListener('change', emitOrientationEvent);\n } else {\n window.addEventListener('orientationchange', emitOrientationEvent);\n }\n}\n\nfunction _convertToLegacyOrientationLock(orientationLock: WebOrientationLock): string | string[] {\n switch (orientationLock) {\n case WebOrientationLock.UNKNOWN:\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock to be converted.`\n );\n case WebOrientationLock.ANY:\n return ['portrait', 'landscape'];\n case WebOrientationLock.NATURAL:\n return 'default';\n default:\n return orientationLock;\n }\n}\n\nasync function _lockAsync(webOrientationLock: WebOrientationLock): Promise {\n if (webOrientationLock === WebOrientationLock.UNKNOWN) {\n throw new Error(\n `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.`\n );\n }\n // @ts-expect-error: This is missing in the TypeScript definitions\n if (screen.orientation && screen.orientation.lock) {\n // @ts-expect-error\n await screen.orientation.lock(webOrientationLock);\n } else if (\n screen['lockOrientation'] ||\n screen['mozLockOrientation'] ||\n screen['msLockOrientation']\n ) {\n const legacyLock = _convertToLegacyOrientationLock(webOrientationLock);\n const lockOrientation =\n screen['lockOrientation'] || screen['mozLockOrientation'] || screen['msLockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = lockOrientation.call(screen, legacyLock);\n if (!isSuccess) {\n throw new Error(\n `Applying orientation lock: ${JSON.stringify(webOrientationLock)} to device was denied`\n );\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support locking screen orientation.`\n );\n }\n}\n\nlet _lastWebOrientationLock: WebOrientationLock = WebOrientationLock.UNKNOWN;\n\nexport default {\n async supportsOrientationLockAsync(orientationLock: OrientationLock): Promise {\n return orientationLock in OrientationLockAPIToWeb;\n },\n async getPlatformOrientationLockAsync(): Promise {\n return _lastWebOrientationLock;\n },\n async getOrientationAsync(): Promise {\n const webOrientation =\n screen['msOrientation'] || (screen.orientation || screen['mozOrientation'] || {}).type;\n if (!webOrientation) {\n return Orientation.UNKNOWN;\n }\n return OrientationWebToAPI[webOrientation];\n },\n async lockAsync(orientationLock: OrientationLock): Promise {\n const webOrientationLock = OrientationLockAPIToWeb[orientationLock];\n if (!webOrientationLock) {\n throw new TypeError(`Invalid Orientation Lock: ${orientationLock}`);\n }\n await _lockAsync(webOrientationLock);\n },\n async lockPlatformAsync(webOrientationLock: WebOrientationLock): Promise {\n await _lockAsync(webOrientationLock);\n _lastWebOrientationLock = webOrientationLock;\n },\n async unlockAsync(): Promise {\n if (screen.orientation && screen.orientation.unlock) {\n screen.orientation.unlock();\n } else if (\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation']\n ) {\n const unlockOrientation =\n screen['unlockOrientation'] ||\n screen['mozUnlockOrientation'] ||\n screen['msUnlockOrientation'];\n // correct `this` context must be passed in otherwise method call is disallowed by browser\n const isSuccess = unlockOrientation.call(screen);\n if (!isSuccess) {\n throw new Error(`Unlocking screen orientation on device was denied`);\n }\n } else {\n throw new Error(\n `expo-screen-orientation: The browser doesn't support unlocking screen orientation.`\n );\n }\n },\n};\n"]} \ No newline at end of file diff --git a/packages/expo-screen-orientation/src/ExpoScreenOrientation.web.ts b/packages/expo-screen-orientation/src/ExpoScreenOrientation.web.ts index 48ce35d2ec0c0..ff3dcc68fb56a 100644 --- a/packages/expo-screen-orientation/src/ExpoScreenOrientation.web.ts +++ b/packages/expo-screen-orientation/src/ExpoScreenOrientation.web.ts @@ -77,7 +77,9 @@ async function _lockAsync(webOrientationLock: WebOrientationLock): Promise `expo-screen-orientation: WebOrientationLock.UNKNOWN is not a valid lock that can be applied to the device.` ); } + // @ts-expect-error: This is missing in the TypeScript definitions if (screen.orientation && screen.orientation.lock) { + // @ts-expect-error await screen.orientation.lock(webOrientationLock); } else if ( screen['lockOrientation'] || diff --git a/packages/expo-updates/build/Updates.js.map b/packages/expo-updates/build/Updates.js.map index d6faa0c8b146d..31e3086c1674e 100644 --- a/packages/expo-updates/build/Updates.js.map +++ b/packages/expo-updates/build/Updates.js.map @@ -1 +1 @@ -{"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,WAAW,MAAM,eAAe,CAAC;AAWxC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAY,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,WAAW,CAAC,QAAQ,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;IAC9D,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE;IACpC,CAAC,CAAC,IAAI,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB,WAAW,CAAC,cAAc,IAAI,IAAI,CAAC;AAEhF,MAAM,gCAAgC,GAAG;IACvC,MAAM,EAAE,SAAS;IACjB,m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AAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QACtF,OAAO,aAAa,CAAC,wBAAwB,CAAC;KAC/C;IACD,IAAI,aAAa,CAAC,4BAA4B,EAAE;QAC9C,aAAa,CAAC,sBAAsB,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;QAC5F,OAAO,aAAa,CAAC,4BAA4B,CAAC;KACnD;IACD,IAAI,aAAa,CAAC,cAAc,EAAE;QAChC,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAClE,OAAO,aAAa,CAAC,cAAc,CAAC;KACrC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,iCAAiC,EAAE,CAAC;IAC5E,OAAO,kCAAkC,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { CodedError } from 'expo-modules-core';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateFetchResult,\n UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * Whether expo-updates is enabled. This may be false in a variety of cases including:\n * - enabled set to false in configuration\n * - missing or invalid URL in configuration\n * - missing runtime version or SDK version in configuration\n * - error accessing storage on device during initialization\n *\n * When false, the embedded update is loaded.\n */\nexport const isEnabled: boolean = !!ExpoUpdates.isEnabled;\n\n/**\n * The UUID that uniquely identifies the currently running update. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.\n * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n/**\n * The channel name of the current build, if configured for use with EAS Update. `null` otherwise.\n *\n * Expo Go and development builds are not set to a specific channel and can run any updates compatible with their native runtime. Therefore, this value will always be `null` when running an update on Expo Go or a development build.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when expo-updates checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch;\n\n/**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\nexport const emergencyLaunchReason = ExpoUpdates.emergencyLaunchReason;\n\n/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\n/**\n * If `expo-updates` is enabled, this is the\n * [manifest](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\n * object for the update that's currently running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\nexport const manifest: Partial =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\n\n/**\n * During non-expo development we block accessing the updates API methods on the JS side, but when developing in\n * Expo Go or a development client build, the controllers should have control over which API methods should\n * be allowed.\n */\nconst shouldDeferToNativeForAPIMethodAvailabilityInDevelopment =\n !!ExpoUpdates.shouldDeferToNativeForAPIMethodAvailabilityInDevelopment;\n\n/**\n * Developer tool is set when a project is served by `expo start`.\n */\nconst isUsingDeveloperTool =\n 'extra' in manifest ? !!manifest.extra?.expoGo?.developer?.tool : false;\n\nconst manualUpdatesInstructions =\n 'To test usage of the expo-updates JS API in your app, make a release build with `npx expo run:ios --configuration Release` or ' +\n '`npx expo run:android --variant Release`.';\n\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the\n * app.\n *\n * It is not recommended to place any meaningful logic after a call to `await\n * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can\n * be reloaded, and immediately before posting an asynchronous task to the main thread to actually\n * reload the app. It is unsafe to make any assumptions about whether any more JS code will be\n * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and\n * the state of the native module and main threads.\n *\n * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you\n * try to do so. It also rejects when expo-updates is not enabled.\n *\n * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or\n * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production\n * mode, it most likely means you have installed the module incorrectly. Double check you've\n * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`\n * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on\n * Android ensure you either call `UpdatesController.initialize` with the instance of\n * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the\n * proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * promise will be rejected if you try to do so.\n *\n * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\n *\n * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function checkForUpdateAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * Retrieves the current extra params.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function getExtraParamsAsync(): Promise> {\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)\n * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise {\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent expo-updates log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise {\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing expo-updates log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise {\n await ExpoUpdates.clearLogEntriesAsync();\n}\n\n/**\n * Downloads the most recently deployed update to your project from server to the device's local\n * storage. This method cannot be used in development mode, and the returned promise will be\n * rejected if you try to do so.\n *\n > **Note:** [`reloadAsync()`](#updatesreloadasync) can be called after promise resolution to\n * reload the app using the most recently downloaded version. Otherwise, the update will be applied\n * on the next app cold start.\n *\n * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function fetchUpdateAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\n/**\n * @hidden\n */\nexport function transformNativeStateMachineContext(\n originalNativeContext: UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n): UpdatesNativeStateMachineContext {\n const nativeContext = { ...originalNativeContext };\n if (nativeContext.latestManifestString) {\n nativeContext.latestManifest = JSON.parse(nativeContext.latestManifestString);\n delete nativeContext.latestManifestString;\n }\n if (nativeContext.downloadedManifestString) {\n nativeContext.downloadedManifest = JSON.parse(nativeContext.downloadedManifestString);\n delete nativeContext.downloadedManifestString;\n }\n if (nativeContext.lastCheckForUpdateTimeString) {\n nativeContext.lastCheckForUpdateTime = new Date(nativeContext.lastCheckForUpdateTimeString);\n delete nativeContext.lastCheckForUpdateTimeString;\n }\n if (nativeContext.rollbackString) {\n nativeContext.rollback = JSON.parse(nativeContext.rollbackString);\n delete nativeContext.rollbackString;\n }\n return nativeContext;\n}\n\n/**\n * @hidden\n */\nexport async function getNativeStateMachineContextAsync(): Promise {\n const nativeContext = await ExpoUpdates.getNativeStateMachineContextAsync();\n return transformNativeStateMachineContext(nativeContext);\n}\n"]} \ No newline at end of file +{"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,WAAW,MAAM,eAAe,CAAC;AAWxC;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C,CAAC;AAC3D,CAAC","sourcesContent":["import { CodedError } from 'expo-modules-core';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateFetchResult,\n UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\n UpdatesNativeStateMachineContext,\n} from './Updates.types';\n\n/**\n * Whether expo-updates is enabled. This may be false in a variety of cases including:\n * - enabled set to false in configuration\n * - missing or invalid URL in configuration\n * - missing runtime version or SDK version in configuration\n * - error accessing storage on device during initialization\n *\n * When false, the embedded update is loaded.\n */\nexport const isEnabled: boolean = !!ExpoUpdates.isEnabled;\n\n/**\n * The UUID that uniquely identifies the currently running update. The\n * UUID is represented in its canonical string form and will always use lowercase letters.\n * This value is `null` when running in a local development environment or any other environment where `expo-updates` is disabled.\n * @example xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n/**\n * The channel name of the current build, if configured for use with EAS Update. `null` otherwise.\n *\n * Expo Go and development builds are not set to a specific channel and can run any updates compatible with their native runtime. Therefore, this value will always be `null` when running an update on Expo Go or a development build.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when expo-updates checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch;\n\n/**\n * If `isEmergencyLaunch` is set to true, this will contain a string error message describing\n * what failed during initialization.\n */\nexport const emergencyLaunchReason = ExpoUpdates.emergencyLaunchReason;\n\n/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\n/**\n * If `expo-updates` is enabled, this is the\n * [manifest](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\n * object for the update that's currently running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\nexport const manifest: Partial =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\n\n/**\n * During non-expo development we block accessing the updates API methods on the JS side, but when developing in\n * Expo Go or a development client build, the controllers should have control over which API methods should\n * be allowed.\n */\nconst shouldDeferToNativeForAPIMethodAvailabilityInDevelopment =\n !!ExpoUpdates.shouldDeferToNativeForAPIMethodAvailabilityInDevelopment;\n\n/**\n * Developer tool is set when a project is served by `expo start`.\n */\nconst isUsingDeveloperTool =\n 'extra' in manifest ? !!manifest.extra?.expoGo?.developer?.tool : false;\n\nconst manualUpdatesInstructions =\n 'To test usage of the expo-updates JS API in your app, make a release build with `npx expo run:ios --configuration Release` or ' +\n '`npx expo run:android --variant Release`.';\n\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the\n * app.\n *\n * It is not recommended to place any meaningful logic after a call to `await\n * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can\n * be reloaded, and immediately before posting an asynchronous task to the main thread to actually\n * reload the app. It is unsafe to make any assumptions about whether any more JS code will be\n * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and\n * the state of the native module and main threads.\n *\n * This method cannot be used in Expo Go or development mode, and the returned promise will be rejected if you\n * try to do so. It also rejects when expo-updates is not enabled.\n *\n * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or\n * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production\n * mode, it most likely means you have installed the module incorrectly. Double check you've\n * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`\n * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on\n * Android ensure you either call `UpdatesController.initialize` with the instance of\n * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the\n * proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * promise will be rejected if you try to do so.\n *\n * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\n *\n * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function checkForUpdateAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * Retrieves the current extra params.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function getExtraParamsAsync(): Promise> {\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent as an [Expo Structured Field Value Dictionary](https://docs.expo.dev/technical-specs/expo-sfv-0/)\n * in the `Expo-Extra-Params` header of update requests. A compliant update server may use these params when selecting an update to serve.\n *\n * This method cannot be used in Expo Go or development mode. It also rejects when expo-updates is not enabled.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise {\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent expo-updates log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise {\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing expo-updates log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise {\n await ExpoUpdates.clearLogEntriesAsync();\n}\n\n/**\n * Downloads the most recently deployed update to your project from server to the device's local\n * storage. This method cannot be used in development mode, and the returned promise will be\n * rejected if you try to do so.\n *\n > **Note:** [`reloadAsync()`](#updatesreloadasync) can be called after promise resolution to\n * reload the app using the most recently downloaded version. Otherwise, the update will be applied\n * on the next app cold start.\n *\n * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The promise rejects in Expo Go or if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server. It also rejects when expo-updates is not enabled.\n */\nexport async function fetchUpdateAsync(): Promise {\n if (\n (__DEV__ || isUsingDeveloperTool) &&\n !shouldDeferToNativeForAPIMethodAvailabilityInDevelopment\n ) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if ('manifestString' in result) {\n const { manifestString, ...rest } = result;\n return {\n ...rest,\n manifest: JSON.parse(manifestString),\n };\n }\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\n/**\n * @hidden\n */\nexport function transformNativeStateMachineContext(\n originalNativeContext: UpdatesNativeStateMachineContext & {\n latestManifestString?: string;\n downloadedManifestString?: string;\n lastCheckForUpdateTimeString?: string;\n rollbackString?: string;\n }\n): UpdatesNativeStateMachineContext {\n const nativeContext = { ...originalNativeContext };\n if (nativeContext.latestManifestString) {\n nativeContext.latestManifest = JSON.parse(nativeContext.latestManifestString);\n delete nativeContext.latestManifestString;\n }\n if (nativeContext.downloadedManifestString) {\n nativeContext.downloadedManifest = JSON.parse(nativeContext.downloadedManifestString);\n delete nativeContext.downloadedManifestString;\n }\n if (nativeContext.lastCheckForUpdateTimeString) {\n nativeContext.lastCheckForUpdateTime = new Date(nativeContext.lastCheckForUpdateTimeString);\n delete nativeContext.lastCheckForUpdateTimeString;\n }\n if (nativeContext.rollbackString) {\n nativeContext.rollback = JSON.parse(nativeContext.rollbackString);\n delete nativeContext.rollbackString;\n }\n return nativeContext;\n}\n\n/**\n * @hidden\n */\nexport async function getNativeStateMachineContextAsync(): Promise {\n const nativeContext = await ExpoUpdates.getNativeStateMachineContextAsync();\n return transformNativeStateMachineContext(nativeContext);\n}\n"]} \ No newline at end of file diff --git a/packages/expo-updates/build/UpdatesEmitter.js.map b/packages/expo-updates/build/UpdatesEmitter.js.map index 8a30b2ee868e6..39d6c3b9a719e 100644 --- a/packages/expo-updates/build/UpdatesEmitter.js.map +++ b/packages/expo-updates/build/UpdatesEmitter.js.map @@ -1 +1 @@ -{"version":3,"file":"UpdatesEmitter.js","sourceRoot":"","sources":["../src/UpdatesEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,YAAY,EAA0B,MAAM,WAAW,CAAC;AAEjE,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,WAAW,CAAC;AAG/D,IAAI,QAA6B,CAAC;AAClC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAErE,SAAS,WAAW;IAClB,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC9B,kBAAkB,CAAC,WAAW,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;QACtE,kBAAkB,CAAC,WAAW,CAC5B,oCA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AAC5D,CAAC;AAED,mBAAmB;AAEnB;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAwD,EACxD,EAAE;IACF,uCAAuC;IACvC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,WAAW,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAoC,EAAE,EAAE;IAC3E,2DAA2D;IAC3D,2BAA2B,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { EventEmitter as NativeEventEmitter } from 'expo-modules-core';\nimport { EventEmitter, type EventSubscription } from 'fbemitter';\n\nimport ExpoUpdatesModule from './ExpoUpdates';\nimport { transformNativeStateMachineContext } from './Updates';\nimport type { UpdateEvent, UpdatesNativeStateChangeEvent } from './Updates.types';\n\nlet _emitter: EventEmitter | null;\nconst nativeEventEmitter = new NativeEventEmitter(ExpoUpdatesModule);\n\nfunction _getEmitter(): EventEmitter {\n if (!_emitter) {\n _emitter = new EventEmitter();\n nativeEventEmitter.addListener('Expo.nativeUpdatesEvent', _emitEvent);\n nativeEventEmitter.addListener(\n 'Expo.nativeUpdatesStateChangeEvent',\n _emitNativeStateChangeEvent\n );\n }\n return _emitter;\n}\n\n// Reemits native UpdateEvents sent during the startup update check\nfunction _emitEvent(params): void {\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n let newParams = { ...params };\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n if (newParams.manifestString) {\n newParams.manifest = JSON.parse(newParams.manifestString);\n delete newParams.manifestString;\n }\n _emitter.emit('Expo.updatesEvent', newParams);\n}\n\n// Reemits native state change events\nfunction _emitNativeStateChangeEvent(params: any) {\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n let newParams = { ...params };\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n newParams.context = transformNativeStateMachineContext(newParams.context);\n _emitter.emit('Expo.updatesStateChangeEvent', newParams);\n}\n\n/**\n * Adds a callback to be invoked when updates-related events occur (such as upon the initial app\n * load) due to auto-update settings chosen at build-time. See also the\n * [`useUpdateEvents()`](#useupdateeventslistener) React hook.\n * @deprecated This API is deprecated and will be removed in a future release corresponding with SDK 51.\n * Use [`useUpdates()`](#useupdates) instead.\n *\n * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance\n * and should not return any value.\n * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the\n * listener.\n */\nexport function addListener(listener: (event: UpdateEvent) => void): EventSubscription {\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesEvent', listener);\n}\n\n// Internal methods\n\n/**\n * @hidden\n */\nexport const addUpdatesStateChangeListener = (\n listener: (event: UpdatesNativeStateChangeEvent) => void\n) => {\n // Add listener for state change events\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesStateChangeEvent', listener);\n};\n\n/**\n * @hidden\n */\nexport const emitStateChangeEvent = (event: UpdatesNativeStateChangeEvent) => {\n // Allows JS to emit a state change event (used in testing)\n _emitNativeStateChangeEvent(event);\n};\n"]} \ No newline at end of file +{"version":3,"file":"UpdatesEmitter.js","sourceRoot":"","sources":["../src/UpdatesEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,YAAY,EAA0B,MAAM,WAAW,CAAC;AAEjE,OAAO,iBAAiB,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kCAAkC,EAAE,MAAM,WAAW,CAAC;AAG/D,IAAI,QAA6B,CAAC;AAClC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAErE,SAAS,WAAW;IAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,YAA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AAC3D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,QAAsC;IAChE,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED,mBAAmB;AAEnB;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAwD,EACxD,EAAE;IACF,uCAAuC;IACvC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,WAAW,CAAC,8BAA8B,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAoC,EAAE,EAAE;IAC3E,2DAA2D;IAC3D,2BAA2B,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { EventEmitter as NativeEventEmitter } from 'expo-modules-core';\nimport { EventEmitter, type EventSubscription } from 'fbemitter';\n\nimport ExpoUpdatesModule from './ExpoUpdates';\nimport { transformNativeStateMachineContext } from './Updates';\nimport type { UpdateEvent, UpdatesNativeStateChangeEvent } from './Updates.types';\n\nlet _emitter: EventEmitter | null;\nconst nativeEventEmitter = new NativeEventEmitter(ExpoUpdatesModule);\n\nfunction _getEmitter(): EventEmitter {\n if (!_emitter) {\n _emitter = new EventEmitter();\n nativeEventEmitter.addListener('Expo.nativeUpdatesEvent', _emitEvent);\n nativeEventEmitter.addListener(\n 'Expo.nativeUpdatesStateChangeEvent',\n _emitNativeStateChangeEvent\n );\n }\n return _emitter;\n}\n\n// Reemits native UpdateEvents sent during the startup update check\nfunction _emitEvent(params): void {\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n let newParams = { ...params };\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n if (newParams.manifestString) {\n newParams.manifest = JSON.parse(newParams.manifestString);\n delete newParams.manifestString;\n }\n _emitter.emit('Expo.updatesEvent', newParams);\n}\n\n// Reemits native state change events\nfunction _emitNativeStateChangeEvent(params: any) {\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n let newParams = { ...params };\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n newParams.context = transformNativeStateMachineContext(newParams.context);\n _emitter.emit('Expo.updatesStateChangeEvent', newParams);\n}\n\n/**\n * Adds a callback to be invoked when updates-related events occur (such as upon the initial app\n * load) due to auto-update settings chosen at build-time. See also the\n * [`useUpdateEvents()`](#useupdateeventslistener) React hook.\n * @deprecated This API is deprecated and will be removed in a future release corresponding with SDK 51.\n * Use [`useUpdates()`](#useupdates) instead.\n *\n * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance\n * and should not return any value.\n * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the\n * listener.\n */\nexport function addListener(listener: (event: UpdateEvent) => void): EventSubscription {\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesEvent', listener);\n}\n\n// Internal methods\n\n/**\n * @hidden\n */\nexport const addUpdatesStateChangeListener = (\n listener: (event: UpdatesNativeStateChangeEvent) => void\n) => {\n // Add listener for state change events\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesStateChangeEvent', listener);\n};\n\n/**\n * @hidden\n */\nexport const emitStateChangeEvent = (event: UpdatesNativeStateChangeEvent) => {\n // Allows JS to emit a state change event (used in testing)\n _emitNativeStateChangeEvent(event);\n};\n"]} \ No newline at end of file diff --git a/packages/expo-updates/build/UpdatesHooks.js.map b/packages/expo-updates/build/UpdatesHooks.js.map index 8b50a29a80f40..d025d4e971b85 100644 --- a/packages/expo-updates/build/UpdatesHooks.js.map +++ b/packages/expo-updates/build/UpdatesHooks.js.map @@ -1 +1 @@ -{"version":3,"file":"UpdatesHooks.js","sourceRoot":"","sources":["../src/UpdatesHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAsC,EAAE,EAAE;IACxE,MAAM,WAAW,GAAG,MAAM,EAAmB,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,CAAC,OAAO,EAAE;YACvB,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtD,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC,CAAC;SACH;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { UpdateEvent } from './Updates.types';\nimport { addListener } from './UpdatesEmitter';\n\n/**\n * React hook to create an [`UpdateEvent`](#updateevent) listener subscription on mount, using\n * [`addListener`](#updatesaddlistenerlistener). It calls `remove()` on the subscription during unmount.\n * @deprecated This API is deprecated and will be removed in a future release corresponding with SDK 51.\n * Use [`useUpdates()`](#useupdates) instead.\n *\n * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance\n * and should not return any value.\n *\n * @example\n * ```ts\n * function App() {\n * const eventListener = (event) => {\n * if (event.type === Updates.UpdateEventType.ERROR) {\n * // Handle error\n * } else if (event.type === Updates.UpdateEventType.NO_UPDATE_AVAILABLE) {\n * // Handle no update available\n * } else if (event.type === Updates.UpdateEventType.UPDATE_AVAILABLE) {\n * // Handle update available\n * }\n * };\n * Updates.useUpdateEvents(eventListener);\n * // React Component...\n * }\n * ```\n */\nexport const useUpdateEvents = (listener: (event: UpdateEvent) => void) => {\n const listenerRef = useRef();\n\n useEffect(() => {\n listenerRef.current = listener;\n }, [listener]);\n\n useEffect(() => {\n if (listenerRef.current) {\n const subscription = addListener(listenerRef.current);\n return () => {\n subscription.remove();\n };\n }\n return undefined;\n }, []);\n};\n"]} \ No newline at end of file +{"version":3,"file":"UpdatesHooks.js","sourceRoot":"","sources":["../src/UpdatesHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAsC,EAAE,EAAE;IACxE,MAAM,WAAW,GAAG,MAAM,EAAmB,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACtD,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["import { useEffect, useRef } from 'react';\n\nimport { UpdateEvent } from './Updates.types';\nimport { addListener } from './UpdatesEmitter';\n\n/**\n * React hook to create an [`UpdateEvent`](#updateevent) listener subscription on mount, using\n * [`addListener`](#updatesaddlistenerlistener). It calls `remove()` on the subscription during unmount.\n * @deprecated This API is deprecated and will be removed in a future release corresponding with SDK 51.\n * Use [`useUpdates()`](#useupdates) instead.\n *\n * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance\n * and should not return any value.\n *\n * @example\n * ```ts\n * function App() {\n * const eventListener = (event) => {\n * if (event.type === Updates.UpdateEventType.ERROR) {\n * // Handle error\n * } else if (event.type === Updates.UpdateEventType.NO_UPDATE_AVAILABLE) {\n * // Handle no update available\n * } else if (event.type === Updates.UpdateEventType.UPDATE_AVAILABLE) {\n * // Handle update available\n * }\n * };\n * Updates.useUpdateEvents(eventListener);\n * // React Component...\n * }\n * ```\n */\nexport const useUpdateEvents = (listener: (event: UpdateEvent) => void) => {\n const listenerRef = useRef();\n\n useEffect(() => {\n listenerRef.current = listener;\n }, [listener]);\n\n useEffect(() => {\n if (listenerRef.current) {\n const subscription = addListener(listenerRef.current);\n return () => {\n subscription.remove();\n };\n }\n return undefined;\n }, []);\n};\n"]} \ No newline at end of file