diff --git a/src-pwa/custom-service-worker.js b/src-pwa/custom-service-worker.js
index f03c2e0..f5b24c0 100644
--- a/src-pwa/custom-service-worker.js
+++ b/src-pwa/custom-service-worker.js
@@ -6,7 +6,7 @@
// Questo è il swSrc
-console.log(' [ VER-0.0.21 ] _---------________-----------_________------------__________________________ PAO: this is my custom service worker');
+console.log(' [ VER-0.0.21 ] _---------________------ PAO: this is my custom service worker');
importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.0.0/workbox-sw.js'); //++Todo: Replace with local workbox.js
importScripts('../statics/js/idb.js');
@@ -31,7 +31,7 @@ async function readAllData(table) {
}
async function clearAllData(table) {
- console.log('clearAllData', table);
+ // console.log('clearAllData', table);
await idbKeyval.clearalldata(table)
}
@@ -108,9 +108,9 @@ if (workbox) {
return fetch(args.event.request, args.event.headers)
.then(function (res) {
myres = res
- console.log('1° ******* [[[ SERVICE-WORKER ]]] registerRoute fetch: -> ', args.event.request, res)
+ // console.log('1° ******* [[[ SERVICE-WORKER ]]] registerRoute fetch: -> ', args.event.request, res)
// LOAD FROM SERVER , AND SAVE INTO INDEXEDDB
- console.log('res.status', res.status)
+ // console.log('res.status', res.status)
if (res.status === 200) {
const clonedRes = res.clone();
clearAllData('todos')
@@ -333,82 +333,83 @@ if ('serviceWorker' in navigator) {
// });
-self.addEventListener('sync', function (event) {
- console.log('[Service Worker V5] Background syncing', event.tag);
-
- let mystrparam = event.tag
- let multiparams = mystrparam.split('|')
- if (multiparams) {
- if (multiparams.length > 3) {
- let cmd = multiparams[0]
- let table = multiparams[1]
- let method = multiparams[2]
- let token = multiparams[3]
- // let lang = multiparams[3]
-
- if (cmd === 'sync-todos') {
- console.log('[Service Worker] Syncing', cmd, table, method);
-
- const headers = new Headers()
- headers.append('content-Type', 'application/json')
- headers.append('Accept', 'application/json')
- headers.append('x-auth', token)
-
-
- // console.log('A1) INIZIO.............................................................');
-
- event.waitUntil(
- readAllData(table)
- .then(function (alldata) {
- const myrecs = [...alldata]
- console.log('----------------------- LEGGO QUALCOSA DAL WAITUNTIL ')
- if (myrecs) {
- for (let rec of myrecs) {
- //console.log('syncing', table, '', rec.descr)
- let link = cfgenv.serverweb + '/todos'
-
- if (method !== 'POST')
- link += '/' + rec._id
-
- console.log('++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
-
- // console.log('DATATOSAVE:', JSON.stringify(rec))
-
- // Insert/Delete/Update table to the server
- fetch(link, {
- method: method,
- headers: headers,
- mode: 'cors', // 'no-cors',
- body: JSON.stringify(rec)
- })
- .then(() => {
- deleteItemFromData(table, rec._id)
- deleteItemFromData('swmsg', mystrparam)
-
- // console.log('config WRITE ONLINE')
- writeData('config', { _id: 2, stateconn: 'online' })
- })
- .catch(function (err) {
- console.log('err', err, err.message)
- // console.log('DELETE : ', table, mystrparam)
-
- if (err.message === 'Failed to fetch') {
- // console.log('config WRITE OFFLINE')
- writeData('config', { _id: 2, stateconn: 'offline' })
- }
-
- console.log('!!!!!!!!!!!!!!! Error while sending data', err);
- })
- }
- }
- })
- );
- // console.log('A2) ?????????????????????????? ESCO DAL LOOP !!!!!!!!! err=')
- }
- }
- }
-})
-;
+// self.addEventListener('sync', function (event) {
+// console.log('[Service Worker V5] Background syncing', event.tag);
+//
+// let mystrparam = event.tag
+// let multiparams = mystrparam.split('|')
+// if (multiparams) {
+// if (multiparams.length > 3) {
+// let cmd = multiparams[0]
+// let table = multiparams[1]
+// let method = multiparams[2]
+// let token = multiparams[3]
+// // let lang = multiparams[3]
+//
+// if (cmd === 'sync-todos') {
+// console.log('[Service Worker] Syncing', cmd, table, method);
+//
+// const headers = new Headers()
+// headers.append('content-Type', 'application/json')
+// headers.append('Accept', 'application/json')
+// headers.append('x-auth', token)
+//
+//
+// // console.log('A1) INIZIO.............................................................');
+//
+// event.waitUntil(
+// readAllData(table)
+// .then(function (alldata) {
+// const myrecs = [...alldata]
+// console.log('----------------------- LEGGO QUALCOSA DAL WAITUNTIL ')
+// let errorfromserver = false
+// if (myrecs) {
+// for (let rec of myrecs) {
+// //console.log('syncing', table, '', rec.descr)
+// let link = cfgenv.serverweb + '/todos'
+//
+// if (method !== 'POST')
+// link += '/' + rec._id
+//
+// console.log('++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
+//
+// // console.log('DATATOSAVE:', JSON.stringify(rec))
+//
+// // Insert/Delete/Update table to the server
+// fetch(link, {
+// method: method,
+// headers: headers,
+// cache: 'no-cache',
+// mode: 'cors', // 'no-cors',
+// body: JSON.stringify(rec)
+// })
+// .then(() => {
+// deleteItemFromData(table, rec._id)
+// })
+// .then(() => {
+// deleteItemFromData('swmsg', mystrparam)
+// })
+// .catch(function (err) {
+// console.log('!!!!!!!!!!!!!!! Error while sending data', err, err.message);
+// if (err.message === 'Failed to fetch') {
+// errorfromserver = true
+// }
+// })
+// }
+// return errorfromserver
+// }
+// })
+// .then((errorfromserver) => {
+// const mystate = !errorfromserver ? 'online' : 'offline'
+// writeData('config', { _id: 2, stateconn: mystate })
+// })
+// );
+// // console.log('A2) ?????????????????????????? ESCO DAL LOOP !!!!!!!!! err=')
+// }
+// }
+// }
+// })
+// ;
/*
diff --git a/src/components/Header.vue b/src/components/Header.vue
index 2b6b97c..1311774 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -191,16 +191,16 @@
console.log('Event LOAD')
if (window) {
window.addEventListener('load', function () {
- console.log('2) ENTERING Event LOAD')
+ // console.log('2) ENTERING Event LOAD')
function updateOnlineStatus(event) {
if (navigator.onLine) {
- console.log('EVENT ONLINE!')
+ // console.log('EVENT ONLINE!')
// handle online status
GlobalStore.mutations.setStateConnection('online')
mythis.changeIconConn()
} else {
- console.log('EVENT OFFLINE!')
+ // console.log('EVENT OFFLINE!')
// handle offline status
GlobalStore.mutations.setStateConnection('offline')
mythis.changeIconConn()
diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts
index 1a0f6da..e3e9048 100644
--- a/src/components/todos/SingleTodo/SingleTodo.ts
+++ b/src/components/todos/SingleTodo/SingleTodo.ts
@@ -264,6 +264,15 @@ export default class SingleTodo extends Vue {
}
}
*/
+ if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
+ e.preventDefault()
+ this.clickMenu(rescodes.MenuAction.DELETE)
+ .then(() => {
+ this.deselectRiga()
+ this.faiFocus('insertTask', true)
+ return
+ })
+ }
if (((e.key === 'Enter') || (e.key === 'Tab')) && !e.shiftKey) {
this.updateTodo()
@@ -344,16 +353,16 @@ export default class SingleTodo extends Vue {
}
- clickMenu(action) {
+ async clickMenu(action) {
console.log('click menu: ', action)
if (action === rescodes.MenuAction.DELETE) {
- this.askConfirmDelete()
+ return this.askConfirmDelete()
} else if (action === rescodes.MenuAction.TOGGLE_EXPIRING) {
- this.enableExpiring()
+ return this.enableExpiring()
} else if (action === rescodes.MenuAction.COMPLETED) {
- this.setCompleted()
+ return this.setCompleted()
} else if (action === rescodes.MenuAction.PROGRESS_BAR) {
- this.updatedata()
+ return this.updatedata()
}
}
@@ -369,11 +378,11 @@ export default class SingleTodo extends Vue {
// this.$q.notify('setPriority: ' + elem)
}
- askConfirmDelete() {
+ async askConfirmDelete() {
const deletestr = this.$t('dialog.delete')
const cancelstr = this.$t('dialog.cancel')
- askConfirm(this.$q, this.$t('dialog.msg.titledeleteTask'), this.$t('dialog.msg.deleteTask').toString(), deletestr, cancelstr)
+ await askConfirm(this.$q, this.$t('dialog.msg.titledeleteTask'), this.$t('dialog.msg.deleteTask').toString(), deletestr, cancelstr)
.then(ris => {
console.log('ris', ris)
if (ris)
diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue
index 1c8a0ea..4531097 100644
--- a/src/components/todos/SingleTodo/SingleTodo.vue
+++ b/src/components/todos/SingleTodo/SingleTodo.vue
@@ -23,7 +23,7 @@
-