mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
MobileF
This commit is contained in:
+3
-236
@@ -67,7 +67,7 @@ export class HomePage implements OnInit {
|
||||
ngOnInit() {
|
||||
//this.securityCheck()
|
||||
this.mobileFirstTest()
|
||||
this.pushCordova()
|
||||
//this.pushCordova()
|
||||
/* //Initialize profile as mdgpr
|
||||
|
||||
let date = new Date();
|
||||
@@ -93,57 +93,7 @@ export class HomePage implements OnInit {
|
||||
this.totalExpediente = result;
|
||||
});
|
||||
|
||||
/*
|
||||
PushNotifications.addListener('registrationError', (error: any) => {
|
||||
alert('Error on registration: ' + JSON.stringify(error));
|
||||
});
|
||||
|
||||
PushNotifications.addListener('pushNotificationReceived', notification => {
|
||||
|
||||
//const isPushNotification = !!notification.title || !!notification.body;
|
||||
|
||||
// if this is a push notification received when the app is in the foreground on Android
|
||||
//if (isAndroid && isPushNotification) {
|
||||
|
||||
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
||||
console.log('Recived: ', notification)
|
||||
//}
|
||||
});
|
||||
|
||||
|
||||
PushNotifications.addListener(
|
||||
'pushNotificationActionPerformed',
|
||||
(notification: PushNotificationActionPerformed) => {
|
||||
let service = notification.notification.data.Service;
|
||||
let object = notification.notification.data.Object;
|
||||
let idObject = notification.notification.data.IdObject;
|
||||
|
||||
console.log('Complete Object: ', notification.notification )
|
||||
|
||||
console.log('Service: ', service);
|
||||
console.log('Object: ', object);
|
||||
console.log('idObject: ', idObject);
|
||||
|
||||
if (service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(idObject)
|
||||
}
|
||||
else if (service === "gabinete-digital" && object === "expediente") {
|
||||
this.viewExpedientDetail(idObject)
|
||||
}
|
||||
else if (service === "gabinete-digital" && object === "event-list") {
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
||||
this.openApproveModal(idObject);
|
||||
}
|
||||
else if (service === "accoes" && object === "accao") {
|
||||
this.viewPublications(idObject)
|
||||
}
|
||||
else if (service === "accoes" && object === "publicacao") {
|
||||
this.viewPublicationDetail(idObject)
|
||||
}
|
||||
|
||||
},
|
||||
); */
|
||||
*/
|
||||
}
|
||||
|
||||
mobileFirstTest() {
|
||||
@@ -224,190 +174,7 @@ export class HomePage implements OnInit {
|
||||
|
||||
|
||||
|
||||
pushCordova() {
|
||||
|
||||
this.fcm.onNotification().subscribe(data => {
|
||||
this.viewEventDetail(data.idObject)
|
||||
if (data.click_action) {
|
||||
console.log("Received in background: ", data);
|
||||
|
||||
if (data.service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(data.idObject)
|
||||
}
|
||||
else if (data.service === "gabinete-digital" && data.object === "expediente") {
|
||||
this.viewExpedientDetail(data.idObject)
|
||||
}
|
||||
else if (data.service === "gabinete-digital" && data.object === "event-list") {
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
||||
this.openApproveModal(data.idObject);
|
||||
}
|
||||
else if (data.service === "accoes" && data.object === "accao") {
|
||||
//this.viewPublications(data.idObject)
|
||||
alert(data.idObject)
|
||||
}
|
||||
else if (data.service === "accoes" && data.object === "publicacao") {
|
||||
this.viewPublicationDetail(data.idObject)
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log("Received in foreground: ", data);
|
||||
if (data.service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(data.idObject)
|
||||
}
|
||||
else if (data.service === "gabinete-digital" && data.object === "expediente") {
|
||||
this.viewExpedientDetail(data.idObject)
|
||||
}
|
||||
else if (data.service === "gabinete-digital" && data.object === "event-list") {
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
||||
this.openApproveModal(data.idObject);
|
||||
}
|
||||
else if (data.service === "accoes" && data.object === "accao") {
|
||||
this.viewPublications(data.idObject)
|
||||
}
|
||||
else if (data.service === "accoes" && data.object === "publicacao") {
|
||||
this.viewPublicationDetail(data.idObject)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
this.fcm.onTokenRefresh().subscribe(token => {
|
||||
// Register your new token in your back-end if you want
|
||||
// backend.registerToken(token);
|
||||
});
|
||||
|
||||
this.ubscribeToTopic()
|
||||
this.getToken()
|
||||
|
||||
}
|
||||
|
||||
ubscribeToTopic() {
|
||||
this.fcm.subscribeToTopic('enappd');
|
||||
}
|
||||
getToken() {
|
||||
this.fcm.getToken().then(token => {
|
||||
console.log('token: ', token)
|
||||
// Register your new token in your back-end if you want
|
||||
// backend.registerToken(token);
|
||||
});
|
||||
}
|
||||
|
||||
async viewEventDetail(eventId: any) {
|
||||
console.log(this.profile);
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewEventPage,
|
||||
componentProps: {
|
||||
eventId: eventId,
|
||||
adding: this.adding
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
//this.viewEventDetailDismiss(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
componentProps: {
|
||||
serialNumber: eventSerialNumber,
|
||||
},
|
||||
cssClass: 'cal-modal',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber: any) {
|
||||
let classs;
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal'
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
/* console.log(this.profile);
|
||||
console.log(serialNumber); */
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedienteDetailPage,
|
||||
componentProps: {
|
||||
serialNumber: serialNumber,
|
||||
profile: this.profile,
|
||||
},
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async viewPublicationDetail(publicationId: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps: {
|
||||
publicationId: publicationId,
|
||||
folderId: this.folderId,
|
||||
},
|
||||
cssClass: 'publication-detail',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(() => {
|
||||
//this.getPublications();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async viewPublications(folderId) {
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('ion-backdrop')!)
|
||||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
|
||||
|
||||
const wrapperAnimation = this.animationController.create()
|
||||
.addElement(baseEl.querySelector('.modal-wrapper')!)
|
||||
.keyframes([
|
||||
{ offset: 0, opacity: '0', transform: 'scale(0)' },
|
||||
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }
|
||||
]);
|
||||
|
||||
return this.animationController.create()
|
||||
.addElement(baseEl)
|
||||
.easing('ease-out')
|
||||
.duration(500)
|
||||
.addAnimation([backdropAnimation, wrapperAnimation]);
|
||||
}
|
||||
|
||||
const leaveAnimation = (baseEl: any) => {
|
||||
return enterAnimation(baseEl).direction('reverse');
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewPublicationsPage,
|
||||
enterAnimation,
|
||||
leaveAnimation,
|
||||
componentProps: {
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-action',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user