diff --git a/.env.development b/.env.development
index c1e8448..e032ebc 100644
--- a/.env.development
+++ b/.env.development
@@ -1,4 +1,4 @@
-APP_VERSION="DEV 0.0.17"
+APP_VERSION="DEV 0.0.27"
SERVICE_WORKER_FILE='service-worker.js'
APP_ID='1'
APP_URL='https://freeplanet.app'
diff --git a/src-pwa/custom-service-worker.js b/src-pwa/custom-service-worker.js
index 8ab8af3..43ee1de 100644
--- a/src-pwa/custom-service-worker.js
+++ b/src-pwa/custom-service-worker.js
@@ -6,11 +6,11 @@
// Questo è il swSrc
-console.log(' [ VER-0.0.21 ] _---------________------ PAO: this is my custom service worker');
+console.log(' [ VER-0.0.27 ] _---------________------ 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');
importScripts('../statics/js/storage.js');
+importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.0.0/workbox-sw.js'); //++Todo: Replace with local workbox.js
let port = 3000;
@@ -24,6 +24,9 @@ const cfgenv = {
dbversion: 11,
}
+// console.log('serverweb', cfgenv.serverweb)
+
+
async function writeData(table, data) {
// console.log('writeData', table, data);
await idbKeyval.setdata(table, data);
@@ -54,10 +57,10 @@ async function deleteItemFromData(table, id) {
if (!workbox) {
let workbox = new self.WorkboxSW();
- // console.log('SW-06 3');
}
if (workbox) {
+ // console.log('WORKBOX PRESENT')
// const url = new URL(location.href);
// const debug = url.searchParams.has('debug');
const debug = false;
@@ -101,11 +104,12 @@ if (workbox) {
})
);
+ // console.log(' routing.registerRoute function declaration:')
workbox.routing.registerRoute(
new RegExp(cfgenv.serverweb + '/todos/'),
function (args) {
- // console.log('registerRoute!')
+ console.log('registerRoute! ', cfgenv.serverweb + '/todos/')
// console.log('DATABODY:', args.event.request.body)
let myres = null
// return fetch(args.event.request, args.event.headers)
@@ -117,8 +121,11 @@ if (workbox) {
// console.log('res.status', res.status)
if (res.status === 200) {
const clonedRes = res.clone();
- clearAllData('todos')
- return clonedRes
+
+ return clearAllData('todos')
+ .then(() => {
+ return clonedRes
+ })
}
})
.then((clonedRes) => {
@@ -126,12 +133,12 @@ if (workbox) {
return clonedRes.json();
return null
})
- .then(data => {
+ .then(async data => {
if (data) {
if (data.todos) {
- console.log('Records TODOS Received from Server [', data.todos.length, 'record]', data.todos)
- for (let key in data.todos) {
- writeData('todos', data.todos[key])
+ console.log('***********************+++++++++++++++++++++++++++++++++++++++++++++++++++********** Records TODOS Received from Server [', data.todos.length, 'record]', data.todos)
+ for (const key in data.todos) {
+ await writeData('todos', data.todos[key])
}
}
}
@@ -483,21 +490,30 @@ self.addEventListener('push', function (event) {
var data = { title: 'New!', content: 'Something new happened!', url: '/' };
- if (event.data) {
- data = JSON.parse(event.data.text());
- }
+ try {
- var options = {
- body: data.content,
- icon: '/statics/icons/android-chrome-192x192.png',
- badge: '/statics/icons/android-chrome-192x192.png',
- data: {
- url: data.url
+ if (event.data) {
+ try {
+ data = JSON.parse(event.data.text());
+ } catch (e) {
+ data = event.data.text();
+ }
}
- };
- event.waitUntil(
- self.registration.showNotification(data.title, options)
- );
+ var options = {
+ body: data.content,
+ icon: '/statics/icons/android-chrome-192x192.png',
+ badge: '/statics/icons/android-chrome-192x192.png',
+ data: {
+ url: data.url
+ }
+ };
+
+ event.waitUntil(
+ self.registration.showNotification(data.title, options)
+ );
+ } catch (e) {
+ console.log('Error on event push:', e)
+ }
});
diff --git a/src/App.ts b/src/App.ts
index bee552c..3ce9f38 100644
--- a/src/App.ts
+++ b/src/App.ts
@@ -12,7 +12,6 @@ import globalroutines from './globalroutines/index'
import { GlobalStore } from './store/Modules'
-
@Component({
components: {
appHeader: Header
@@ -25,6 +24,7 @@ export default class App extends Vue {
public backgroundColor = 'whitesmoke'
public $q
+ public listaRoutingNoLogin = ['/vreg?', '/offline']
created() {
if (process.env.DEV) {
@@ -36,16 +36,30 @@ export default class App extends Vue {
// console.info(process.env)
}
- UserStore.actions.autologin_FromLocalStorage()
- .then((loadstorage) => {
- if (loadstorage) {
- globalroutines(this, 'loadapp', '')
- // this.$router.replace('/')
+ // Make autologin only if some routing
+
+ // console.log('window.location.href', window.location.href)
+
+ let chiamaautologin = true
+ this.listaRoutingNoLogin.forEach(mystr => {
+ if (window.location.href.includes(mystr)) {
+ chiamaautologin = false
+ }
+ })
+
+ if (chiamaautologin) {
+ console.log('CHIAMA autologin_FromLocalStorage')
+ UserStore.actions.autologin_FromLocalStorage()
+ .then((loadstorage) => {
+ if (loadstorage) {
+ globalroutines(this, 'loadapp', '')
+ // this.$router.replace('/')
// Create Subscription to Push Notification
- GlobalStore.actions.createPushSubscription()
- }
- })
+ GlobalStore.actions.createPushSubscription()
+ }
+ })
+ }
// Calling the Server for updates ?
// Check the verified_email
@@ -53,5 +67,4 @@ export default class App extends Vue {
}
-
}
diff --git a/src/components/Header.vue b/src/components/Header.vue
index 4f5a7bd..049b2ae 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -111,11 +111,11 @@
this.strConn = value
- this.$q.notify({
- color : 'primary',
- icon: 'wifi',
- message: "CAMBIATOO! " + value
- })
+ // this.$q.notify({
+ // color : 'primary',
+ // icon: 'wifi',
+ // message: "CAMBIATOO! " + value
+ // })
}
@@ -124,7 +124,7 @@
changeconn_changed(value: string, oldValue: string) {
if (value != oldValue) {
- console.log('SSSSSSSS: ', value, oldValue)
+ // console.log('SSSSSSSS: ', value, oldValue)
const color = (value === 'online') ? 'positive' : 'warning'
diff --git a/src/components/todos/SingleTodo/SingleTodo.scss b/src/components/todos/SingleTodo/SingleTodo.scss
index 9ea75a7..4eebdb8 100644
--- a/src/components/todos/SingleTodo/SingleTodo.scss
+++ b/src/components/todos/SingleTodo/SingleTodo.scss
@@ -78,7 +78,10 @@ $heightitem: 19px;
padding: 0px;
text-align: center;
vertical-align: middle;
- display: none;
+ display: block;
+ @media screen and (min-width: 600px) {
+ display: none;
+ }
color: #777;
height: 100%;
//visibility: hidden;
@@ -291,6 +294,7 @@ $heightitem: 19px;
}
+
/*
.container {
background-color: #ccc;
diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts
index e3e9048..813ab95 100644
--- a/src/components/todos/SingleTodo/SingleTodo.ts
+++ b/src/components/todos/SingleTodo/SingleTodo.ts
@@ -266,9 +266,9 @@ export default class SingleTodo extends Vue {
*/
if (((e.keyCode === 8) || (e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
e.preventDefault()
+ this.deselectRiga()
this.clickMenu(rescodes.MenuAction.DELETE)
.then(() => {
- this.deselectRiga()
this.faiFocus('insertTask', true)
return
})
@@ -356,13 +356,13 @@ export default class SingleTodo extends Vue {
async clickMenu(action) {
console.log('click menu: ', action)
if (action === rescodes.MenuAction.DELETE) {
- return this.askConfirmDelete()
+ return await this.askConfirmDelete()
} else if (action === rescodes.MenuAction.TOGGLE_EXPIRING) {
- return this.enableExpiring()
+ return await this.enableExpiring()
} else if (action === rescodes.MenuAction.COMPLETED) {
- return this.setCompleted()
+ return await this.setCompleted()
} else if (action === rescodes.MenuAction.PROGRESS_BAR) {
- return this.updatedata()
+ return await this.updatedata()
}
}
diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue
index 4531097..68ffee7 100644
--- a/src/components/todos/SingleTodo/SingleTodo.vue
+++ b/src/components/todos/SingleTodo/SingleTodo.vue
@@ -4,16 +4,6 @@