Unify Chrome and Firefox extensions

This commit is contained in:
Levin Rickert
2020-02-16 15:48:10 +01:00
parent 112c140ce7
commit 66eecf5e37
2 changed files with 29 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import AxiosStrategy from "./strategies/AxiosStrategy";
import ExtensionStrategy from "./strategies/ExtensionStrategy";
import FirefoxStrategy from "./strategies/FirefoxStrategy";
import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy";
@@ -9,6 +10,12 @@ const isExtensionsAllowed = ({ state }) => {
const runAppropriateStrategy = (req, store) => {
if (isExtensionsAllowed(store)) {
if (typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== 'undefined') {
return ExtensionStrategy(req, store);
}
// The following strategies are deprecated and kept to support older version of the extensions
// Chrome Provides a chrome object for scripts to access
// Check its availability to say whether you are in Google Chrome
if (window.chrome && hasChromeExtensionInstalled()) {