()
| 8 | }; |
| 9 | |
| 10 | export const useIOSError = (): void => { |
| 11 | const { displayToast } = useToastNotification(); |
| 12 | const eventName = 'generic-error'; |
| 13 | |
| 14 | useEffect(() => { |
| 15 | if (!isIOSNative()) { |
| 16 | return () => {}; |
| 17 | } |
| 18 | |
| 19 | promisifyEventListener<void, GenericIOSError>( |
| 20 | eventName, |
| 21 | ({ detail }) => { |
| 22 | if (detail.description) { |
| 23 | displayToast(detail.description); |
| 24 | } |
| 25 | }, |
| 26 | { once: false }, |
| 27 | ); |
| 28 | |
| 29 | return () => { |
| 30 | ( |
| 31 | globalThis as typeof globalThis & { |
| 32 | eventControllers?: Partial<Record<string, AbortController>>; |
| 33 | } |
| 34 | ).eventControllers?.[eventName]?.abort(); |
| 35 | }; |
| 36 | }, [displayToast]); |
| 37 | }; |
no test coverage detected