Files
myprojplanet_vite/src/components/CCheckAppRunning/CCheckAppRunning.ts
Surya Paolo df98ec9471 - corretto problema ROGNOSO : Risolvere la questione "Sessioni multiple", se apro 2 browser l'ultimo va a cancellare il precedente, e mi da errore di email non valida !
Il problema era sulla fetch nel service worker, gestita in quel modo personalizzato, andava in conflitto, non tenendo le chiamate bloccanti, ma uscivano prima che arrivasse la risposta del server.
- Per chi è da tanto che non si collega a RISO, compare "Email non verificata"... (si risolve chiudendo su ESCI e riloggandosi)... però andrebbe sistemata.
(stesso problema di prima).
2025-10-26 02:47:59 +02:00

68 lines
1.9 KiB
TypeScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineComponent, ref, computed, onMounted } from 'vue';
import { useGlobalStore } from '@store/globalStore';
import { tools } from '@tools';
export default defineComponent({
name: 'CCheckAppRunning',
setup() {
const globalStore = useGlobalStore();
const isAppRunning = computed(() => globalStore.isAppRunning === true);
const finishLoading = computed(() => globalStore.finishLoading === true);
const deferredPrompt = computed(() => globalStore.deferredPrompt);
const homescreen = computed(() => globalStore.homescreen === true);
const viewiOS = ref(false);
const viewAndroid = ref(false);
const showNotice = ref(false);
const showOther = ref(false);
// === Rilevamento WebView ===
const currentUrl = window.location.href;
const webViewDetectors = [
{ name: 'Telegram', test: /Telegram/ },
{ name: 'WhatsApp', test: /WhatsApp/ },
{ name: 'Facebook', test: /FBAV|FBAN/ },
{ name: 'Instagram', test: /Instagram/ },
{ name: 'Messenger', test: /Messenger/ },
];
const matchedWebView = webViewDetectors.find(({ test }) => test.test(navigator.userAgent));
const isInRestrictedWebView = !!matchedWebView;
const webViewName = matchedWebView ? matchedWebView.name : 'unapp';
// === Installazione ===
function installApp() {
if (globalStore.deferredPrompt) {
globalStore.deferredPrompt.prompt();
globalStore.deferredPrompt.userChoice.then((choiceResult: any) => {
if (choiceResult.outcome === 'accepted') {
globalStore.deferredPrompt = null;
}
});
}
}
onMounted(() => {
tools.checkApp();
});
return {
tools,
finishLoading,
isAppRunning,
deferredPrompt,
homescreen,
viewiOS,
viewAndroid,
installApp,
isInRestrictedWebView,
webViewName,
currentUrl,
showNotice,
showOther,
};
},
});