import { Component, OnInit } from '@angular/core'; import { AnimationController, ModalController,Platform } from '@ionic/angular'; import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page'; import { PinPage } from 'src/app/shared/pin/pin.page'; import { SessionStore } from 'src/app/store/session.service'; import { environment } from 'src/environments/environment'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service'; @Component({ selector: 'app-edit-profile', templateUrl: './edit-profile.page.html', styleUrls: ['./edit-profile.page.scss'], }) export class EditProfilePage implements OnInit { SessionStore = SessionStore production = environment.production environment = environment constructor(private modalController:ModalController, private animationController: AnimationController, public platform: Platform, private BackgroundService: BackgroundService, public ThemeService: ThemeService ) {} ngOnInit() {} close() { this.modalController.dismiss(); } async addPin() { 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: PinPage, cssClass: 'model profile-modal', componentProps: { } }); modal.present(); } async addFingerprint() { 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: FingerprintPage, cssClass: 'model profile-modal', componentProps: { } }); modal.present(); } LoginPreferenceMethod(type: 'None' | 'Password' | 'Pin' | null) { if (this.SessionStore.user.LoginPreference != type) { if (type) { this.SessionStore.setLoginPreference(type) } } else { this.SessionStore.setLoginPreference('None') } } changeTheme(name) { this.ThemeService.setTheme(name) this.BackgroundService.paint(); } }