This commit is contained in:
Paolo Arena
2021-01-18 00:47:30 +01:00
parent d31a5e88ec
commit 316ebbb78b
30 changed files with 279 additions and 87 deletions

View File

@@ -505,3 +505,6 @@ body.mobile .landing:before {
background-repeat: no-repeat;
background-position: 50%;
}
.add-button {
}

View File

@@ -17,7 +17,7 @@ import {
CStatus,
CStatusReg,
CNextZoom,
CVerifyTelegram, CVerifyEmail, CECommerce
CVerifyTelegram, CVerifyEmail, CECommerce, CShareWithUs
} from '@components'
import MixinBase from '@src/mixins/mixin-base'
import { static_data } from '@src/db/static_data'
@@ -37,10 +37,13 @@ import { INotData } from '@src/model'
CNextZoom,
CVerifyTelegram,
CVerifyEmail,
CECommerce
CECommerce,
CShareWithUs
}
})
export default class Home extends MixinBase {
public deferredPrompt: any = null
public showbuttonHS: boolean = false
public text: string = ''
public visibile: boolean = false
public cardvisible: string = 'hidden'
@@ -63,6 +66,7 @@ export default class Home extends MixinBase {
public arrvideo_yt = []
public arrvideo_mp4 = []
public arrsteps = [
{
label: '1',
@@ -170,6 +174,14 @@ export default class Home extends MixinBase {
return UserStore.state.isLogged
}
get isSocio() {
return UserStore.state.my.profile.socio
}
get isSocioResidente() {
return UserStore.state.my.profile.socioresidente
}
get static_data() {
return static_data
}
@@ -195,13 +207,38 @@ export default class Home extends MixinBase {
tools.showNotif(this.$q, String(my))
}
public addtoHomeScreen() {
if (!!this.deferredPrompt) {
this.deferredPrompt.prompt()
// Wait for the user to respond to the prompt
this.deferredPrompt.userChoice.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
this.showbuttonHS = false
console.log('User accepted the A2HS prompt')
} else {
console.log('User dismissed the A2HS prompt')
}
this.deferredPrompt = null
})
}
}
public initprompt() {
window.addEventListener('beforeinstallprompt', (event) => {
// console.log('******************************** beforeinstallprompt fired')
console.log('******************************** beforeinstallprompt fired')
event.preventDefault()
// console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
// #Todo++ IMPOSTA DEFERRED PROMPT
return false
this.deferredPrompt = event
// Update UI to notify the user they can add to home screen
this.showbuttonHS = true
})
window.addEventListener('appinstalled', (evt) => {
// Log install to analytics
console.log('INSTALL: Success')
})
}
@@ -273,7 +310,8 @@ export default class Home extends MixinBase {
}
public openrighttoolbar() {
GlobalStore.state.RightDrawerOpen = true
GlobalStore.state.rightDrawerOpen = true
GlobalStore.state.rightCartOpen = false
}
get TelegCode() {

View File

@@ -57,6 +57,9 @@
@input="changetab"
>
<q-tab name="guida" icon="fas fa-check" :label="$t('pages.home')"></q-tab>
<q-tab v-if="isLogged && isSocio" name="prodotti" icon="fas fa-shopping-cart"
:label="$t('pages.products')"></q-tab>
<q-tab v-if="isLogged" name="collabora" icon="fas fa-users" :label="$t('pages.collabora')"></q-tab>
<!--<q-tab name="zoom" icon="fas fa-video" :label="$t('pages.nextzoom')"></q-tab>-->
<!--<q-tab name="statistiche" icon="fas fa-chart-line" :label="$t('pages.status')"></q-tab>-->
@@ -64,10 +67,59 @@
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="guida">
<div v-if="isLogged">
<div class="q-ma-xs q-pa-xs text-center rounded-borders">
<div v-if="isLogged">
<div>
<!--<q-field-->
<!--v-if="getPermission() === 'granted'"-->
<!--icon="notifications"-->
<!--class="shadow"-->
<!--:label="$t('notification.titlegranted')"-->
<!--:helper="$t('notification.statusnot')">-->
<!--</q-field>-->
<q-field
v-if="NotServiceWorker()"
class="shadow"
icon="notifications"
label="Service Worker not present"
>
</q-field>
</div>
<div>
<q-btn v-if="getPermission() !== 'granted'"
class="enable-notifications shadow"
color="primary" rounded
size="md"
icon="notifications" @click="tools.askfornotification(mythis)"
:label="$t('notification.ask')"/>
<!--<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="showNotificationExample" label="Send Notification"/>-->
<!--<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="secondary" rounded size="lg" icon="notifications" @click="createPushSubscription" label="Create Push Subscription !"/>-->
</div>
</div>
<q-btn class="enable-notifications shadow add-button" v-if="showbuttonHS" @click="addtoHomeScreen"
color="primary" rounded
size="md"
icon="fas fa-plus"
label="Aggiungi alle tue Applicazioni">
</q-btn>
<div class="q-pt-md q-pl-sm">
<div class="text-body2 text-italic text-grey">Versione App {{ getenv('APP_VERSION') }}</div>
</div>
</div>
</q-tab-panel>
<q-tab-panel name="prodotti">
<CECommerce>
</CECommerce>
</q-tab-panel>
<q-tab-panel name="collabora">
<CShareWithUs></CShareWithUs>
</q-tab-panel>
<q-tab-panel name="zoom">
<CNextZoom>
@@ -83,10 +135,6 @@
</q-tab-panel>
</q-tab-panels>
<CECommerce>
</CECommerce>
</div>
</CMyPage>
@@ -97,5 +145,5 @@
</script>
<style lang="scss" scoped>
@import './home.scss';
@import './home.scss';
</style>