mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ 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';
|
||||
import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
||||
//import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
entryComponents: [],
|
||||
@@ -111,7 +115,8 @@ import { PhotoViewer } from '@ionic-native/photo-viewer/ngx';
|
||||
//File,
|
||||
WebView,
|
||||
FilePath,
|
||||
//FCM,
|
||||
/* FCM,
|
||||
FirebaseX, */
|
||||
WebsocketService,
|
||||
ChatService,
|
||||
ScreenOrientation,
|
||||
|
||||
+18
-55
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { Event } from '../models/event.model';
|
||||
import { NotificationsService } from '../services/notifications.service';
|
||||
import { WebNotificationsService } from '../services/webnotifications.service';
|
||||
/*import { WebNotificationsService } from '../services/webnotifications.service'; */
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
|
||||
@@ -15,7 +14,7 @@ import { InativityService } from '../services/inativity.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { StorageService } from '../services/storage.service';
|
||||
import { File } from '@ionic-native/file/ngx';
|
||||
import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service';
|
||||
/* import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; */
|
||||
import { DocumentCounterService } from '../services/worker/document-counter.service';
|
||||
import { PermissionService } from '../services/worker/permission.service';
|
||||
import { Network } from '@ionic-native/network/ngx';
|
||||
@@ -25,7 +24,6 @@ import { Storage } from '@ionic/storage';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.page.html',
|
||||
@@ -74,20 +72,20 @@ export class HomePage implements OnInit {
|
||||
private notificationsService: NotificationsService,
|
||||
private platform: Platform,
|
||||
private activeroute: ActivatedRoute,
|
||||
private webnotification: WebNotificationsService,
|
||||
/* private webnotification: WebNotificationsService, */
|
||||
public p: PermissionService,
|
||||
public documentCounterService: DocumentCounterService,
|
||||
private despachoRule: DespachoService,
|
||||
private inativityService: InativityService,
|
||||
private storageService: StorageService,
|
||||
private webNotificationPopupService: WebNotificationPopupService,
|
||||
/* private webNotificationPopupService: WebNotificationPopupService, */
|
||||
private backgroundservice: BackgroundService,
|
||||
private offlinemanager: OfflineManagerService,
|
||||
private storage: Storage,
|
||||
private eventservice: EventsService,
|
||||
private screenOrientation: ScreenOrientation) {
|
||||
private screenOrientation: ScreenOrientation,) {
|
||||
|
||||
this.webNotificationPopupService.askNotificationPermission()
|
||||
/* this.webNotificationPopupService.askNotificationPermission() */
|
||||
|
||||
this.router.events.subscribe((val) => {
|
||||
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
|
||||
@@ -115,14 +113,15 @@ export class HomePage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.notificationsService.onReciveForeground();
|
||||
this.notificationsService.onReciveBackground();
|
||||
|
||||
window.addEventListener('online', () => {
|
||||
console.log('Became online')
|
||||
this.backgroundservice.online()
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.webnotification.webconnection();
|
||||
} else {
|
||||
this.mobilefirstConnect();
|
||||
this.notificationsService.onReceviNotification();
|
||||
/* this.notificationsService.onReceviNotification(); */
|
||||
this.offlinemanager.synchnize()
|
||||
}
|
||||
});
|
||||
@@ -133,59 +132,23 @@ export class HomePage implements OnInit {
|
||||
|
||||
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) {
|
||||
console.log('Worker said : ' + oEvent.data);
|
||||
}
|
||||
|
||||
myWorker.postMessage('ali');
|
||||
myWorker.postMessage('ali'); */
|
||||
}
|
||||
|
||||
mobilefirstConnect() {
|
||||
|
||||
console.log("Mobileconecct");
|
||||
|
||||
/* if (window['WLAuthorizationManager']) {
|
||||
if (window['WLAuthorizationManager'].obtainAccessToken) {
|
||||
window['WLAuthorizationManager'].obtainAccessToken("").then((token) => {
|
||||
|
||||
console.log('MobileFirst Server connect: Success ' + token);
|
||||
|
||||
var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/",
|
||||
WLResourceRequest.GET
|
||||
);
|
||||
|
||||
resourceRequest.setQueryParameter("name", "world");
|
||||
resourceRequest.send().then(
|
||||
(response) => {
|
||||
// Will display "Hello world" in an alert dialog.
|
||||
console.log("Connect with JavaAdapter Success: " + response.responseText);
|
||||
//this.MFPushNotification();
|
||||
},
|
||||
(error) => {
|
||||
console.log("Connect with JavaAdapter Failure: " + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('MobileFirst Server connect: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error))
|
||||
|
||||
});
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
|
||||
|
||||
updateList() {
|
||||
|
||||
this.notificationsService.registerCallback(
|
||||
'despachos',
|
||||
() => {
|
||||
this.despachoRule.getList({ updateStore: true })
|
||||
}
|
||||
)
|
||||
/* this.notificationsService.registerCallback(
|
||||
'despachos',
|
||||
() => {
|
||||
this.despachoRule.getList({ updateStore: true })
|
||||
}
|
||||
) */
|
||||
|
||||
document.addEventListener('pause', function () {
|
||||
// console.log('App going to background');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
postMessage("I\'m working before postMessage(\'ali\').");
|
||||
/* postMessage("I\'m working before postMessage(\'ali\').");
|
||||
|
||||
onmessage = function(oEvent) {
|
||||
postMessage('Hi ' + oEvent.data);
|
||||
};
|
||||
}; */
|
||||
@@ -56,8 +56,8 @@
|
||||
</div>
|
||||
<div class="approve-event-detail">
|
||||
<p *ngIf = "item.Service == 'agenda'">{{item.Location}}</p>
|
||||
<h3 id="profile-title">{{item.alert}}</h3>
|
||||
<p *ngIf = "item.Service != 'agenda'">{{item.desc}}</p>
|
||||
<h3 id="profile-title">{{item.title}}</h3>
|
||||
<p *ngIf = "item.Service != 'agenda'">{{item.body}}</p>
|
||||
</div>
|
||||
<!-- <div class="notification-label-MD-official" *ngIf = "item.Service == 'agenda' && item.TypeAgenda == 'official' && item.Role == '100000011'" ></div>
|
||||
<div class="notification-label-MD-pessoal" *ngIf = "item.Service == 'agenda' && item.TypeAgenda == 'pessoal' && item.Role == '100000011'" ></div>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import { Component, OnInit, NgZone } from '@angular/core';
|
||||
import { Router, NavigationExtras } from '@angular/router';
|
||||
import { AnimationController, ModalController,Platform } from '@ionic/angular';
|
||||
@@ -6,9 +5,8 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { LocalstoreService } from 'src/app/store/localstore.service';
|
||||
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||
import { JsonStore } from '../../services/jsonStore.service';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { NotificationsService } from '../../services/notifications.service';
|
||||
/* import { NotificationsService } from '../../services/notifications.service'; */
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { EventTrigger } from '../../services/eventTrigger.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
@@ -38,12 +36,11 @@ export class ProfilePage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private router: Router,
|
||||
private localstoreService: LocalstoreService,
|
||||
private jsonstore: JsonStore,
|
||||
private storageservice: StorageService,
|
||||
private zone: NgZone,
|
||||
private notificationservice: NotificationsService,
|
||||
/* private notificationservice: NotificationsService, */
|
||||
private platform: Platform,
|
||||
private notificationsService: NotificationsService,
|
||||
/* private notificationsService: NotificationsService, */
|
||||
private eventtrigger: EventTrigger,
|
||||
public ThemeService: ThemeService
|
||||
) {
|
||||
@@ -62,14 +59,14 @@ export class ProfilePage implements OnInit {
|
||||
this.getNotificationData();
|
||||
}
|
||||
|
||||
this.notificationsService.registerCallback(
|
||||
/* this.notificationsService.registerCallback(
|
||||
'any',
|
||||
() => {
|
||||
setTimeout(()=>{
|
||||
this.getNotificationData();
|
||||
}, 100)
|
||||
}
|
||||
)
|
||||
) */
|
||||
|
||||
}
|
||||
|
||||
@@ -86,33 +83,40 @@ export class ProfilePage implements OnInit {
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("Init get store", value)
|
||||
|
||||
/* var data = JSON.parse(value); */
|
||||
console.log("Init store parse", value)
|
||||
if(typeof(value) == 'string') {
|
||||
value = JSON.parse(value)
|
||||
console.log("CSDfdvdf",value)
|
||||
}
|
||||
|
||||
this.DataArray = []
|
||||
value.forEach((element,i) => {
|
||||
console.log("ARaaAA", element)
|
||||
let notificationObject;
|
||||
if(element.payload){
|
||||
let notificationObject = {
|
||||
index: i,
|
||||
title: element.title,
|
||||
Service: element.data.Service,
|
||||
Object: element.data.Object,
|
||||
IdObject: element.data.IdObject,
|
||||
FolderId: element.data.FolderId,
|
||||
body: element.body,
|
||||
dateInit: this.getFormatedTime(element.data.dateInit),
|
||||
dateEnd: this.getFormatedTime(element.data.dateEnd),
|
||||
Location: element.data.Location,
|
||||
TypeAgenda: element.data.TypeAgenda,
|
||||
Role: element.data.Role,
|
||||
Status: element.data.Status
|
||||
}
|
||||
/* if(element.payload){
|
||||
var payload = JSON.parse(element.payload)
|
||||
notificationObject = {
|
||||
index: i,
|
||||
alert: element.alert,
|
||||
//index: i,
|
||||
//alert: element.alert,
|
||||
Service: payload.Service,
|
||||
Object: payload.Object,
|
||||
IdObject: payload.IdObject,
|
||||
FolderId: payload.FolderId,
|
||||
desc: payload.desc,
|
||||
dateInit: this.getFormatedTime(payload.dateInit),
|
||||
dateEnd: this.getFormatedTime(payload.dateEnd),
|
||||
Location: payload.Location,
|
||||
TypeAgenda: payload.TypeAgenda,
|
||||
Role: payload.Role,
|
||||
Status: payload.Status
|
||||
//FolderId: payload.FolderId,
|
||||
//desc: payload.desc,
|
||||
//dateInit: this.getFormatedTime(payload.dateInit),
|
||||
//dateEnd: this.getFormatedTime(payload.dateEnd),
|
||||
//Location: payload.Location,
|
||||
//TypeAgenda: payload.TypeAgenda,
|
||||
//Role: payload.Role,
|
||||
//Status: payload.Status
|
||||
}
|
||||
} else {
|
||||
notificationObject = {
|
||||
@@ -129,9 +133,9 @@ export class ProfilePage implements OnInit {
|
||||
TypeAgenda: element.TypeAgenda,
|
||||
Role: element.Role,
|
||||
Status: element.Status
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
this.DataArray.push(notificationObject)
|
||||
});
|
||||
@@ -201,7 +205,7 @@ export class ProfilePage implements OnInit {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
|
||||
}
|
||||
|
||||
this.notificationservice.tempClearArray();
|
||||
//this.notificationservice.tempClearArray();
|
||||
this.deleteNotification(index);
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "deleted"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export class Token {
|
||||
export class Tokenn {
|
||||
UserId: number;
|
||||
TokenId: string;
|
||||
Status: number;
|
||||
|
||||
@@ -735,6 +735,7 @@ export class AgendaPage implements OnInit {
|
||||
Profile: profile
|
||||
}
|
||||
this.sqliteservice.addEvent(event)
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import { NavigationStart, NavigationEnd, Router } from '@angular/router';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
//import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { TimeService } from 'src/app/services/functions/time.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { DataService } from 'src/app/services/data.service';
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ ion-item{
|
||||
font-family: Roboto;
|
||||
font-size: 12pt;
|
||||
font-weight: 700;
|
||||
color: #0d89d1;
|
||||
color: var(--title-text-color);
|
||||
padding-left: 3px;
|
||||
|
||||
.subject{
|
||||
|
||||
@@ -19,7 +19,7 @@ import { WaitForDomService } from 'src/app/services/dom/wait-for-dom.service';
|
||||
import { TotalDocumentStore } from 'src/app/store/total-document.service';
|
||||
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
//import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
||||
import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
@@ -124,7 +124,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
authService: AuthService,
|
||||
public p: PermissionService,
|
||||
public waitForDomService: WaitForDomService,
|
||||
private notificationsService: NotificationsService,
|
||||
//private notificationsService: NotificationsService,
|
||||
private despachoRule: DespachoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform,
|
||||
|
||||
@@ -141,6 +141,8 @@ export class InactivityPage implements OnInit {
|
||||
}
|
||||
|
||||
getToken() {
|
||||
this.notificatinsservice.requestPermissions();
|
||||
this.notificatinsservice.registrationError();
|
||||
this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
|
||||
getToken() {
|
||||
this.notificatinsservice.requestPermissions();
|
||||
this.notificatinsservice.registrationError();
|
||||
this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { JsonStore } from './jsonStore.service';
|
||||
|
||||
describe('JsonStore', () => {
|
||||
let service: JsonStore;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(JsonStore);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
@Injectable({
|
||||
@@ -107,7 +106,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) {
|
||||
@@ -118,7 +117,7 @@ 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)
|
||||
|
||||
@@ -6,15 +6,15 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
import { Token } from '../models/token.model';
|
||||
import { Tokenn } 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 '../services/toast.service';
|
||||
import { JsonStore } from './jsonStore.service';
|
||||
import { BackgroundService } from './background.service';
|
||||
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';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -23,7 +23,7 @@ export class NotificationsService {
|
||||
|
||||
adding: "intervenient" | "CC" = "intervenient";
|
||||
folderId: string;
|
||||
DataArray: Array<String> = [];
|
||||
DataArray = new Array();
|
||||
|
||||
callbacks: {
|
||||
type: string,
|
||||
@@ -38,37 +38,39 @@ export class NotificationsService {
|
||||
public modalCtrl: AlertController,
|
||||
private animationController: AnimationController,
|
||||
private platform: Platform,
|
||||
private router: Router,
|
||||
private router: Router,
|
||||
private toastService: ToastService,
|
||||
private zone: NgZone,
|
||||
private activeroute: ActivatedRoute,
|
||||
private jsonstore: JsonStore,
|
||||
private eventtrigger: EventTrigger,
|
||||
private backgroundservice: BackgroundService) {
|
||||
private backgroundservice: BackgroundService,
|
||||
/* private fcm: FCM */) {
|
||||
|
||||
this.storageService.get("Notifications").then((value) => {
|
||||
|
||||
}).catch(()=>{
|
||||
|
||||
this.storageService.store("Notifications",[])
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
}
|
||||
this.storageService.store("Notifications", [])
|
||||
})
|
||||
|
||||
registerCallback(type: string, funx: Function, object: any = {} ) {
|
||||
}
|
||||
|
||||
registerCallback(type: string, 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)
|
||||
this.callbacks.push({ type, funx, id })
|
||||
if (!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
||||
this.backgroundservice.registerBackService('Notification', funx, type)
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
deleteCallback(id) {
|
||||
this.callbacks.forEach((e, index)=>{
|
||||
if(e.id == id) {
|
||||
this.callbacks.forEach((e, index) => {
|
||||
if (e.id == id) {
|
||||
if (index > -1) {
|
||||
this.callbacks.splice(index, 1);
|
||||
}
|
||||
@@ -80,59 +82,237 @@ export class NotificationsService {
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
return this.http.get<Token[]>(`${geturl}`);
|
||||
return this.http.get<Tokenn[]>(`${geturl}`);
|
||||
}
|
||||
|
||||
requestPermissions() {
|
||||
PushNotifications.requestPermissions().then(result => {
|
||||
if (result.receive === 'granted') {
|
||||
// Register with Apple / Google to receive push via APNS/FCM
|
||||
PushNotifications.register();
|
||||
} else {
|
||||
// Show some error
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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';
|
||||
PushNotifications.addListener('registration',
|
||||
(token: Token) => {
|
||||
console.log('token: ', token.value)
|
||||
this.storageService.store(username, token.value);
|
||||
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.value,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
|
||||
this.http.post<Tokenn>(`${geturl}`, body, { headers }).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
}, (error) => {
|
||||
console.log('Post token to backend', error)
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registrationError() {
|
||||
PushNotifications.addListener('registrationError',
|
||||
(error: any) => {
|
||||
console.log('Error on registration: ' + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onReciveForeground() {
|
||||
PushNotifications.addListener('pushNotificationReceived',
|
||||
(notification: PushNotificationSchema) => {
|
||||
console.log('Push received: ' + JSON.stringify(notification));
|
||||
this.DataArray.push(notification)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications", this.DataArray)
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onReciveBackground() {
|
||||
PushNotifications.addListener('pushNotificationActionPerformed',
|
||||
(notification: ActionPerformed) => {
|
||||
console.log('Push action performed: ' + JSON.stringify(notification));
|
||||
this.notificatinsRoutes(notification)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
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.DataArray.push(data)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications", this.DataArray)
|
||||
|
||||
|
||||
};
|
||||
});
|
||||
} */
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/* 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')
|
||||
} 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, async (successResponse) => {
|
||||
console.log("Successfully registered: " + JSON.stringify(successResponse));
|
||||
console.log('token: ', successResponse.deviceId)
|
||||
await this.storageService.store(username, successResponse.deviceId).then((tokennoti) => {
|
||||
console.log('token store',tokennoti)
|
||||
});
|
||||
await 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: successResponse.deviceId,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
this.http.post<Token>(`${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));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
tempClearArray() {
|
||||
this.DataArray = new Array;
|
||||
}
|
||||
|
||||
/* async onReceviNotification() {
|
||||
|
||||
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);
|
||||
console.log("Push notification Successfully intialized: " + successResponse);
|
||||
window['MFPPush'].registerNotificationsCallback(notificationReceived);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure Service intialized: " + failureResponse);
|
||||
console.log("Push notification failure intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
|
||||
window['MFPPush'].registerDevice(null, async (successResponse) => {
|
||||
console.log("Successfully registered: " + JSON.stringify(successResponse));
|
||||
console.log('token: ', successResponse.deviceId)
|
||||
await this.storageService.store(username, successResponse.deviceId).then((tokennoti) => {
|
||||
console.log('token store',tokennoti)
|
||||
});
|
||||
await 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: successResponse.deviceId,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Successfully failue: " + JSON.stringify(failureResponse));
|
||||
var notificationReceived = (message) => {
|
||||
//this.jsonstore.createCollection('Notifications',message);
|
||||
this.DataArray.push(message)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications",this.DataArray)
|
||||
|
||||
console.log(message);
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
var data = JSON.parse(message.payload);
|
||||
|
||||
//synchro.$send(data)
|
||||
|
||||
console.log('data.Service', data.Service); // module
|
||||
console.log('data.IdObject', data.IdObject); // Object id
|
||||
console.log('data.Object', data.Object); // details
|
||||
|
||||
if(message.actionName){
|
||||
this.notificatinsRoutes(data);
|
||||
} else {
|
||||
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
|
||||
//this.notificatinsRoutes(data);
|
||||
console.log(data)
|
||||
}
|
||||
);
|
||||
|
||||
this.callbacks.forEach( e=> {
|
||||
if(e.type == data.Object || e.type == "any") {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
@@ -140,120 +320,54 @@ export class NotificationsService {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} */
|
||||
|
||||
notificatinsRoutes = (notification) => {
|
||||
if (notification.data.Service === "agenda") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.data.IdObject, 'agenda']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tempClearArray(){
|
||||
this.DataArray = [];
|
||||
}
|
||||
|
||||
async onReceviNotification() {
|
||||
|
||||
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 intialized: " + successResponse);
|
||||
window['MFPPush'].registerNotificationsCallback(notificationReceived);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
var notificationReceived = (message) => {
|
||||
//this.jsonstore.createCollection('Notifications',message);
|
||||
this.DataArray.push(message)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications",this.DataArray)
|
||||
|
||||
console.log(message);
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
var data = JSON.parse(message.payload);
|
||||
|
||||
//synchro.$send(data)
|
||||
|
||||
console.log('data.Service', data.Service); // module
|
||||
console.log('data.IdObject', data.IdObject); // Object id
|
||||
console.log('data.Object', data.Object); // details
|
||||
|
||||
if(message.actionName){
|
||||
this.notificatinsRoutes(data);
|
||||
} else {
|
||||
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); */
|
||||
//this.notificatinsRoutes(data);
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
this.callbacks.forEach( e=> {
|
||||
if(e.type == data.Object || e.type == "any") {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expediente") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.data.Service === "agenda" && notification.data.Object === "event-list") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.data.IdObject, 'agenda']));
|
||||
} else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "parecer") {
|
||||
|
||||
}
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "deferimento") {
|
||||
|
||||
notificatinsRoutes = (data) => {
|
||||
if (data.Service === "agenda") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "expediente") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente',data.IdObject,'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "agenda" && data.Object === "event-list") {
|
||||
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 (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos-pr") {
|
||||
|
||||
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-pr', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "parecer") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital']));
|
||||
else if (notification.data.Service === "accoes" && notification.data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications', notification.data.IdObject]));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "deferimento") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos',data.IdObject,'gabinete-digital']));
|
||||
else if (notification.data.Service === "accoes" && notification.data.Object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.data.FolderId, notification.data.IdObject]));
|
||||
}
|
||||
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']));
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications',data.IdObject]));
|
||||
}
|
||||
else if (data.Service === "accoes" && data.Object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications',data.FolderId,data.IdObject]));
|
||||
}
|
||||
else if (data.Service === "gabinete-digital" && data.Object === "diplomas") {
|
||||
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 (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas-assinar") {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
"serialNumber": data.IdObject,
|
||||
"serialNumber": notification.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") {
|
||||
this.zone.run(() =>this.router.navigate(['/home/gabinete-digital/expedientes-pr',data.IdObject,'gabinete-digital']));
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,19 @@ export class SqliteService {
|
||||
this.databaseConn();
|
||||
}
|
||||
|
||||
databaseConn() {
|
||||
databaseConn() {
|
||||
console.log('SQLDBConnect')
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
console.log('SQLDBConnect22')
|
||||
this.platform.ready().then(async () => {
|
||||
await this.sqlite.create({
|
||||
console.log('SQLDBConnect33')
|
||||
this.sqlite.create({
|
||||
name: this.db_name,
|
||||
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,
|
||||
@@ -125,6 +129,8 @@ export class SqliteService {
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
}).catch((error) => {
|
||||
console.log('Platform ready error', error)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
import { Token } from '../models/token.model';
|
||||
import { Tokenn } from '../models/token.model';
|
||||
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="bottom-title d-flex"><h3 class="bottom-text">Diplomas para Assinar</h3></div>
|
||||
</div>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
|
||||
@@ -129,7 +129,7 @@ ion-item{
|
||||
font-family: Roboto;
|
||||
font-size: 12pt;
|
||||
font-weight: 700;
|
||||
color: #0d89d1;
|
||||
color: var(--title-text-color);
|
||||
padding-left: 3px;
|
||||
|
||||
.subject{
|
||||
|
||||
@@ -58,7 +58,7 @@ ion-item{
|
||||
font-family: Roboto;
|
||||
font-size: 12pt;
|
||||
font-weight: 700;
|
||||
color: #0d89d1;
|
||||
color: var(--title-text-color);
|
||||
padding-left: 3px;
|
||||
|
||||
.subject{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AnimationController, ModalController,Platform } from '@ionic/angular';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Router } from '@angular/router';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
||||
import { StorageService } from '../../services/storage.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { NotificationsService } from '../../services/notifications.service';
|
||||
//import { NotificationsService } from '../../services/notifications.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { EventTrigger } from '../../services/eventTrigger.service';
|
||||
import { ThemeService } from '../../services/theme.service';
|
||||
@@ -28,14 +28,14 @@ export class HeaderPage implements OnInit {
|
||||
SessionStore = SessionStore
|
||||
|
||||
production = environment.production
|
||||
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private storageservice: StorageService,
|
||||
private platform: Platform,
|
||||
private notificationsService: NotificationsService,
|
||||
//private notificationsService: NotificationsService,
|
||||
private eventrigger: EventTrigger,
|
||||
public ThemeService: ThemeService
|
||||
) {
|
||||
@@ -50,39 +50,39 @@ export class HeaderPage implements OnInit {
|
||||
this.hideSearch();
|
||||
this.notificationLengthData();
|
||||
|
||||
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
console.log('Notifications not supported')
|
||||
this.UpdateNotificationCount();
|
||||
} else {
|
||||
this.UpdateNotificationCount();
|
||||
} */
|
||||
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
console.log('Notifications not supported')
|
||||
this.UpdateNotificationCount();
|
||||
} else {
|
||||
this.UpdateNotificationCount();
|
||||
} */
|
||||
}
|
||||
|
||||
this.eventrigger.getObservable().subscribe((data)=>{
|
||||
if(data.notification == "delete" || "recive"){
|
||||
ionViewWillEnter() {
|
||||
this.eventrigger.getObservable().subscribe((data) => {
|
||||
if (data.notification == "delete" || "recive") {
|
||||
this.notificationLengthData();
|
||||
console.log('Deleted notification',data )
|
||||
console.log('Deleted notification', data)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
UpdateNotificationCount() {
|
||||
this.notificationsService.registerCallback(
|
||||
'any',
|
||||
() => {
|
||||
setTimeout(()=>{
|
||||
this.notificationLengthData();
|
||||
}, 100)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
notificationLengthData() {
|
||||
/* UpdateNotificationCount() {
|
||||
this.notificationsService.registerCallback(
|
||||
'any',
|
||||
() => {
|
||||
setTimeout(()=>{
|
||||
this.notificationLengthData();
|
||||
}, 100)
|
||||
}
|
||||
)
|
||||
} */
|
||||
|
||||
notificationLengthData() {
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log("Init get store", value)
|
||||
|
||||
/* var data = JSON.parse(value); */
|
||||
/* var data = JSON.parse(value); */
|
||||
this.notificationLength = value.length;
|
||||
})
|
||||
|
||||
@@ -173,10 +173,10 @@ export class HeaderPage implements OnInit {
|
||||
});
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then(()=>{
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.notificationLengthData()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
async dynamicSearch() {
|
||||
|
||||
Reference in New Issue
Block a user