Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
rn,polyfills: refactor all mobile polyfills
Saúl Ibarra Corretgécaabdadf19ae
diff --git a/react/features/base/lib-jitsi-meet/native/index.js b/react/features/base/lib-jitsi-meet/native/index.jsindex 4d0b1f5643..be52ee46fe 100644--- a/react/features/base/lib-jitsi-meet/native/index.js+++ b/react/features/base/lib-jitsi-meet/native/index.js@@ -1,2 +1 @@-import './polyfills-browser';import './WiFiStats';diff --git a/react/features/base/storage/_.native.js b/react/features/base/storage/_.native.jsdeleted file mode 100644index 738c4d2b8a..0000000000--- a/react/features/base/storage/_.native.js+++ /dev/null@@ -1 +0,0 @@-export * from './native';diff --git a/react/features/base/storage/_.web.js b/react/features/base/storage/_.web.jsdeleted file mode 100644index e69de29bb2..0000000000diff --git a/react/features/base/storage/index.js b/react/features/base/storage/index.jsindex a356970064..6219137035 100644--- a/react/features/base/storage/index.js+++ b/react/features/base/storage/index.js@@ -1,4 +1,3 @@-export * from './_';export { default as PersistenceRegistry } from './PersistenceRegistry';import './middleware';diff --git a/react/features/base/storage/native/index.js b/react/features/base/storage/native/index.jsdeleted file mode 100644index 8caf549513..0000000000--- a/react/features/base/storage/native/index.js+++ /dev/null@@ -1 +0,0 @@-import './polyfills-browser';diff --git a/react/features/base/storage/native/polyfills-browser.js b/react/features/base/storage/native/polyfills-browser.jsdeleted file mode 100644index 1518b76b01..0000000000--- a/react/features/base/storage/native/polyfills-browser.js+++ /dev/null@@ -1,19 +0,0 @@-import Storage from './Storage';--(global => {-- // localStorage- if (typeof global.localStorage === 'undefined') {- global.localStorage = new Storage('@jitsi-meet/');- }-- // sessionStorage- //- // Required by:- // - herment- // - Strophe- if (typeof global.sessionStorage === 'undefined') {- global.sessionStorage = new Storage();- }--})(global || window || this); // eslint-disable-line no-invalid-thisdiff --git a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js b/react/features/mobile/polyfills/RTCPeerConnection.jssimilarity index 98%rename from react/features/base/lib-jitsi-meet/native/RTCPeerConnection.jsrename to react/features/mobile/polyfills/RTCPeerConnection.jsindex 60450745e5..8ba6a80de4 100644--- a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js+++ b/react/features/mobile/polyfills/RTCPeerConnection.js@@ -3,8 +3,6 @@import { NativeModules } from 'react-native';import { RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc';-import logger from '../logger';-/* eslint-disable no-unused-vars */// Address families.@@ -87,7 +85,7 @@ _RTCPeerConnection.prototype._invokeQueuedOnaddstream = function(q) {// TODO Determine whether the combination of the standard// setRemoteDescription and onaddstream results in a similar// swallowing of errors.- _LOGE(e);+ console.error(e);}});};@@ -101,7 +99,7 @@ _RTCPeerConnection.prototype.setRemoteDescription = function(description) {return (_synthesizeIPv6Addresses(description).catch(reason => {- reason && _LOGE(reason);+ reason && console.error(reason);return description;})@@ -109,16 +107,6 @@ _RTCPeerConnection.prototype.setRemoteDescription = function(description) {};-/**- * Logs at error level.- *- * @private- * @returns {void}- */-function _LOGE(...args) {- logger.error(...args);-}-/*** Adapts react-native-webrtc's {@link RTCPeerConnection#setRemoteDescription}* implementation which uses the deprecated, callback-based version to thediff --git a/react/features/base/storage/native/Storage.js b/react/features/mobile/polyfills/Storage.jssimilarity index 100%rename from react/features/base/storage/native/Storage.jsrename to react/features/mobile/polyfills/Storage.jsdiff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/mobile/polyfills/browser.jssimilarity index 97%rename from react/features/base/lib-jitsi-meet/native/polyfills-browser.jsrename to react/features/mobile/polyfills/browser.jsindex 49b1b0ea3d..3ce8a65682 100644--- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js+++ b/react/features/mobile/polyfills/browser.js@@ -1,7 +1,9 @@+import { Platform } from 'react-native';import BackgroundTimer from 'react-native-background-timer';+import '@webcomponents/url'; // Polyfill for URL constructor-import { Platform } from '../../react';+import Storage from './Storage';/*** Gets the first common prototype of two specified Objects (treating the@@ -372,7 +374,7 @@ function _visitNode(node, callback) {}// WebRTC- require('./polyfills-webrtc');+ require('./webrtc');// CallStats//@@ -418,4 +420,18 @@ function _visitNode(node, callback) {global.setInterval = BackgroundTimer.setInterval.bind(BackgroundTimer);global.setTimeout = (fn, ms = 0) => BackgroundTimer.setTimeout(fn, ms);+ // localStorage+ if (typeof global.localStorage === 'undefined') {+ global.localStorage = new Storage('@jitsi-meet/');+ }++ // sessionStorage+ //+ // Required by:+ // - herment+ // - Strophe+ if (typeof global.sessionStorage === 'undefined') {+ global.sessionStorage = new Storage();+ }+})(global || window || this); // eslint-disable-line no-invalid-thisdiff --git a/react/features/base/lib-jitsi-meet/native/polyfills-bundler.js b/react/features/mobile/polyfills/bundler.jssimilarity index 100%rename from react/features/base/lib-jitsi-meet/native/polyfills-bundler.jsrename to react/features/mobile/polyfills/bundler.jsdiff --git a/react/features/mobile/polyfills/index.js b/react/features/mobile/polyfills/index.jsnew file mode 100644index 0000000000..5092fcd21c--- /dev/null+++ b/react/features/mobile/polyfills/index.js@@ -0,0 +1,2 @@+import './bundler';+import './browser';diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js b/react/features/mobile/polyfills/webrtc.jssimilarity index 100%rename from react/features/base/lib-jitsi-meet/native/polyfills-webrtc.jsrename to react/features/mobile/polyfills/webrtc.jsdiff --git a/react/index.native.js b/react/index.native.jsindex 2ac15f0138..ab1da731a6 100644--- a/react/index.native.js+++ b/react/index.native.js@@ -1,17 +1,8 @@// @flow-// FIXME The bundler-related (and the browser-related) polyfills were born at-// the very early days of prototyping the execution of lib-jitsi-meet on-// react-native. Today, the feature base/lib-jitsi-meet should not be-// responsible for such polyfills because it is not the only feature relying on-// them. Additionally, the polyfills are usually necessary earlier than the-// execution of base/lib-jitsi-meet (which is understandable given that the-// polyfills are globals). The remaining problem to be solved here is where to-// 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';+// Apply all necessary polyfills as early as possible to make sure anything imported henceforth+// sees them.+import './features/mobile/polyfills';import React, { PureComponent } from 'react';import { AppRegistry } from 'react-native';