From 062bc13d4fcf5ad4369ace2da0c2170e139da999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 6 May 2020 10:53:23 +0200 Subject: [PATCH] rn,storage: fix not using a persistent localStorage In https://github.com/jitsi/jitsi-meet/commit/1ffd75c0a6b4fc7d0463ab5036e7ee9798660027 we switched to using the localStorage wrapper provided by js-utils, which checks for window.localStorage's availability very early. Our polyfill must be applied earlier that any such import. Here we are importing it in the entrypoint, which means no code ran before this, literally. --- .../base/lib-jitsi-meet/native/polyfills-browser.js | 8 -------- react/index.native.js | 3 +++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js index d47b34c3b..49b1b0ea3 100644 --- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js @@ -3,14 +3,6 @@ import '@webcomponents/url'; // Polyfill for URL constructor import { Platform } from '../../react'; -// XXX The library lib-jitsi-meet utilizes window.localStorage at the time of -// this writing and, consequently, the browser-related polyfills implemented -// here by the feature base/lib-jitsi-meet for the purposes of the library -// lib-jitsi-meet are incomplete without the Web Storage API! Should the library -// lib-jitsi-meet (and its dependencies) stop utilizing window.localStorage, -// the following import may be removed: -import '../../storage'; - /** * Gets the first common prototype of two specified Objects (treating the * objects themselves as prototypes as well). diff --git a/react/index.native.js b/react/index.native.js index dec856ac3..2ac15f013 100644 --- a/react/index.native.js +++ b/react/index.native.js @@ -10,6 +10,9 @@ // collect the polyfills' files. import './features/base/lib-jitsi-meet/native/polyfills-bundler'; +// Polyfill localStorage early so any library that requires it sees it available. +import './features/base/storage/native/polyfills-browser'; + import React, { PureComponent } from 'react'; import { AppRegistry } from 'react-native';