Remove IBM push notification and jsonstore, added cordova notifications

This commit is contained in:
Eudes Inácio
2021-10-30 16:51:29 +01:00
parent cd88f49469
commit f61723599e
13 changed files with 165 additions and 473 deletions
+2 -2
View File
@@ -47,7 +47,7 @@
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
</platform>
<mfp:android>
<mfp:sdkChecksum>1109370933</mfp:sdkChecksum>
<mfp:sdkChecksum>3077110622</mfp:sdkChecksum>
<mfp:appChecksum>3619450036</mfp:appChecksum>
<mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
@@ -81,7 +81,7 @@
</mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows>
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion>
<mfp:platformVersion>8.0.0.00-20210905-154328</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" />
+24 -419
View File
@@ -2192,6 +2192,21 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/fcm": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/fcm/-/fcm-5.36.0.tgz",
"integrity": "sha512-hToPT/4lqdaCc99sUYgnHM+DSFTe4WphF7Ia00QtwsNGW5/pS8w9iZSgppij5OJtwe67dNsuf2+PkxS4r7av/g==",
"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/file": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/file/-/file-5.36.0.tgz",
@@ -6965,6 +6980,15 @@
"integrity": "sha512-FUHI6eEVeoz2VkxbF0P56QlUQLGzXcvw3i4xuXyM9gEct6Y+FA3Xzgl2pJTZcTg5wRqLWzN08kgNoHPkom15pw==",
"dev": true
},
"cordova-plugin-fcm-with-dependecy-updated": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-fcm-with-dependecy-updated/-/cordova-plugin-fcm-with-dependecy-updated-7.8.0.tgz",
"integrity": "sha512-p2pbY1oqQ2UDbaWOWA2z84uMXmdDGYmK2O+mrufj1bZyoFodt7WqrtiB9oDnUuSSinMrdNFrupiWEDMSBSNVeQ==",
"dev": true,
"requires": {
"typescript": "^4.1.3"
}
},
"cordova-plugin-file": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-6.0.2.tgz",
@@ -8524,425 +8548,6 @@
}
}
},
"cordova-plugin-mfp-jsonstore": {
"version": "8.0.2021090603",
"resolved": "https://registry.npmjs.org/cordova-plugin-mfp-jsonstore/-/cordova-plugin-mfp-jsonstore-8.0.2021090603.tgz",
"integrity": "sha512-a8IqMSTkkGXe3bq0n8OamufVhcTHRX5EgZlA6kS+uy4m40h3BeaL78LglyW8Y5BJOVI5evJyTNt8FqI8qPPgdw==",
"dev": true,
"requires": {
"ibm-strings": "~0.1.0",
"mfp-config-xml": "0.0.5",
"npmlog": "0.0.6",
"shelljs": "0.3.0",
"xcode": "0.8.7"
},
"dependencies": {
"abbrev": {
"version": "1.1.1",
"bundled": true,
"dev": true
},
"ansi": {
"version": "0.3.1",
"bundled": true,
"dev": true
},
"are-we-there-yet": {
"version": "1.0.6",
"bundled": true,
"dev": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.0 || ^1.1.13"
}
},
"balanced-match": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"base64-js": {
"version": "0.0.6",
"bundled": true,
"dev": true
},
"bplist-creator": {
"version": "0.0.4",
"bundled": true,
"dev": true,
"requires": {
"stream-buffers": "~0.2.3"
}
},
"bplist-parser": {
"version": "0.0.6",
"bundled": true,
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"colors": {
"version": "1.1.2",
"bundled": true,
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
},
"core-util-is": {
"version": "1.0.3",
"bundled": true,
"dev": true
},
"delegates": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"elementtree": {
"version": "0.1.6",
"bundled": true,
"dev": true,
"requires": {
"sax": "0.3.5"
}
},
"extsprintf": {
"version": "1.2.0",
"bundled": true,
"dev": true
},
"findup-sync": {
"version": "0.3.0",
"bundled": true,
"dev": true,
"requires": {
"glob": "~5.0.0"
},
"dependencies": {
"glob": {
"version": "5.0.15",
"bundled": true,
"dev": true,
"requires": {
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "2 || 3",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
}
}
},
"gauge": {
"version": "1.2.7",
"bundled": true,
"dev": true,
"requires": {
"ansi": "^0.3.0",
"has-unicode": "^2.0.0",
"lodash.pad": "^4.1.0",
"lodash.padend": "^4.1.0",
"lodash.padstart": "^4.1.0"
}
},
"glob": {
"version": "7.0.3",
"bundled": true,
"dev": true,
"requires": {
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "2 || 3",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"has-unicode": {
"version": "2.0.1",
"bundled": true,
"dev": true
},
"ibm-strings": {
"version": "0.1.4",
"bundled": true,
"dev": true,
"requires": {
"colors": "1.1.2",
"nopt": "3.0.6"
}
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
},
"isarray": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"lodash-node": {
"version": "2.4.1",
"bundled": true,
"dev": true
},
"lodash.pad": {
"version": "4.5.1",
"bundled": true,
"dev": true
},
"lodash.padend": {
"version": "4.6.1",
"bundled": true,
"dev": true
},
"lodash.padstart": {
"version": "4.6.1",
"bundled": true,
"dev": true
},
"mfp-config-xml": {
"version": "0.0.5",
"bundled": true,
"dev": true,
"requires": {
"elementtree": "0.1.6",
"findup-sync": "0.3.0",
"glob": "7.0.3",
"ibm-strings": "0.1.4",
"npmlog": "2.0.2",
"q": "1.4.1",
"underscore": "1.8.3",
"verror": "1.6.1"
},
"dependencies": {
"npmlog": {
"version": "2.0.2",
"bundled": true,
"dev": true,
"requires": {
"ansi": "~0.3.1",
"are-we-there-yet": "~1.0.6",
"gauge": "~1.2.5"
}
}
}
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"node-uuid": {
"version": "1.4.7",
"bundled": true,
"dev": true
},
"nopt": {
"version": "3.0.6",
"bundled": true,
"dev": true,
"requires": {
"abbrev": "1"
}
},
"npmlog": {
"version": "0.0.6",
"bundled": true,
"dev": true,
"requires": {
"ansi": "~0.2.1"
},
"dependencies": {
"ansi": {
"version": "0.2.1",
"bundled": true,
"dev": true
}
}
},
"once": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"pegjs": {
"version": "0.6.2",
"bundled": true,
"dev": true
},
"plist": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"requires": {
"base64-js": "0.0.6",
"util-deprecate": "1.0.0",
"xmlbuilder": "2.2.1",
"xmldom": "0.1.x"
},
"dependencies": {
"util-deprecate": {
"version": "1.0.0",
"bundled": true,
"dev": true
}
}
},
"process-nextick-args": {
"version": "2.0.1",
"bundled": true,
"dev": true
},
"q": {
"version": "1.4.1",
"bundled": true,
"dev": true
},
"readable-stream": {
"version": "2.3.7",
"bundled": true,
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
},
"sax": {
"version": "0.3.5",
"bundled": true,
"dev": true
},
"shelljs": {
"version": "0.3.0",
"bundled": true,
"dev": true
},
"simple-plist": {
"version": "0.0.4",
"bundled": true,
"dev": true,
"requires": {
"bplist-creator": "0.0.4",
"bplist-parser": "0.0.6",
"plist": "1.1.0"
}
},
"stream-buffers": {
"version": "0.2.6",
"bundled": true,
"dev": true
},
"string_decoder": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
},
"underscore": {
"version": "1.8.3",
"bundled": true,
"dev": true
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"verror": {
"version": "1.6.1",
"bundled": true,
"dev": true,
"requires": {
"core-util-is": "1.0.2",
"extsprintf": "1.2.0"
},
"dependencies": {
"core-util-is": {
"version": "1.0.2",
"bundled": true,
"dev": true
}
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"xcode": {
"version": "0.8.7",
"bundled": true,
"dev": true,
"requires": {
"node-uuid": "1.4.7",
"pegjs": "0.6.2",
"simple-plist": "0.0.4"
}
},
"xmlbuilder": {
"version": "2.2.1",
"bundled": true,
"dev": true,
"requires": {
"lodash-node": "~2.4.1"
}
},
"xmldom": {
"version": "0.1.31",
"bundled": true,
"dev": true
}
}
},
"cordova-plugin-mfp-push": {
"version": "8.0.2021062405",
"resolved": "https://registry.npmjs.org/cordova-plugin-mfp-push/-/cordova-plugin-mfp-push-8.0.2021062405.tgz",
"integrity": "sha512-OOSV4TCkZVNfwQzjfbsD0ycNcZyokKdBPJnEK/QrtrGtEA+Ah1R86FphXFNJtCWEQYybCCHvCVXgor4Pgf11xQ==",
"dev": true
},
"cordova-plugin-network-information": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-network-information/-/cordova-plugin-network-information-3.0.0.tgz",
+11 -6
View File
@@ -42,6 +42,7 @@
"@fullcalendar/interaction": "^5.3.0",
"@ionic-native/camera": "^5.31.1",
"@ionic-native/core": "^5.0.7",
"@ionic-native/fcm": "^5.36.0",
"@ionic-native/file": "^5.36.0",
"@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0",
@@ -143,6 +144,7 @@
"cordova-plugin-crosswalk-webview": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.8.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-fingerprint-aio": "^4.0.2",
"cordova-plugin-globalization": "^1.11.0",
@@ -152,8 +154,6 @@
"cordova-plugin-media": "^5.0.3",
"cordova-plugin-media-capture": "^3.0.3",
"cordova-plugin-mfp": "^8.0.2021031007",
"cordova-plugin-mfp-jsonstore": "^8.0.2021062408",
"cordova-plugin-mfp-push": "^8.0.2021062405",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
"cordova-plugin-splashscreen": "^5.0.2",
@@ -191,12 +191,17 @@
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-fingerprint-aio": {},
"cordova-plugin-mfp-push": {},
"cordova-plugin-mfp-jsonstore": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-network-information": {},
"cordova-plugin-file": {}
"cordova-plugin-file": {},
"cordova-plugin-fcm-with-dependecy-updated": {
"ANDROID_GRADLE_TOOLS_VERSION": "4.1.0",
"ANDROID_GOOGLE_SERVICES_VERSION": "4.3.4",
"ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher",
"ANDROID_FCM_VERSION": "21.0.0",
"ANDROID_FIREBASE_BOM_VERSION": "26.0.0"
}
},
"platforms": [
"browser",
@@ -209,4 +214,4 @@
"url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git"
},
"license": "ISC"
}
}
+15 -1
View File
@@ -8,6 +8,7 @@ import * as _rollupMoment from 'moment';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
const moment = _rollupMoment || _moment;
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { SqliteService } from 'src/app/services/sqlite.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
@@ -37,7 +38,8 @@ export class AppComponent {
private platform: Platform,
/* private splashScreen: SplashScreen, */
private statusBar: StatusBar,
private screenOrientation: ScreenOrientation
private screenOrientation: ScreenOrientation,
private sqliteservice: SqliteService
) {
this.initializeApp();
}
@@ -51,7 +53,19 @@ export class AppComponent {
this.screenOrientation.unlock();
} else if( this.platform.is("mobile")) {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY);
console.log('Orientation locked')
}
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
}
});
}
}
+3 -1
View File
@@ -65,6 +65,8 @@ import { Media } from '@ionic-native/media/ngx';
import { StreamingMedia } from '@ionic-native/streaming-media/ngx';
import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
import { FCM } from '@ionic-native/fcm/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
@@ -111,7 +113,7 @@ import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
//File,
WebView,
FilePath,
//FCM,
FCM,
WebsocketService,
ChatService,
ScreenOrientation,
+6 -5
View File
@@ -1,7 +1,7 @@
/* eslint-disable */
/* tslint:disable */
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
/* ///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" /> */
import { Component, OnInit, NgZone } from '@angular/core';
import { Event } from '../models/event.model';
import { NotificationsService } from '../services/notifications.service';
@@ -123,8 +123,9 @@ export class HomePage implements OnInit {
this.webnotification.webconnection();
this.webnotification.register();
} else {
this.mobilefirstConnect();
this.notificationsService.onReceviNotification();
//this.mobilefirstConnect();
//this.notificationsService.onReceviNotification();
this.offlinemanager.synchnize()
}
});
@@ -144,7 +145,7 @@ export class HomePage implements OnInit {
myWorker.postMessage('ali');
}
mobilefirstConnect() {
/* mobilefirstConnect() {
console.log("Mobileconecct");
@@ -175,11 +176,11 @@ export class HomePage implements OnInit {
/* this.zone.run(() => {
console.log("Bummer...");
console.log("Failed to connect to MobileFirst Server");
}); */
});
});
}
}
}
} */
+1 -1
View File
@@ -1,5 +1,5 @@
///<reference path="../../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
/* ///<reference path="../../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" /> */
import { Component, OnInit, NgZone } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router';
import { AnimationController, ModalController,Platform } from '@ionic/angular';
+1
View File
@@ -735,6 +735,7 @@ export class AgendaPage implements OnInit {
Profile: profile
}
this.sqliteservice.addEvent(event)
});
}
}
+25 -26
View File
@@ -78,7 +78,7 @@ export class EventsPage implements OnInit {
loggeduser: LoginUserRespose;
existingScreenOrientation: string;
/* existingScreenOrientation: string; */
constructor(
private eventService: EventsService,
@@ -97,8 +97,8 @@ export class EventsPage implements OnInit {
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
) {
this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation);
/* this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation); */
this.loggeduser = authService.ValidatedUser;
@@ -109,13 +109,7 @@ export class EventsPage implements OnInit {
// console.log('Resize event detected');
});
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
window['zipPhoneCallback'] = function (zipphone) {
var frame = document.getElementById('home-iframe');
if(frame) {
@@ -172,22 +166,22 @@ export class EventsPage implements OnInit {
}
// Lock to portrait
lockToPortrait() {
/* lockToPortrait() {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
console.log('set');
}
} */
// Lock to landscape
lockToLandscape() {
/* lockToLandscape() {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
}
} */
// Unlock screen orientation
unlockScreenOrientation() {
/* unlockScreenOrientation() {
this.screenOrientation.unlock();
}
} */
checkScreenOrientation() {
/* checkScreenOrientation() {
if (window.innerWidth < 701) {
this.lockToPortrait();
console.log('was here');
@@ -196,7 +190,7 @@ export class EventsPage implements OnInit {
else {
this.unlockScreenOrientation();
}
}
} */
async RefreshEvents() {
this.currentEvent = "";
@@ -329,6 +323,18 @@ export class EventsPage implements OnInit {
}
}
addProcessToDb(list) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
if (list.length > 0) {
list.forEach(element => {
this.sqliteservice.addProcess(element)
});
}
}
}
getEventsFromLocalDb() {
let date = new Date();
@@ -463,14 +469,7 @@ export class EventsPage implements OnInit {
LoadList() {
this.processes.GetTaskListExpediente(false).subscribe(result => {
console.log("Expediente", result);
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
result.forEach((element) => {
this.sqliteservice.addProcess(element)
})
}
this.addProcessToDb(result);
const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
+1 -1
View File
@@ -141,7 +141,7 @@ export class InactivityPage implements OnInit {
}
getToken() {
this.notificatinsservice.getAndpostToken(this.username);
//this.notificatinsservice.getAndpostToken(this.username);
}
setCode(code: string) {
+5 -5
View File
@@ -1,5 +1,5 @@
///<reference path="../../../plugins/cordova-plugin-mfp/typings/worklight.d.ts" />
///<reference path="../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" />
/* ///<reference path="../../../plugins/cordova-plugin-mfp-jsonstore/typings/jsonstore.d.ts" /> */
import { Injectable } from "@angular/core";
@Injectable({
@@ -8,7 +8,7 @@ import { Injectable } from "@angular/core";
export class JsonStore {
createCollection(name, data) {
/* createCollection(name, data) {
var collectionName = name;
var addOptions = {
@@ -108,7 +108,7 @@ export class JsonStore {
replaceDocument(collectionName: string, document: any) {
/* var document = { Example of how identify the document to replace
_id: 1, json: {name: 'chevy', age: 23}
}; */
};
var options = {};
WL.JSONStore.get(collectionName).replace(document, options).then(function (numberOfDocsReplaced) {
@@ -119,12 +119,12 @@ export class JsonStore {
}
removeDocument(collectionName: any,query: any,) {
/* var query = { _id: 1 }; Exemple of query*/
/* var query = { _id: 1 }; Exemple of query
var options = { exact: true };
WL.JSONStore.get(collectionName).remove(query, options).then(function (numberOfDocsRemoved) {
console.log("JsonStore remove document sucess: ", numberOfDocsRemoved)
}).fail(function (error) {
console.log("JsonStore remove document erro: ", error)
});
}
} */
}
+70 -6
View File
@@ -1,6 +1,6 @@
/* eslint-disable */
/* tslint:disable */
///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" />
/* ///<reference path="../../../plugins/cordova-plugin-mfp-push/typings/mfppush.d.ts" /> */
import { Injectable, NgZone } from '@angular/core';
import { ActivatedRoute } from '@angular/router'
import { HttpClient } from '@angular/common/http';
@@ -17,6 +17,8 @@ import { v4 as uuidv4 } from 'uuid';
import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { FCM } from '@ionic-native/fcm/ngx';
@Injectable({
providedIn: 'root'
})
@@ -45,7 +47,8 @@ export class NotificationsService {
private activeroute: ActivatedRoute,
private jsonstore: JsonStore,
private eventtrigger: EventTrigger,
private backgroundservice: BackgroundService) {
private backgroundservice: BackgroundService,
private fcm: FCM) {
this.storageService.get("Notifications").then((value) => {
@@ -85,6 +88,67 @@ export class NotificationsService {
}
getAndpostToken(username) {
if(this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token';
return this.fcm.getToken().then(token => {
console.log('token: ', token)
this.storageService.store(username, token);
this.storageService.get(username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: res.UserId,
TokenId: token,
Status: 1,
Service: 1
};
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
console.log('TOKEN USER MIDLE', data);
})
});
});
});
}
}
async onReceviNotification() {
this.fcm.onNotification().subscribe(data => {
if (data.click_action) {
console.log("Received in background: ", data);
this.notificatinsRoutes(data)
} /* else {
console.log("Received in foreground: ", data);
console.log(data.Service)
console.log(data.Object)
console.log(data.IdObject)
this.openApproveModal(data.IdObject);
}; */
});
}
/////////////////////////////////////////////////////
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
}
*/
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
//console.log('Notifications not supported')
@@ -144,13 +208,13 @@ export class NotificationsService {
}
}
} */
tempClearArray(){
this.DataArray = [];
}
async onReceviNotification() {
/* async onReceviNotification() {
if(window['WLAuthorizationManager']) {
if(window['WLAuthorizationManager'].obtainAccessToken) {
@@ -188,7 +252,7 @@ export class NotificationsService {
if(message.actionName){
this.notificatinsRoutes(data);
} else {
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); */
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
//this.notificatinsRoutes(data);
console.log(data)
}
@@ -209,7 +273,7 @@ export class NotificationsService {
}
}
} */
notificatinsRoutes = (data) => {
if (data.Service === "agenda") {
+1
View File
@@ -34,6 +34,7 @@ export class SqliteService {
location: 'default'
}).then(async (sqLite: SQLiteObject) => {
this.dbInstance = sqLite;
console.log('SQLITE INSTACE ',this.dbInstance);
await sqLite.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.events} (
EventId varchar(255) PRIMARY KEY,