Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: wrap script manager in try/catch

Ammar Ahmed289832d16625
diff --git a/apps/mobile/native/globals.js b/apps/mobile/native/globals.js
index 35748abb4..6a9cead77 100644
--- a/apps/mobile/native/globals.js
+++ b/apps/mobile/native/globals.js
@@ -28,18 +28,23 @@ i18n.activate("en");
setI18nGlobal(i18n);
-ScriptManager.shared.addResolver(async (scriptId) => {
- // `scriptId` will be either 'student' or 'teacher'
-
- // In dev mode, resolve script location to dev server.
- if (__DEV__) {
+try {
+ ScriptManager.shared.addResolver(async (scriptId) => {
+ // `scriptId` will be either 'student' or 'teacher'
+
+ // In dev mode, resolve script location to dev server.
+ if (__DEV__) {
+ return {
+ url: Script.getDevServerURL(scriptId),
+ cache: false,
+ };
+ }
+
return {
- url: Script.getDevServerURL(scriptId),
- cache: false,
+ url: Script.getFileSystemURL(scriptId)
};
- }
-
- return {
- url: Script.getFileSystemURL(scriptId)
- };
-});
+ });
+
+} catch(e) {
+ /** ignore error when running with metro bundler */
+}
\ No newline at end of file