Improve notification

This commit is contained in:
Peter Maquiran
2021-06-15 15:09:20 +01:00
parent bfb81fd84f
commit c856cc2927
32 changed files with 218 additions and 1447 deletions
+3 -47
View File
@@ -50,6 +50,7 @@ export class LoginPage implements OnInit {
public alertController: AlertController,
private modalController: ModalController,
private animationController: AnimationController,
//private fcm: FCM
) {
@@ -186,10 +187,10 @@ export class LoginPage implements OnInit {
const encrypted = crypto.SHA1(code)
if( encrypted == localStorage.getItem('PIN')) {
//this.successMessage()
//this.toastService.successMessage()
this.router.navigate(['/home/events']);
} else {
this.badRequest('Pin incorreto')
this.toastService.badRequest('Pin incorreto')
this.code = []
}
@@ -206,52 +207,7 @@ export class LoginPage implements OnInit {
}
async successMessage(message?: any, callback?) {
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: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
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({
enterAnimation,
leaveAnimation,
component: SuccessMessagePage,
componentProps: {
message: message || 'Processo efetuado' ,
},
cssClass: 'notification-modal'
});
modal.present()
setTimeout(()=>{
if (callback) {
callback()
}
modal.dismiss()
},7000)
}
async badRequest(message?: string, callback?) {