From e24f4010e0b8d94a232bf8d2f5ba88c6fe8d6256 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 16 Jan 2023 12:08:38 +0100 Subject: [PATCH 1/2] fix notification --- .gitignore | 1 + android/app/google-services.json | 40 ++++++++++++++++++++++++++++++++ version/git-version.ts | 14 +++++------ 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 android/app/google-services.json diff --git a/.gitignore b/.gitignore index 99de21535..dc12bb2b1 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ android/** !android/app/ android/app/** !android/app/src +!android/app/google-services.json android/app/src/** !android/app/src/build.gradle !android/app/src/main diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 000000000..0a455bcff --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,40 @@ +{ + "project_info": { + "project_number": "800733765231", + "firebase_url": "https://gabinete-digital-2020.firebaseio.com", + "project_id": "gabinete-digital-2020", + "storage_bucket": "gabinete-digital-2020.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:800733765231:android:e7ffc0b310037d9f13779a", + "android_client_info": { + "package_name": "com.gpr.gabinetedigital" + } + }, + "oauth_client": [ + { + "client_id": "800733765231-92oa7ib62ob0pkouphb5i5sp01vkalid.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD0pfW45DLoW6mqvZRklJdbfSTskW22Fok" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "800733765231-92oa7ib62ob0pkouphb5i5sp01vkalid.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/version/git-version.ts b/version/git-version.ts index 403496fa6..e9e3a9064 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "9493179ef", - "SHA": "9493179efd417b23a44287121490522196f5e105", - "branch": "no_bug_movemente", + "shortSHA": "7fbe4abdd", + "SHA": "7fbe4abddf5aadf72d781e9c140f6364b5f164e3", + "branch": "feature/ios-ui-fix", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Thu Jan 12 15:27:09 2023 +0100'", - "lastCommitMessage": "save all", - "lastCommitNumber": "4625", + "lastCommitTime": "'Mon Jan 16 09:06:12 2023 +0100'", + "lastCommitMessage": "save", + "lastCommitNumber": "4626", "change": "", - "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: .gitignore\n\tmodified: android/app/src/main/AndroidManifest.xml\n\tdeleted: android/app/src/main/res/drawable-land-ldpi/splash.png\n\tdeleted: android/app/src/main/res/drawable-port-ldpi/splash.png\n\tmodified: readme.md\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/services/chat/room.service.ts\n\tmodified: src/app/services/sqlite.service.ts", + "changeStatus": "On branch feature/ios-ui-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: .gitignore\n\tnew file: android/app/google-services.json", "changeAuthor": "peter.maquiran" } \ No newline at end of file From d43ce7fe0986edf85f256ec8b18c1a077f4cdbe7 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 16 Jan 2023 14:17:06 +0100 Subject: [PATCH 2/2] add event driven --- package.json | 3 ++- src/app/models/notifications.ts | 3 ++- src/app/services/notifications.service.ts | 29 ++++++++++++++++++++--- version/git-version.ts | 12 +++++----- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 25991aade..0b4d7ada1 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "dev:share": "lite-server --baseDir=share", "install:chromium": "node node_modules/puppeteer/install.js", "build:version": "node ./version/git-version.js", - "ionic-build": "ionic cap run android --prod" + "ionic-build": "ionic cap run android --prod", + "prepare": "husky install" }, "private": true, "dependencies": { diff --git a/src/app/models/notifications.ts b/src/app/models/notifications.ts index 769a2ad5c..97c38a9dd 100644 --- a/src/app/models/notifications.ts +++ b/src/app/models/notifications.ts @@ -13,6 +13,7 @@ const object = [ 'diplomas', 'expedientes-pr', 'despachos', + '*', ] as const; -export type IdObject = typeof object[number]; \ No newline at end of file +export type notificationObject = typeof object[number]; \ No newline at end of file diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index b069c6961..f6d7b6238 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -15,7 +15,7 @@ import { v4 as uuidv4 } from 'uuid'; import { EventTrigger } from '../services/eventTrigger.service'; import { SessionStore } from '../store/session.service'; import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications'; -import { IdObject } from '../models/notifications'; +import { notificationObject } from '../models/notifications'; /* import { Events } from 'ionic-angular' */ @Injectable({ @@ -28,7 +28,7 @@ export class NotificationsService { DataArray = new Array(); callbacks: { - type: string, + type: notificationObject, funx: Function id: string }[] = [] @@ -52,7 +52,7 @@ export class NotificationsService { /* private fcm: FCM */) { } - registerCallback(type: IdObject, funx: Function, object: any = {}) { + registerCallback(type: notificationObject, funx: Function, object: any = {}) { const id = uuidv4() this.callbacks.push({ type, funx, id }) @@ -63,6 +63,27 @@ export class NotificationsService { return id; } + // registerCallback({type, funx, id = uuidv4()}:{ + // type: notificationObject, + // funx: Function + // id?: string + // }) { + + // this.callbacks.push({ type, funx, id }) + + // return id; + // } + + private runNotificationCallback(notification) { + this.callbacks.forEach((data) => { + if(data.type == notification.data.IdObject) { + data.funx({notification}) + } else if (data.type == '*') { + + } + }) + } + deleteCallback(id) { this.callbacks.forEach((e, index) => { if (e.id == id) { @@ -155,6 +176,7 @@ export class NotificationsService { } }) + this.runNotificationCallback(notification) /* this.eventTriger.publish('notificatioRecive') */ this.eventtrigger.publishSomeData({ notification: "recive" @@ -174,6 +196,7 @@ export class NotificationsService { notification: "recive" }) */ this.notificatinsRoutes(notification) + this.runNotificationCallback(notification) } ); } diff --git a/version/git-version.ts b/version/git-version.ts index e9e3a9064..e8e644bff 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "7fbe4abdd", - "SHA": "7fbe4abddf5aadf72d781e9c140f6364b5f164e3", + "shortSHA": "e24f4010e", + "SHA": "e24f4010e0b8d94a232bf8d2f5ba88c6fe8d6256", "branch": "feature/ios-ui-fix", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Mon Jan 16 09:06:12 2023 +0100'", - "lastCommitMessage": "save", - "lastCommitNumber": "4626", + "lastCommitTime": "'Mon Jan 16 12:08:38 2023 +0100'", + "lastCommitMessage": "fix notification", + "lastCommitNumber": "4627", "change": "", - "changeStatus": "On branch feature/ios-ui-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: .gitignore\n\tnew file: android/app/google-services.json", + "changeStatus": "On branch feature/ios-ui-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: package.json\n\tmodified: src/app/models/notifications.ts\n\tmodified: src/app/services/notifications.service.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file