diff --git a/angular.json b/angular.json
index ff682adde..042364a39 100644
--- a/angular.json
+++ b/angular.json
@@ -84,7 +84,8 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
- "browserTarget": "app:build"
+ "browserTarget": "app:build",
+ "proxyConfig": "src/proxy.conf.json"
},
"configurations": {
"production": {
diff --git a/config.xml b/config.xml
index 7b18d7926..97d2fb38d 100644
--- a/config.xml
+++ b/config.xml
@@ -3,7 +3,7 @@
gabinete digital
An awesome Ionic/Cordova app.
Ionic Framework Team
-
+
diff --git a/ionic.config.json b/ionic.config.json
index 2bb709ac7..aab0ef21f 100644
--- a/ionic.config.json
+++ b/ionic.config.json
@@ -3,5 +3,15 @@
"integrations": {
"cordova": {}
},
- "type": "angular"
+ "type": "angular",
+ "proxies":[
+ {
+ "path": "/mfp/api/imfpush/",
+ "proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/"
+ },
+ {
+ "path": "/mfp/api",
+ "proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api"
+ }
+ ]
}
diff --git a/package-lock.json b/package-lock.json
index 327dd8601..c91352e98 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4546,11 +4546,18 @@
}
},
"@ionic-native/file": {
- "version": "5.31.1",
- "resolved": "https://registry.npmjs.org/@ionic-native/file/-/file-5.31.1.tgz",
- "integrity": "sha512-VWLpI6T/VeqbqIoiGg4Gr380fmEf1RXe0yzq7t9DDwXhpvsyG8uT+T4/BYSxhGalNE0lH2I0nvhKx/YfVuWIOA==",
+ "version": "5.36.0",
+ "resolved": "https://registry.npmjs.org/@ionic-native/file/-/file-5.36.0.tgz",
+ "integrity": "sha512-x7yZ4VdC8n8FNlpRmUFtohNlOZnExvoxZ/6oCvGsV+ec8TJXUsDK/BYi1g+lkPTCUY3EmQIeBOe4PLO6fRJ7qg==",
"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-path": {
@@ -4602,6 +4609,21 @@
"resolved": "https://registry.npmjs.org/@ionic-native/local-notifications/-/local-notifications-4.20.0.tgz",
"integrity": "sha512-Ht/0zau8/2+G/bH/okXXhhWB6YrkCNL2QxVJHQ2dophXFGxQPOZAN3CKWhuQSjfbr76fa2nvQXF6jsXLpIR/ng=="
},
+ "@ionic-native/media": {
+ "version": "5.36.0",
+ "resolved": "https://registry.npmjs.org/@ionic-native/media/-/media-5.36.0.tgz",
+ "integrity": "sha512-WIDCeUlX7bCbse/x2Rr7mAIQJnLo18ZWcmsVgSTTBVS7ObU2DBl4ieqRx6y9PAAV+3tNZqMV4JAWDfMiFokpJg==",
+ "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/network": {
"version": "5.35.0",
"resolved": "https://registry.npmjs.org/@ionic-native/network/-/network-5.35.0.tgz",
@@ -6935,6 +6957,14 @@
"resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.39.tgz",
"integrity": "sha512-lYR2Y/tV2ujpk/WyUc7S0VLI0a9hrtVIN9EwnrNo5oSEJI2cK2/XrgwOQmXLL3eTulOESvh9qP6si9+DWM9cOA=="
},
+ "@types/http-proxy": {
+ "version": "1.17.7",
+ "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.7.tgz",
+ "integrity": "sha512-9hdj6iXH64tHSLTY+Vt2eYOGzSogC+JQ2H7bdPWkuh7KXP5qLllWx++t+K9Wk556c3dkDdPws/SpMRi0sdCT1w==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/istanbul-lib-coverage": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz",
@@ -10647,6 +10677,12 @@
"integrity": "sha512-Wq0kCanxubK/JroTW4Mp5soayScnRyiY1eCkbwiz1Dyt1xHOiOW/v+1miqtBHtnZhcXw25TulCKAVJzkNBdmyg==",
"dev": true
},
+ "cordova-plugin-media": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-media/-/cordova-plugin-media-5.0.3.tgz",
+ "integrity": "sha512-UQPFlpk1zL4BY44zGi8RVmYCvcKBCN4Dyf8ovxqGYCC8zR1yhbTRWYDdO9vJdERwbfgWV7+z7FMWiSUfqWm9bQ==",
+ "dev": true
+ },
"cordova-plugin-mfp": {
"version": "8.0.2021031007",
"resolved": "https://registry.npmjs.org/cordova-plugin-mfp/-/cordova-plugin-mfp-8.0.2021031007.tgz",
@@ -15760,120 +15796,15 @@
}
},
"http-proxy-middleware": {
- "version": "0.19.1",
- "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz",
- "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==",
- "dev": true,
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.1.tgz",
+ "integrity": "sha512-cfaXRVoZxSed/BmkA7SwBVNI9Kj7HFltaE5rqYOub5kWzWZ+gofV2koVN1j2rMW7pEfSSlCHGJ31xmuyFyfLOg==",
"requires": {
- "http-proxy": "^1.17.0",
- "is-glob": "^4.0.0",
- "lodash": "^4.17.11",
- "micromatch": "^3.1.10"
- },
- "dependencies": {
- "braces": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
- "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
- "dev": true,
- "requires": {
- "arr-flatten": "^1.1.0",
- "array-unique": "^0.3.2",
- "extend-shallow": "^2.0.1",
- "fill-range": "^4.0.0",
- "isobject": "^3.0.1",
- "repeat-element": "^1.1.2",
- "snapdragon": "^0.8.1",
- "snapdragon-node": "^2.0.1",
- "split-string": "^3.0.2",
- "to-regex": "^3.0.1"
- },
- "dependencies": {
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "fill-range": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
- "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
- "dev": true,
- "requires": {
- "extend-shallow": "^2.0.1",
- "is-number": "^3.0.0",
- "repeat-string": "^1.6.1",
- "to-regex-range": "^2.1.0"
- },
- "dependencies": {
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "is-number": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
- "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
- "dev": true,
- "requires": {
- "kind-of": "^3.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "micromatch": {
- "version": "3.1.10",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
- "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
- "dev": true,
- "requires": {
- "arr-diff": "^4.0.0",
- "array-unique": "^0.3.2",
- "braces": "^2.3.1",
- "define-property": "^2.0.2",
- "extend-shallow": "^3.0.2",
- "extglob": "^2.0.4",
- "fragment-cache": "^0.2.1",
- "kind-of": "^6.0.2",
- "nanomatch": "^1.2.9",
- "object.pick": "^1.3.0",
- "regex-not": "^1.0.0",
- "snapdragon": "^0.8.1",
- "to-regex": "^3.0.2"
- }
- },
- "to-regex-range": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
- "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
- "dev": true,
- "requires": {
- "is-number": "^3.0.0",
- "repeat-string": "^1.6.1"
- }
- }
+ "@types/http-proxy": "^1.17.5",
+ "http-proxy": "^1.18.1",
+ "is-glob": "^4.0.1",
+ "is-plain-obj": "^3.0.0",
+ "micromatch": "^4.0.2"
}
},
"http-server": {
@@ -16702,6 +16633,11 @@
"path-is-inside": "^1.0.2"
}
},
+ "is-plain-obj": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz",
+ "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA=="
+ },
"is-plain-object": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
@@ -30125,6 +30061,18 @@
}
}
},
+ "http-proxy-middleware": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz",
+ "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==",
+ "dev": true,
+ "requires": {
+ "http-proxy": "^1.17.0",
+ "is-glob": "^4.0.0",
+ "lodash": "^4.17.11",
+ "micromatch": "^3.1.10"
+ }
+ },
"is-binary-path": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
diff --git a/package.json b/package.json
index d4d5367b1..b90345524 100644
--- a/package.json
+++ b/package.json
@@ -42,13 +42,14 @@
"@fullcalendar/interaction": "^5.3.0",
"@ionic-native/camera": "^5.31.1",
"@ionic-native/core": "^5.0.7",
- "@ionic-native/file": "^5.30.0",
+ "@ionic-native/file": "^5.36.0",
"@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0",
"@ionic-native/http": "^5.31.1",
"@ionic-native/in-app-browser": "^5.28.0",
"@ionic-native/ionic-webview": "^5.35.0",
"@ionic-native/local-notifications": "^4.20.0",
+ "@ionic-native/media": "^5.36.0",
"@ionic-native/network": "^5.35.0",
"@ionic-native/screen-orientation": "^5.35.0",
"@ionic-native/splash-screen": "^5.31.1",
@@ -82,6 +83,7 @@
"duration": "^0.2.2",
"faker": "^5.5.3",
"global": "^4.4.0",
+ "http-proxy-middleware": "^2.0.1",
"http-server": "^0.12.3",
"ibm-mfp-web-push": "^8.0.2020052213",
"ibm-mfp-web-sdk": "^8.0.2021021706",
@@ -135,6 +137,7 @@
"cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^5.0.0",
+ "cordova-plugin-media": "^5.0.3",
"cordova-plugin-mfp": "^8.0.2021031007",
"cordova-plugin-mfp-jsonstore": "^8.0.2021062408",
"cordova-plugin-mfp-push": "^8.0.2021062405",
@@ -179,6 +182,9 @@
"cordova-plugin-network-information": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
+ },
+ "cordova-plugin-media": {
+ "KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO"
}
},
"platforms": [
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index ea7ce1aef..2f37e9d58 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -35,6 +35,8 @@ import {MatDatepickerModule} from '@angular/material/datepicker';
import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { Network } from '@ionic-native/network/ngx';
+import { Media } from '@ionic-native/media/ngx';
+import { File } from '@ionic-native/file/ngx';
import {
@@ -106,7 +108,9 @@ import { PdfViewerModule } from 'ng2-pdf-viewer';
WebsocketService,
ChatService,
ScreenOrientation,
- Network
+ Network,
+ Media,
+ File
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts
index 912061afe..0b5d39cf4 100644
--- a/src/app/home/home.page.ts
+++ b/src/app/home/home.page.ts
@@ -18,6 +18,8 @@ import { ExpedienteGdStore } from '../store/expedientegd-store.service';
import { InativityService } from '../services/inativity.service';
import { SessionStore } from '../store/session.service';
import { StorageService } from '../services/storage.service';
+import { Media, MediaObject } from '@ionic-native/media/ngx';
+import { File } from '@ionic-native/file/ngx';
@Component({
selector: 'app-home',
@@ -60,6 +62,9 @@ export class HomePage implements OnInit {
synchro = synchro
+ status:string="";
+ audioFile:MediaObject = this.media.create(this.file.externalRootDirectory+"/audioGabinete.mp3");
+ audioName:string="";
constructor(
private zone: NgZone,
private router: Router,
@@ -72,7 +77,9 @@ export class HomePage implements OnInit {
public documentCounterService: DocumentCounterService,
private despachoRule: DespachoService,
private inativityService: InativityService,
- private storageService: StorageService,) {
+ private storageService: StorageService,
+ private media: Media,
+ private file: File ) {
this.router.events.subscribe((val) => {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
@@ -110,14 +117,14 @@ export class HomePage implements OnInit {
console.log('Active route ', this.router.url)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.webnotification.webconnection();
- this.webnotification.onReceviNotificationWeb();
+ this.webnotification.register();
} else {
this.mobilefirstConnect();
- this.notificationsService.getAndpostToken2();
this.notificationsService.onReceviNotification();
}
}
+
mobilefirstConnect() {
if(window['WLAuthorizationManager']) {
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts
index 2b6880152..476188cfe 100644
--- a/src/app/pages/chat/messages/messages.page.ts
+++ b/src/app/pages/chat/messages/messages.page.ts
@@ -255,6 +255,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const roomId = this.roomId
this.chatService.getRoomMessages(roomId).subscribe(async res => {
+ console.log("Chat message",res)
if (res == 502) {
// Connection timeout
diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts
index 6f7301aac..6ac10b458 100644
--- a/src/app/services/notifications.service.ts
+++ b/src/app/services/notifications.service.ts
@@ -60,7 +60,7 @@ export class NotificationsService {
getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
+ //console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token';
@@ -113,87 +113,10 @@ export class NotificationsService {
}
}
-
-
}
}
- getAndpostToken2() {
-
- if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
- } else {
-
- const geturl = environment.apiURL + 'notifications/token';
- if(window['WLAuthorizationManager']) {
- if(window['WLAuthorizationManager'].obtainAccessToken) {
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- window['MFPPush'].initialize(
- function (successResponse) {
- console.log("Push notification Successfully Service intialized: " + successResponse);
- },
- function (failureResponse) {
- console.log("Push notification failure Service intialized: " + failureResponse);
- }
- );
-
- window['MFPPush'].registerDevice(null, (successResponse) => {
- console.log("Successfully registered: " + JSON.stringify(successResponse));
- console.log('token: ', successResponse.deviceId)
- /* this.storageService.store(username, successResponse.deviceId);
- 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': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
- const body = {
- UserId: res.UserId,
- TokenId: successResponse.deviceId,
- Status: 1,
- Service: 1
- };
- this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
- console.log('TOKEN USER MIDLE', data);
- })
- });
-
- }); */
- },
- function (failureResponse) {
- console.log("Successfully failue: " + JSON.stringify(failureResponse));
- }
- );
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- )
- } else {
- console.log('not called')
- }
- } else {
- console.log('not called')
- }
-
-
- }
-
- }
-
- removeDepartment(index): void {
- /* this.DataArray[this.DataArray.findIndex(item => item.index == index)];
- this.DataArray.splice( this.DataArray.findIndex(item => item.indexOf(index.to) === 'William'),1); */
- const indexx = this.DataArray.indexOf(index, 0);
- if (indexx > -1) {
- this.DataArray.splice(index, 1);
- console.log('This notificatio', this.DataArray);
- }
- }
-
tempClearArray(){
this.DataArray = [];
}
diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts
index ec446a1e8..e4546a742 100644
--- a/src/app/services/webnotifications.service.ts
+++ b/src/app/services/webnotifications.service.ts
@@ -5,7 +5,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
-import { NavigationExtras,Router } from '@angular/router';
+import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from './toast.service';
import MFPPush from 'ibm-mfp-web-push';
@@ -31,29 +31,142 @@ export class WebNotificationsService {
webconnection() {
-
- /* MFPPush.initialize({
- appId: "com.gpr.gabinetedigital",
- mfpContextRoot: "/mfp",
- }); */
-
- MFPPush.registerDevice()
- .then((res) => {
- console.log("WEB Successfully Registered Device...");
- })
- .catch((err) => {
- console.log("WEB Registration Failed" + err);
- });
+ var inicializeObj = {
+ appId: "com.gpr.gabinetedigital",
+ mfpContextRoot: "/mfp",
+ /* serverUrl: "http://gpr-dev-10.gabinetedigital.local:9080",
+ safariWebsitePushId: "http://gpr-dev-10.gabinetedigital.local:9080", */
+ }
+
+
+ MFPPush.initialize({
+ appId: "com.gpr.gabinetedigital",
+ mfpContextRoot: "/mfp",
+ });
+
+
}
-async onReceviNotificationWeb() {
+ register(){
+ MFPPush.registerDevice()
+ .then((res) => {
+ console.log("WEB Successfully Registered Device...", res);
+ })
+ .catch((err) => {
+ console.log("WEB Registration Failed" + err);
+ });
+ }
+
+ async onReceviNotificationWeb() {
+
+ if (window['WLAuthorizationManager']) {
+ if (window['WLAuthorizationManager'].obtainAccessToken) {
+ window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
+ (token) => {
+ console.log('Push Notification: Success ' + token);
+
+ MFPPush.initialize(
+ function (successResponse) {
+ console.log("Push notification Successfully intialized: " + successResponse);
+ MFPPush.registerNotificationsCallback(notificationReceived);
+ },
+ function (failureResponse) {
+ console.log("Push notification failure intialized: " + failureResponse);
+ }
+ );
+ var notificationReceived = (message) => {
+ console.log(message);
+ var data = JSON.parse(message.payload);
+ console.log(data.Service);
+ console.log(data.IdObject);
+ console.log(data.Object);
+
+ if (message.actionName) {
+ //this.notificatinsRoutes(data);
+ console.log("Web notification")
+ } else {
+ console.log("Web notification")
+ //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
+ }
+
+ }
+ }, (error) => {
+ console.log('Push notification recived: failure ' + error.responseText);
+ console.log(JSON.stringify(error));
+ }
+ );
+ }
+ }
+
+
+ }
+
+ /* getTokenByUserIdAndId(user, userID) {
+ const geturl = environment.apiURL + 'notifications/user/' + userID;
+
+ return this.http.get(`${geturl}`);
+ } */
+
+ /* getAndpostToken(username) {
+ if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
+ console.log('Notifications not supported')
+ } else {
+
+ const geturl = environment.apiURL + 'notifications/token'; */
+ /*
+ window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
+ (token) => {
+ console.log('Push Notification: Success ' + token);
- if(window['WLAuthorizationManager']) {
- if(window['WLAuthorizationManager'].obtainAccessToken) {
+ MFPPush.initialize(
+ function (successResponse) {
+ console.log("Push notification Successfully Service intialized: " + successResponse);
+ },
+ function (failureResponse) {
+ console.log("Push notification failure Service intialized: " + failureResponse);
+ }
+ );
+
+ MFPPush.registerDevice(null, (successResponse) => {
+ console.log("Successfully registered: " + JSON.stringify(successResponse));
+ console.log('token: ', successResponse.deviceId)
+ this.storageService.store(username, successResponse.deviceId);
+ 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': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
+ const body = {
+ UserId: res.UserId,
+ TokenId: successResponse.deviceId,
+ Status: 1,
+ Service: 1
+ };
+ this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
+ console.log('TOKEN USER MIDLE', data);
+ })
+ });
+
+ });
+ },
+ function (failureResponse) {
+ console.log("Successfully failue: " + JSON.stringify(failureResponse));
+ }
+ );
+ }, (error) => {
+ console.log('Push notification recived: failure ' + error.responseText);
+ console.log(JSON.stringify(error));
+ }
+ );
+ }
+
+ } */
+ /*
+ async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
-
+
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
@@ -69,122 +182,20 @@ async onReceviNotificationWeb() {
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
-
+
if(message.actionName){
- //this.notificatinsRoutes(data);
- console.log("Web notification")
+ this.notificatinsRoutes(data);
} else {
- console.log("Web notification")
- //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
+ this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
-
+
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
- }
- }
-
-
-}
-
- /* getTokenByUserIdAndId(user, userID) {
- const geturl = environment.apiURL + 'notifications/user/' + userID;
-
- return this.http.get(`${geturl}`);
- } */
-
- /* getAndpostToken(username) {
- if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
- } else {
-
- const geturl = environment.apiURL + 'notifications/token'; */
-/*
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- MFPPush.initialize(
- function (successResponse) {
- console.log("Push notification Successfully Service intialized: " + successResponse);
- },
- function (failureResponse) {
- console.log("Push notification failure Service intialized: " + failureResponse);
- }
- );
-
- MFPPush.registerDevice(null, (successResponse) => {
- console.log("Successfully registered: " + JSON.stringify(successResponse));
- console.log('token: ', successResponse.deviceId)
- this.storageService.store(username, successResponse.deviceId);
- 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': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
- const body = {
- UserId: res.UserId,
- TokenId: successResponse.deviceId,
- Status: 1,
- Service: 1
- };
- this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
- console.log('TOKEN USER MIDLE', data);
- })
- });
-
- });
- },
- function (failureResponse) {
- console.log("Successfully failue: " + JSON.stringify(failureResponse));
- }
- );
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- );
- }
-
- } */
-/*
- async onReceviNotification() {
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- MFPPush.initialize(
- function (successResponse) {
- console.log("Push notification Successfully intialized: " + successResponse);
- MFPPush.registerNotificationsCallback(notificationReceived);
- },
- function (failureResponse) {
- console.log("Push notification failure intialized: " + failureResponse);
- }
- );
- var notificationReceived = (message) => {
- console.log(message);
- var data = JSON.parse(message.payload);
- console.log(data.Service);
- console.log(data.IdObject);
- console.log(data.Object);
-
- if(message.actionName){
- this.notificatinsRoutes(data);
- } else {
- this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
- }
-
- }
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- );
- } */
+ } */
/* notificatinsRoutes = (data) => {
if (data.Service === "agenda") {
diff --git a/src/assets/js/MFPPushServiceWorker.js b/src/assets/MFPPushServiceWorker.js
similarity index 100%
rename from src/assets/js/MFPPushServiceWorker.js
rename to src/assets/MFPPushServiceWorker.js
diff --git a/src/assets/json/manifest.json b/src/assets/manifest.json
similarity index 100%
rename from src/assets/json/manifest.json
rename to src/assets/manifest.json
diff --git a/src/index.html b/src/index.html
index 553bfaa3f..b282b6286 100644
--- a/src/index.html
+++ b/src/index.html
@@ -7,13 +7,15 @@
-
-
+
+
-
+
+