From e56e00c6fa665f6b3246d8fc0fcb038010ae218b Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 19 Jan 2023 10:05:21 +0100 Subject: [PATCH] comment develop stuff --- .../gabinete-digital/gabinete-digital.page.ts | 148 +++++++++--------- src/app/services/notifications.service.ts | 75 ++++----- .../all-processes/all-processes.page.ts | 2 +- version/git-version.ts | 12 +- 4 files changed, 116 insertions(+), 121 deletions(-) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index abb3cb545..546ec76f1 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -106,7 +106,7 @@ export class GabineteDigitalPage implements OnInit { AllProcess = [] - workerList : Worker + // workerList : Worker @ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage; @ViewChild(PendentesPage) pendentesListPage: PendentesPage; @@ -128,11 +128,11 @@ export class GabineteDigitalPage implements OnInit { public NotificationsService: NotificationsService ) { - this.workerList = new Worker(new URL('./list.worker.js', import.meta.url)); + // this.workerList = new Worker(new URL('./list.worker.js', import.meta.url)); - this.workerList.onmessage = (oEvent) => { - this.AllProcess = oEvent.data - } + // this.workerList.onmessage = (oEvent) => { + // this.AllProcess = oEvent.data + // } window.onresize = (event) => { // if not mobile remove all component @@ -197,70 +197,78 @@ export class GabineteDigitalPage implements OnInit { }); - this.NotificationsService.registerCallback( - 'despachos', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'despachos-pr', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'expediente', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'gabinete-digital', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'parecer', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'deferimento', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'diplomas-assinar', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'diplomas', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) - this.NotificationsService.registerCallback( - 'expedientes-pr', - () => { - this.LoadCounts(); - console.log('refresh with notification') - } - ) + // this.NotificationsService.registerCallback({ + // type:'despachos', + // funx:() => { + // // this.loadCount(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type:'*', + // funx:() => { + // // this.LoadCounts(); + // console.log('refresh with notification *') + // } + // }) + + // this.NotificationsService.registerCallback({ + // type:'despachos-pr', + // funx:() => { + // // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type:'expediente', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type:'gabinete-digital', + // funx:() => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type:'parecer', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type: 'deferimento', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type: 'diplomas-assinar', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type: 'diplomas', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) + // this.NotificationsService.registerCallback({ + // type: 'expedientes-pr', + // funx: () => { + // this.LoadCounts(); + // console.log('refresh with notification') + // } + // }) } @@ -578,7 +586,7 @@ export class GabineteDigitalPage implements OnInit { updateAllProcess() { this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) - .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList) + .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list) // try{ // this.workerList.postMessage([ @@ -591,8 +599,6 @@ export class GabineteDigitalPage implements OnInit { // .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) // .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList) // } - - } get getAllProcessCount() { diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index f6d7b6238..880e4506b 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -27,73 +27,59 @@ export class NotificationsService { folderId: string; DataArray = new Array(); - callbacks: { + + callbacks: {[key: string]: { type: notificationObject, funx: Function id: string - }[] = [] + }} = {} active = false constructor( private http: HttpClient, private storageService: StorageService, - private modalController: ModalController, public modalCtrl: AlertController, - private animationController: AnimationController, private platform: Platform, private router: Router, - private toastService: ToastService, private zone: NgZone, - private activeroute: ActivatedRoute, - private eventtrigger: EventTrigger, - private backgroundservice: BackgroundService, - /* private eventTriger: Events, */ - /* private fcm: FCM */) { + private eventtrigger: EventTrigger,) { } - registerCallback(type: notificationObject, funx: Function, object: any = {}) { - const id = uuidv4() - this.callbacks.push({ type, funx, id }) - if (!object.hasOwnProperty('desktop') && object['desktop'] != false) { - this.backgroundservice.registerBackService('Notification', funx, type) - } - return id; - } - - // registerCallback({type, funx, id = uuidv4()}:{ + // registerCallback({type, funx, id = uuidv4()} : { // type: notificationObject, // funx: Function // id?: string // }) { - - // this.callbacks.push({ type, funx, id }) - + // this.callbacks[id] = { funx, id, type} // return id; // } - private runNotificationCallback(notification) { - this.callbacks.forEach((data) => { - if(data.type == notification.data.IdObject) { - data.funx({notification}) - } else if (data.type == '*') { - } - }) - } + // private async runNotificationCallback(notification) { - deleteCallback(id) { - this.callbacks.forEach((e, index) => { - if (e.id == id) { - if (index > -1) { - this.callbacks.splice(index, 1); - } - } - }) + // for (const [key, value] of Object.entries(this.callbacks)) { + // if(value.type == notification.data.Object) { - } + // const dontRepeat = await value.funx(notification) + + // if(dontRepeat) { + // delete this.callbacks[key] + // } + + // } else if (value.type == '*') { + // const dontRepeat = await value.funx(notification) + + // if(dontRepeat) { + // delete this.callbacks[key] + // } + // } + + // } + + // } getTokenByUserIdAndId(user, userID) { // const geturl = environment.apiURL + 'notifications/user/' + userID; @@ -120,7 +106,7 @@ export class NotificationsService { PushNotifications.addListener('registration', (token: Token) => { - this.active = false + this.storageService.store(username, token.value); this.storageService.get(username).then(value => { @@ -135,6 +121,7 @@ export class NotificationsService { }; this.http.post(`${geturl}`, body, { headers }).subscribe(data => { + this.active = true //console.log(data) }, (error) => { //console.log(error) @@ -163,6 +150,7 @@ export class NotificationsService { onReciveForeground() { PushNotifications.addListener('pushNotificationReceived', (notification: PushNotificationSchema) => { + this.active = true console.log(notification) //this.DataArray.push(notification) //console.log(this.DataArray) @@ -176,7 +164,7 @@ export class NotificationsService { } }) - this.runNotificationCallback(notification) + // this.runNotificationCallback(notification) /* this.eventTriger.publish('notificatioRecive') */ this.eventtrigger.publishSomeData({ notification: "recive" @@ -188,6 +176,7 @@ export class NotificationsService { onReciveBackground() { PushNotifications.addListener('pushNotificationActionPerformed', (notification: ActionPerformed) => { + this.active = true console.log(notification) /* this.DataArray.push(notification.notification) @@ -196,7 +185,7 @@ export class NotificationsService { notification: "recive" }) */ this.notificatinsRoutes(notification) - this.runNotificationCallback(notification) + // this.runNotificationCallback(notification) } ); } diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts index 768e4222a..20e77969e 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts @@ -76,7 +76,7 @@ export class AllProcessesPage implements OnInit { updateAllProcess() { this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) - .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList) + .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list) } get getAllProcessCount() { diff --git a/version/git-version.ts b/version/git-version.ts index 6858ce4c2..4f6b9f534 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "d08eeeba6", - "SHA": "d08eeeba6cb3dd25ebc61c4e3491d5de3b31815e", + "shortSHA": "6195400e0", + "SHA": "6195400e08d52057dbf000709fab5a00a9bf39fa", "branch": "no_bug_movemente", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Wed Jan 18 17:11:06 2023 +0100'", - "lastCommitMessage": "save", - "lastCommitNumber": "4655", + "lastCommitTime": "'Wed Jan 18 17:18:08 2023 +0100'", + "lastCommitMessage": "all process", + "lastCommitNumber": "4656", "change": "", - "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.ts", + "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file