Merge branch 'refactor/lint' of https://github.com/liyasthomas/postwoman into refactor/lint

This commit is contained in:
Liyas Thomas
2020-02-22 23:09:13 +05:30
4 changed files with 11 additions and 8 deletions

View File

@@ -204,7 +204,7 @@ _**All `i18n` contributions are welcome to `i18n` [branch](https://github.com/li
- **[CLI β](https://github.com/postwoman-io/postwoman-cli)** - A CLI solution for Postwoman - **[CLI β](https://github.com/postwoman-io/postwoman-cli)** - A CLI solution for Postwoman
- **Browser Extensions** - Browser extensions that simplifies access to Postwoman - **Browser Extensions** - Browser extensions that simplifies access to Postwoman
[![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_16x16.png) **Firefox**](https://addons.mozilla.org/en-US/firefox/addon/postwoman) ([GitHub](https://github.com/AndrewBastin/postwoman-firefox))  |  [![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_16x16.png) **Chrome**](https://chrome.google.com/webstore/detail/postwoman-extension-for-c/amknoiejhlmhancpahfcfcfhllgkpbld) ([GitHub](https://github.com/AndrewBastin/postwoman-chrome)) [![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_16x16.png) **Firefox**](https://addons.mozilla.org/en-US/firefox/addon/postwoman)  |  [![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_16x16.png) **Chrome**](https://chrome.google.com/webstore/detail/postwoman-extension-for-c/amknoiejhlmhancpahfcfcfhllgkpbld) ([GitHub](https://github.com/AndrewBastin/postwoman-extension))
>**Extensions fixes `CORS` issues.** >**Extensions fixes `CORS` issues.**

View File

@@ -1,5 +1,7 @@
import AxiosStrategy from "./strategies/AxiosStrategy"; import AxiosStrategy from "./strategies/AxiosStrategy";
import ExtensionStrategy from "./strategies/ExtensionStrategy"; import ExtensionStrategy, {
hasExtensionInstalled
} from "./strategies/ExtensionStrategy";
import FirefoxStrategy from "./strategies/FirefoxStrategy"; import FirefoxStrategy from "./strategies/FirefoxStrategy";
import ChromeStrategy, { import ChromeStrategy, {
hasChromeExtensionInstalled hasChromeExtensionInstalled
@@ -11,7 +13,7 @@ const isExtensionsAllowed = ({ state }) =>
const runAppropriateStrategy = (req, store) => { const runAppropriateStrategy = (req, store) => {
if (isExtensionsAllowed(store)) { if (isExtensionsAllowed(store)) {
if (typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined") { if (hasExtensionInstalled()) {
return ExtensionStrategy(req, store); return ExtensionStrategy(req, store);
} }

View File

@@ -1,3 +1,6 @@
export const hasExtensionInstalled = () =>
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined";
const extensionWithProxy = async (req, { state }) => { const extensionWithProxy = async (req, { state }) => {
const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({ const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({
method: "post", method: "post",

View File

@@ -673,7 +673,7 @@
<script> <script>
import intializePwa from "../assets/js/pwa"; import intializePwa from "../assets/js/pwa";
import * as version from "../.postwoman/version.json"; import * as version from "../.postwoman/version.json";
import { hasChromeExtensionInstalled } from "../functions/strategies/ChromeStrategy"; import { hasExtensionInstalled } from "../functions/strategies/ExtensionStrategy";
import firebase from "firebase/app"; import firebase from "firebase/app";
import { fb } from "../functions/fb"; import { fb } from "../functions/fb";
@@ -735,8 +735,7 @@ export default {
showExtensions: false, showExtensions: false,
showShortcuts: false, showShortcuts: false,
showSupport: false, showSupport: false,
firefoxExtInstalled: window.firefoxExtSendRequest, extensionInstalled: hasExtensionInstalled(),
chromeExtInstalled: window.chrome && hasChromeExtensionInstalled(),
fb, fb,
navigatorShare: navigator.share navigatorShare: navigator.share
}; };
@@ -799,8 +798,7 @@ export default {
let showExtensionsToast = let showExtensionsToast =
localStorage.getItem("showExtensionsToast") === "yes"; localStorage.getItem("showExtensionsToast") === "yes";
if ( if (
!this.firefoxExtInstalled && !this.extensionInstalled &&
!this.chromeExtInstalled &&
!showExtensionsToast !showExtensionsToast
) { ) {
setTimeout(() => { setTimeout(() => {