Fix indicator if extension is installed
This commit is contained in:
@@ -165,7 +165,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<span>Firefox</span>
|
<span>Firefox</span>
|
||||||
<span class="icon" v-if="firefoxExtInstalled" v-tooltip="$t('installed')">
|
<span class="icon" v-if="hasFirefoxExtInstalled" v-tooltip="$t('installed')">
|
||||||
<i class="material-icons">done</i>
|
<i class="material-icons">done</i>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<span>Chrome</span>
|
<span>Chrome</span>
|
||||||
<span class="icon" v-if="chromeExtInstalled" v-tooltip="$t('installed')">
|
<span class="icon" v-if="hasChromeExtInstalled" v-tooltip="$t('installed')">
|
||||||
<i class="material-icons">done</i>
|
<i class="material-icons">done</i>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -286,7 +286,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import intializePwa from "../../assets/js/pwa"
|
import intializePwa from "../../assets/js/pwa"
|
||||||
import { hasExtensionInstalled } from "../../functions/strategies/ExtensionStrategy"
|
import {
|
||||||
|
hasExtensionInstalled,
|
||||||
|
hasChromeExtensionInstalled,
|
||||||
|
hasFirefoxExtensionInstalled,
|
||||||
|
} from "../../functions/strategies/ExtensionStrategy"
|
||||||
import { getPlatformSpecialKey } from "../../functions/platformutils"
|
import { getPlatformSpecialKey } from "../../functions/platformutils"
|
||||||
import firebase from "firebase/app"
|
import firebase from "firebase/app"
|
||||||
import { fb } from "../../functions/fb"
|
import { fb } from "../../functions/fb"
|
||||||
@@ -306,6 +310,8 @@ export default {
|
|||||||
// prompt.
|
// prompt.
|
||||||
showInstallPrompt: null,
|
showInstallPrompt: null,
|
||||||
showExtensions: false,
|
showExtensions: false,
|
||||||
|
hasChromeExtInstalled: hasChromeExtensionInstalled(),
|
||||||
|
hasFirefoxExtInstalled: hasFirefoxExtensionInstalled(),
|
||||||
showShortcuts: false,
|
showShortcuts: false,
|
||||||
showSupport: false,
|
showSupport: false,
|
||||||
fb,
|
fb,
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
export const hasExtensionInstalled = () =>
|
export const hasExtensionInstalled = () =>
|
||||||
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined"
|
typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined"
|
||||||
|
|
||||||
|
export const hasChromeExtensionInstalled = () =>
|
||||||
|
hasExtensionInstalled() && /Chrome/i.test(navigator.userAgent) && /Google/i.test(navigator.vendor)
|
||||||
|
|
||||||
|
export const hasFirefoxExtensionInstalled = () =>
|
||||||
|
hasExtensionInstalled() && /Firefox/i.test(navigator.userAgent)
|
||||||
|
|
||||||
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",
|
||||||
url:
|
url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",
|
||||||
state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",
|
data: req,
|
||||||
data: req
|
})
|
||||||
});
|
return data
|
||||||
return data;
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const extensionWithoutProxy = async (req, _store) => {
|
const extensionWithoutProxy = async (req, _store) => {
|
||||||
const res = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest(req)
|
const res = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest(req)
|
||||||
|
|||||||
Reference in New Issue
Block a user