Some changes

This commit is contained in:
Eudes Inácio
2021-11-03 12:21:19 +01:00
parent f61723599e
commit d7745a1ed3
9 changed files with 392 additions and 218 deletions
+2
View File
@@ -20,6 +20,7 @@
<preference name="SplashShowOnlyFirstTime" value="false" /> <preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" /> <preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" /> <preference name="SplashScreenDelay" value="3000" />
<preference name="android-minSdkVersion" value="20" />
<platform name="android"> <platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="@xml/network_security_config" /> <application android:networkSecurityConfig="@xml/network_security_config" />
@@ -91,4 +92,5 @@
<mfp:SDKProtocolVersion>2</mfp:SDKProtocolVersion> <mfp:SDKProtocolVersion>2</mfp:SDKProtocolVersion>
<allow-navigation href="http://localhost:8100" sessionid="9714472a" /> <allow-navigation href="http://localhost:8100" sessionid="9714472a" />
<allow-navigation href="http://localhost:8101" sessionid="4721f88c" /> <allow-navigation href="http://localhost:8101" sessionid="4721f88c" />
<plugin name="cordova-plugin-dbcopy" spec="https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" />
</widget> </widget>
+120 -8
View File
@@ -2235,6 +2235,21 @@
"resolved": "https://registry.npmjs.org/@ionic-native/fingerprint-aio/-/fingerprint-aio-4.20.0.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/fingerprint-aio/-/fingerprint-aio-4.20.0.tgz",
"integrity": "sha512-DhdXVG7gdBtCwYHDAsNazIcMlyt6X968ilA/5Rt8uFd+xN4Un5gZteOJCVn9xWDC/ZqhO/QAq2M0BIGyEhzW0g==" "integrity": "sha512-DhdXVG7gdBtCwYHDAsNazIcMlyt6X968ilA/5Rt8uFd+xN4Un5gZteOJCVn9xWDC/ZqhO/QAq2M0BIGyEhzW0g=="
}, },
"@ionic-native/firebase-x": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/firebase-x/-/firebase-x-5.36.0.tgz",
"integrity": "sha512-h6jfTFqvABwugir5tsAzyvUWdu0EZg1PnWW0EkQy3CRg/qQlcjiDJW8pqyq1l84UDJQ7fxiTvbmX0Jod2BFE3w==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/http": { "@ionic-native/http": {
"version": "5.36.0", "version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/http/-/http-5.36.0.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/http/-/http-5.36.0.tgz",
@@ -5288,6 +5303,15 @@
} }
} }
}, },
"bplist-creator": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz",
"integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==",
"dev": true,
"requires": {
"stream-buffers": "2.2.x"
}
},
"bplist-parser": { "bplist-parser": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",
@@ -6963,10 +6987,9 @@
"integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4=", "integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4=",
"dev": true "dev": true
}, },
"cordova-plugin-crosswalk-webview": { "cordova-plugin-dbcopy": {
"version": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git#58dda06c97609c6a0699b8d0691ad603901625ce", "version": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git#861f585e4313db828d6b8c7d354c32c83373d0d2",
"from": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git", "from": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git"
"dev": true
}, },
"cordova-plugin-device": { "cordova-plugin-device": {
"version": "2.0.3", "version": "2.0.3",
@@ -6981,12 +7004,20 @@
"dev": true "dev": true
}, },
"cordova-plugin-fcm-with-dependecy-updated": { "cordova-plugin-fcm-with-dependecy-updated": {
"version": "7.8.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-fcm-with-dependecy-updated/-/cordova-plugin-fcm-with-dependecy-updated-7.8.0.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-fcm-with-dependecy-updated/-/cordova-plugin-fcm-with-dependecy-updated-7.2.0.tgz",
"integrity": "sha512-p2pbY1oqQ2UDbaWOWA2z84uMXmdDGYmK2O+mrufj1bZyoFodt7WqrtiB9oDnUuSSinMrdNFrupiWEDMSBSNVeQ==", "integrity": "sha512-Iv1gOeoQ4l/1ztBLemgLOCS4iaVemHezfpa5/X+iqS4apfvUVLJ47Vw6KO7deBO2d2ElvrGZ2ayZX7j3uhtsRw==",
"dev": true, "dev": true,
"requires": { "requires": {
"typescript": "^4.1.3" "typescript": "^3.9.6"
},
"dependencies": {
"typescript": {
"version": "3.9.10",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
"dev": true
}
} }
}, },
"cordova-plugin-file": { "cordova-plugin-file": {
@@ -7006,6 +7037,18 @@
"integrity": "sha512-Mmm/Ee85s4JH7qL3yikQ2J2I2vY2XbNi1fttoEK2kI++YHr/WeqPHWGREFL7bmFYjZTph/JovhfWHPGV924WjQ==", "integrity": "sha512-Mmm/Ee85s4JH7qL3yikQ2J2I2vY2XbNi1fttoEK2kI++YHr/WeqPHWGREFL7bmFYjZTph/JovhfWHPGV924WjQ==",
"dev": true "dev": true
}, },
"cordova-plugin-firebasex": {
"version": "13.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-firebasex/-/cordova-plugin-firebasex-13.0.1.tgz",
"integrity": "sha512-p9V8tJzT5ouRKhfz9Vo6uEdv0BvMJldXBrrw61H/0smT5JzJFcHu/BekhbIsF5yrpBSIwdSK15JA04JA4EtL3w==",
"dev": true,
"requires": {
"plist": "^3.0.1",
"semver": "^7.3.2",
"xcode": "^3.0.1",
"xml-js": "^1.6.11"
}
},
"cordova-plugin-globalization": { "cordova-plugin-globalization": {
"version": "1.11.0", "version": "1.11.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-globalization/-/cordova-plugin-globalization-1.11.0.tgz",
@@ -10139,6 +10182,12 @@
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"dev": true "dev": true
}, },
"es6-promise-plugin": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz",
"integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA==",
"dev": true
},
"es6-promisify": { "es6-promisify": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
@@ -21053,6 +21102,28 @@
} }
} }
}, },
"simple-plist": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
"integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
"dev": true,
"requires": {
"bplist-creator": "0.1.0",
"bplist-parser": "0.3.0",
"plist": "^3.0.4"
},
"dependencies": {
"bplist-parser": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
"integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
"dev": true,
"requires": {
"big-integer": "1.6.x"
}
}
}
},
"simple-swizzle": { "simple-swizzle": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
@@ -21624,6 +21695,12 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
}, },
"stream-buffers": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz",
"integrity": "sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ=",
"dev": true
},
"stream-throttle": { "stream-throttle": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/stream-throttle/-/stream-throttle-0.1.3.tgz", "resolved": "https://registry.npmjs.org/stream-throttle/-/stream-throttle-0.1.3.tgz",
@@ -25031,11 +25108,46 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz",
"integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==" "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w=="
}, },
"xcode": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/xcode/-/xcode-3.0.1.tgz",
"integrity": "sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==",
"dev": true,
"requires": {
"simple-plist": "^1.1.0",
"uuid": "^7.0.3"
},
"dependencies": {
"uuid": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==",
"dev": true
}
}
},
"xdg-basedir": { "xdg-basedir": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==" "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q=="
}, },
"xml-js": {
"version": "1.6.11",
"resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz",
"integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
"dev": true,
"requires": {
"sax": "^1.2.4"
},
"dependencies": {
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
}
}
},
"xml-name-validator": { "xml-name-validator": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
+34 -8
View File
@@ -46,6 +46,7 @@
"@ionic-native/file": "^5.36.0", "@ionic-native/file": "^5.36.0",
"@ionic-native/file-path": "^5.30.0", "@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0", "@ionic-native/fingerprint-aio": "^4.20.0",
"@ionic-native/firebase-x": "^5.36.0",
"@ionic-native/http": "^5.31.1", "@ionic-native/http": "^5.31.1",
"@ionic-native/image-picker": "^5.36.0", "@ionic-native/image-picker": "^5.36.0",
"@ionic-native/in-app-browser": "^5.28.0", "@ionic-native/in-app-browser": "^5.28.0",
@@ -79,6 +80,7 @@
"build": "0.1.4", "build": "0.1.4",
"ci": "^2.1.1", "ci": "^2.1.1",
"cordova": "^10.0.0", "cordova": "^10.0.0",
"cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git",
"cordova-plugin-filepath": "^1.5.8", "cordova-plugin-filepath": "^1.5.8",
"cordova-plugin-okhttp": "^2.0.0", "cordova-plugin-okhttp": "^2.0.0",
"cordova-res": "^0.15.3", "cordova-res": "^0.15.3",
@@ -141,12 +143,12 @@
"cordova-plugin-androidx": "^3.0.0", "cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3", "cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-compat": "^1.2.0", "cordova-plugin-compat": "^1.2.0",
"cordova-plugin-crosswalk-webview": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git",
"cordova-plugin-device": "^2.0.2", "cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2", "cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.8.0", "cordova-plugin-fcm-with-dependecy-updated": "^7.2.0",
"cordova-plugin-file": "^6.0.2", "cordova-plugin-file": "^6.0.2",
"cordova-plugin-fingerprint-aio": "^4.0.2", "cordova-plugin-fingerprint-aio": "^4.0.2",
"cordova-plugin-firebasex": "^13.0.1",
"cordova-plugin-globalization": "^1.11.0", "cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-inappbrowser": "^4.0.0", "cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-keyboard": "^2.2.0",
@@ -161,6 +163,7 @@
"cordova-plugin-streaming-media": "^2.3.0", "cordova-plugin-streaming-media": "^2.3.0",
"cordova-plugin-telerik-imagepicker": "^2.3.6", "cordova-plugin-telerik-imagepicker": "^2.3.6",
"cordova-plugin-whitelist": "^1.3.4", "cordova-plugin-whitelist": "^1.3.4",
"es6-promise-plugin": "^4.2.2",
"jasmine-core": "~3.6.0", "jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
"jest": "^27.0.6", "jest": "^27.0.6",
@@ -195,13 +198,36 @@
"cordova-plugin-screen-orientation": {}, "cordova-plugin-screen-orientation": {},
"cordova-plugin-network-information": {}, "cordova-plugin-network-information": {},
"cordova-plugin-file": {}, "cordova-plugin-file": {},
"cordova-plugin-firebasex": {
"FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
"FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
"ANDROID_ICON_ACCENT": "#FF00FFFF",
"ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
"ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
"ANDROID_PLAY_SERVICES_AUTH_VERSION": "19.0.0",
"ANDROID_FIREBASE_ANALYTICS_VERSION": "19.0.0",
"ANDROID_FIREBASE_MESSAGING_VERSION": "22.0.0",
"ANDROID_FIREBASE_CONFIG_VERSION": "21.0.0",
"ANDROID_FIREBASE_PERF_VERSION": "20.0.2",
"ANDROID_FIREBASE_AUTH_VERSION": "21.0.1",
"ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "20.0.0",
"ANDROID_FIREBASE_FIRESTORE_VERSION": "23.0.2",
"ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.0.0",
"ANDROID_FIREBASE_IID_VERSION": "21.1.0",
"ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.0.0",
"ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.1.0",
"ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.1.0",
"ANDROID_GSON_VERSION": "2.8.7",
"ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.0"
},
"cordova-plugin-fcm-with-dependecy-updated": { "cordova-plugin-fcm-with-dependecy-updated": {
"ANDROID_GRADLE_TOOLS_VERSION": "4.1.0", "ANDROID_FCM_VERSION": "19.0.0",
"ANDROID_GOOGLE_SERVICES_VERSION": "4.3.4", "ANDROID_GRADLE_TOOLS_VERSION": "3.5.3",
"ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher", "ANDROID_GOOGLE_SERVICES_VERSION": "4.3.3",
"ANDROID_FCM_VERSION": "21.0.0", "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
"ANDROID_FIREBASE_BOM_VERSION": "26.0.0" },
} "cordova-plugin-dbcopy": {}
}, },
"platforms": [ "platforms": [
"browser", "browser",
+3
View File
@@ -66,6 +66,8 @@ import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx'; import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
import { FCM } from '@ionic-native/fcm/ngx'; import { FCM } from '@ionic-native/fcm/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
@@ -114,6 +116,7 @@ import { FCM } from '@ionic-native/fcm/ngx';
WebView, WebView,
FilePath, FilePath,
FCM, FCM,
FirebaseX,
WebsocketService, WebsocketService,
ChatService, ChatService,
ScreenOrientation, ScreenOrientation,
+18 -3
View File
@@ -26,6 +26,8 @@ import { Storage } from '@ionic/storage';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@@ -86,7 +88,8 @@ export class HomePage implements OnInit {
private offlinemanager: OfflineManagerService, private offlinemanager: OfflineManagerService,
private storage: Storage, private storage: Storage,
private eventservice: EventsService, private eventservice: EventsService,
private screenOrientation: ScreenOrientation) { private screenOrientation: ScreenOrientation,
private firebaseX: FirebaseX) {
this.webNotificationPopupService.askNotificationPermission() this.webNotificationPopupService.askNotificationPermission()
@@ -116,6 +119,18 @@ export class HomePage implements OnInit {
ngOnInit() { ngOnInit() {
this.notificationsService.onReceviNotification();
this.firebaseX.getToken()
.then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
.catch(error => console.error('Error getting token', error));
this.firebaseX.onMessageReceived()
.subscribe(data => console.log(`User opened a notification ${data}`));
this.firebaseX.onTokenRefresh()
.subscribe((token: string) => console.log(`Got a new token ${token}`));
window.addEventListener('online', () => { window.addEventListener('online', () => {
console.log('Became online') console.log('Became online')
this.backgroundservice.online() this.backgroundservice.online()
@@ -136,13 +151,13 @@ export class HomePage implements OnInit {
this.updateList() this.updateList()
var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url)); /* var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url));
myWorker.onmessage = function (oEvent) { myWorker.onmessage = function (oEvent) {
console.log('Worker said : ' + oEvent.data); console.log('Worker said : ' + oEvent.data);
} }
myWorker.postMessage('ali'); myWorker.postMessage('ali'); */
} }
/* mobilefirstConnect() { /* mobilefirstConnect() {
+2 -2
View File
@@ -1,5 +1,5 @@
postMessage("I\'m working before postMessage(\'ali\')."); /* postMessage("I\'m working before postMessage(\'ali\').");
onmessage = function(oEvent) { onmessage = function(oEvent) {
postMessage('Hi ' + oEvent.data); postMessage('Hi ' + oEvent.data);
}; }; */
+6
View File
@@ -121,6 +121,12 @@ export class EventsPage implements OnInit {
ngOnInit() { ngOnInit() {
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
this.segment = "Combinada"; this.segment = "Combinada";
this.profile = "mdgpr"; this.profile = "mdgpr";
+33 -28
View File
@@ -9,7 +9,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants'; import { AuthConnstants } from 'src/app/config/auth-constants';
import { Token } from '../models/token.model'; import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras,Router } from '@angular/router'; import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from '../services/toast.service'; import { ToastService } from '../services/toast.service';
import { JsonStore } from './jsonStore.service'; import { JsonStore } from './jsonStore.service';
import { BackgroundService } from './background.service'; import { BackgroundService } from './background.service';
@@ -18,6 +18,7 @@ import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { FCM } from '@ionic-native/fcm/ngx'; import { FCM } from '@ionic-native/fcm/ngx';
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -52,27 +53,27 @@ export class NotificationsService {
this.storageService.get("Notifications").then((value) => { this.storageService.get("Notifications").then((value) => {
}).catch(()=>{ }).catch(() => {
this.storageService.store("Notifications",[]) this.storageService.store("Notifications", [])
}) })
} }
registerCallback(type: string, funx: Function, object: any = {} ) { registerCallback(type: string, funx: Function, object: any = {}) {
const id = uuidv4() const id = uuidv4()
this.callbacks.push({type, funx, id}) this.callbacks.push({ type, funx, id })
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) { if (!object.hasOwnProperty('desktop') && object['desktop'] != false) {
this.backgroundservice.registerBackService('Notification',funx, type) this.backgroundservice.registerBackService('Notification', funx, type)
} }
return id; return id;
} }
deleteCallback(id) { deleteCallback(id) {
this.callbacks.forEach((e, index)=>{ this.callbacks.forEach((e, index) => {
if(e.id == id) { if (e.id == id) {
if (index > -1) { if (index > -1) {
this.callbacks.splice(index, 1); this.callbacks.splice(index, 1);
} }
@@ -88,7 +89,7 @@ export class NotificationsService {
} }
getAndpostToken(username) { getAndpostToken(username) {
if(this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported') console.log('Notifications not supported')
} else { } else {
@@ -127,15 +128,19 @@ export class NotificationsService {
this.notificatinsRoutes(data) this.notificatinsRoutes(data)
} /* else { } else {
console.log("Received in foreground: ", data); console.log("Received in foreground: ", data);
console.log(data.Service) console.log(data.Service)
console.log(data.Object) console.log(data.Object)
console.log(data.IdObject) console.log(data.IdObject)
this.openApproveModal(data.IdObject);
}; */ /* this.DataArray.push(data)
console.log("On ReceiveNotification", this.DataArray)
this.storageService.store("Notifications", this.DataArray) */
};
}); });
} }
@@ -148,7 +153,7 @@ export class NotificationsService {
return this.http.get<Token[]>(`${geturl}`); return this.http.get<Token[]>(`${geturl}`);
} }
*/ */
/* getAndpostToken(username) { /* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
//console.log('Notifications not supported') //console.log('Notifications not supported')
@@ -210,11 +215,11 @@ export class NotificationsService {
} */ } */
tempClearArray(){ tempClearArray() {
this.DataArray = []; this.DataArray = [];
} }
/* async onReceviNotification() { /* async onReceviNotification() {
if(window['WLAuthorizationManager']) { if(window['WLAuthorizationManager']) {
if(window['WLAuthorizationManager'].obtainAccessToken) { if(window['WLAuthorizationManager'].obtainAccessToken) {
@@ -280,34 +285,34 @@ export class NotificationsService {
this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda'])); this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda']));
} }
else if (data.Service === "gabinete-digital" && data.Object === "expediente") { else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',data.IdObject,'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', data.IdObject, 'gabinete-digital']));
} }
else if (data.Service === "agenda" && data.Object === "event-list") { else if (data.Service === "agenda" && data.Object === "event-list") {
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event',data.IdObject, 'agenda'])); this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', data.IdObject, 'agenda']));
}else if (data.Service === "gabinete-digital" && data.Object === "despachos") { } else if (data.Service === "gabinete-digital" && data.Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos',data.IdObject,'gabinete-digital'],{replaceUrl: true})); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
} }
else if (data.Service === "gabinete-digital" && data.Object === "parecer") { else if (data.Service === "gabinete-digital" && data.Object === "parecer") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', data.IdObject, 'gabinete-digital']));
} }
else if (data.Service === "gabinete-digital" && data.Object === "deferimento") { else if (data.Service === "gabinete-digital" && data.Object === "deferimento") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', data.IdObject, 'gabinete-digital']));
} }
else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") { else if (data.Service === "gabinete-digital" && data.Object === "despachos-pr") {
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/despachos-pr',data.IdObject,'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', data.IdObject, 'gabinete-digital']));
} }
else if (data.Service === "accoes" && data.Object === "accao") { else if (data.Service === "accoes" && data.Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject])); this.zone.run(() => this.router.navigate(['/home/publications', data.IdObject]));
} }
else if (data.Service === "accoes" && data.Object === "publicacao") { else if (data.Service === "accoes" && data.Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications',data.FolderId,data.IdObject])); this.zone.run(() => this.router.navigate(['/home/publications/view-publications', data.FolderId, data.IdObject]));
} }
else if (data.Service === "gabinete-digital" && data.Object === "diplomas") { else if (data.Service === "gabinete-digital" && data.Object === "diplomas") {
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas', data.IdObject, 'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', data.IdObject, 'gabinete-digital']));
} }
else if (data.Service === "gabinete-digital" && data.Object === "diplomas-assinar") { else if (data.Service === "gabinete-digital" && data.Object === "diplomas-assinar") {
let navigationExtras: NavigationExtras = { let navigationExtras: NavigationExtras = {
@@ -315,10 +320,10 @@ export class NotificationsService {
"serialNumber": data.IdObject, "serialNumber": data.IdObject,
} }
}; };
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras)); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras));
} }
else if (data.Service === "gabinete-digital" && data.Object === "expedientes-pr") { else if (data.Service === "gabinete-digital" && data.Object === "expedientes-pr") {
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/expedientes-pr',data.IdObject,'gabinete-digital'])); this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', data.IdObject, 'gabinete-digital']));
} }
} }
+6 -1
View File
@@ -26,10 +26,13 @@ export class SqliteService {
} }
databaseConn() { databaseConn() {
console.log('SQLDBConnect')
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else { } else {
console.log('SQLDBConnect22')
this.platform.ready().then(async () => { this.platform.ready().then(async () => {
await this.sqlite.create({ console.log('SQLDBConnect33')
this.sqlite.create({
name: this.db_name, name: this.db_name,
location: 'default' location: 'default'
}).then(async (sqLite: SQLiteObject) => { }).then(async (sqLite: SQLiteObject) => {
@@ -126,6 +129,8 @@ export class SqliteService {
.catch((error) => console.log(JSON.stringify(error))); .catch((error) => console.log(JSON.stringify(error)));
}) })
.catch((error) => console.log(JSON.stringify(error))); .catch((error) => console.log(JSON.stringify(error)));
}).catch((error) => {
console.log('Platform ready error', error)
}); });
} }
} }