2020-08-28 11:37:28 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
2021-06-09 10:01:45 +01:00
|
|
|
import { AlertController, AnimationController } from '@ionic/angular';
|
2020-08-28 11:37:28 +01:00
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
export class AlertService {
|
|
|
|
|
|
2021-06-09 10:01:45 +01:00
|
|
|
constructor(
|
|
|
|
|
public alertController: AlertController,
|
|
|
|
|
private animationController: AnimationController,
|
|
|
|
|
) { }
|
2020-08-28 11:37:28 +01:00
|
|
|
|
|
|
|
|
async presentAlert(message:string) {
|
|
|
|
|
const alert = await this.alertController.create({
|
|
|
|
|
cssClass: 'my-custom-class',
|
|
|
|
|
header: 'Mensagem do sistema',
|
|
|
|
|
message: message,
|
|
|
|
|
buttons: ['OK']
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await alert.present();
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-03 12:57:26 +01:00
|
|
|
async presentErrorMessage(message:string) {
|
|
|
|
|
const alert = await this.alertController.create({
|
|
|
|
|
cssClass: 'my-custom-class',
|
|
|
|
|
header: 'Mensagem de erro',
|
|
|
|
|
message: message,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await alert.present();
|
|
|
|
|
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
alert.dismiss();
|
|
|
|
|
}, 2500);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-28 11:37:28 +01:00
|
|
|
}
|