Version 0.5.25

Registration with no need to insert "invitante"
This commit is contained in:
paoloar77
2022-11-02 14:59:32 +01:00
parent e76db7467f
commit 83e6f92978
29 changed files with 569 additions and 147 deletions

View File

@@ -306,8 +306,15 @@
</div>
</div>
<div v-else-if="isalreadyReg">
<q-banner class="bg-negative text-white text-h5" transition-show="jump-down">
Utente già registrato con l'username {{signup.username}}
</q-banner>
</div>
</div>
</div>
</template>

View File

@@ -61,8 +61,34 @@ export default defineComponent({
const globalStore = useGlobalStore()
const testStore = useTestStore()
const data = ref({
registration: null,
updateExists: false,
} as any)
const refreshing = ref(false)
const stateconn = ref(globalStore.stateConnection)
function updateAvailable(event: any) {
console.log(event)
data.value.registration = event.detail
data.value.updateExists = true
RefreshApp() // update automatically
}
function created() {
document.addEventListener('swUpdated', updateAvailable, { once: true })
navigator.serviceWorker.addEventListener('controllerchange', () => {
// We'll also need to add 'refreshing' to our data originally set to false.
if (refreshing.value)
return
refreshing.value = true
// Here the actual reload of the page occurs
window.location.reload()
})
}
const {
getUsernameChatByMsg,
getMyUsername,
@@ -81,7 +107,7 @@ export default defineComponent({
getNumMsg,
getNumMsgUnread,
getMsgText,
paotest } = MixinUsers();
paotest } = MixinUsers()
function isonline() {
return globalStore.stateConnection === 'online'
@@ -135,8 +161,8 @@ export default defineComponent({
// console.log('PRIMA $q.lang.isoName', $q.lang.isoName)
// dynamic import, so loading on demand only
import(`quasar/lang/${mylang}`).then((lang) => {
$q.lang.set(lang.default)
import(`quasar/lang/${mylang}`).then((lang2: any) => {
$q.lang.set(lang2.default)
import('../../statics/i18n').then(() => {
// console.log('MY LANG DOPO=', $q.lang.isoName)
@@ -146,9 +172,9 @@ export default defineComponent({
globalStore.addDynamicPages($router)
}
function setshortlang(lang: string) {
function setshortlang(mylang: string) {
static_data.lang_available.forEach((langavail) => {
if (langavail.value === lang) {
if (langavail.value === mylang) {
// console.log('static_data.lang_available[indrec].short', static_data.lang_available[indrec].short, static_data.lang_available[indrec].value)
langshort.value = langavail.short
return langshort.value
@@ -209,7 +235,6 @@ export default defineComponent({
const lang = computed({
get: () => $q.lang.isoName,
set: mylang => {
const $router = useRouter()
console.log('set lang', $q.lang.getLocale())
$q.lang.set(snakeToCamel(mylang))
// tools.showNotif($q, 'IMPOSTA LANG= ' + $i18n.locale)
@@ -282,12 +307,19 @@ export default defineComponent({
function RefreshApp() {
// Unregister Service Worker
/*
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations) {
registration.unregister()
}
})
window.location.reload()
window.location.reload() */
data.value.updateExists = false
// Make sure we only send a 'skip waiting' message if the SW is waiting
if (!data.value.registration || !data.value.registration.waiting) return
// Send message to SW to skip the waiting and activate the new SW
data.value.registration.waiting.postMessage({ type: 'SKIP_WAITING' })
}
function changeIconConn() {
@@ -397,7 +429,6 @@ export default defineComponent({
function clickregister() {
rightDrawerOpen.value = false
const $router = useRouter()
$router.replace('/signup')
}
@@ -444,6 +475,8 @@ export default defineComponent({
onBeforeMount(BeforeMount)
onMounted(mounted)
created()
return {
static_data,
globalStore,
@@ -493,6 +526,7 @@ export default defineComponent({
logoutHandler,
isUserNotAuth,
tools,
data,
}
},

View File

@@ -30,7 +30,7 @@
<q-btn
size="md"
id="newvers" v-if="isNewVersionAvailable()" color="secondary" rounded icon="refresh"
id="newvers" v-if="isNewVersionAvailable() || data.updateExists" color="secondary" rounded icon="refresh"
class="btnNewVersShow" @click="RefreshApp()" :label="t('notification.newVersionAvailable')">
</q-btn>