Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
applyScreenWorkaround() {
// use polyfill in Firefox for now, see:
// https://blog.mozilla.org/webrtc/getdisplaymedia-now-available-in-adapter-js/
if (adapter.browserDetails.browser === 'firefox') {
adapter.browserShim.shimGetDisplayMedia(window, 'screen');
}
},
* @property {number} [minVersion] - current browser's minimum supported version
* @property {boolean} compatible - is current browser supported ?
*/
const browser = Object.assign({
compatible: !/\s/.test(adapter.browserDetails.browser)
&& (!adapter.browserDetails.minVersion
|| adapter.browserDetails.version >= adapter.browserDetails.minVersion)
}, adapter.browserDetails);
const version = `Reach v${SDK_VERSION} | Schema ${SCHEMA_VERSION} | Webcom v${Webcom.SDK_VERSION}`; // eslint-disable-line no-undef
let message = '';
if (browser.version === null) {
message = 'Unsupported browser: browser must support WebRTC Peer-to-peer connections to use Reach';
} else if (browser.minVersion && browser.minVersion > browser.version) {
message = `Unsupported browser: browser is outdated, update to latest version (${browser.minVersion}+)`;
} else if (!adapter.browserShim) {
message = 'No shim for your browser. There might a problem with your package.';
}
// Log browser status & SDKs versions on load
let args = [`${version} ${message}`];
if (/^(chrome|firefox)$/.test(browser.browser)) {
args = [
`%c ${version} %c ${message}`,
`background: ${browser.compatible ? 'blue' : 'red'}; color: #fff; font-weight: bold`,
`color: ${browser.compatible ? 'inherit' : 'red'}`
];
}
console.log(...args); // eslint-disable-line no-console
export default browser;
componentDidMount() {
if (adapter.browserDetails.browser === "firefox") {
adapter.browserShim.shimGetDisplayMedia(window, "screen");
}
}
const isWebRTCSupported = function() {
return (
typeof WebRTCAdapter.browserDetails === "object" &&
typeof WebRTCAdapter.browserShim === "object"
);
};