import { Component, OnInit } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { RouterExtensions } from '@nativescript/angular';
import { transitionOptions } from '~/constants/shared.constants';
import { PhoneContactService } from '~/core/services/phone-contact.service';

@Component({
    selector: 'MorePage',
    moduleId: module.id,
    templateUrl: './more-page.component.html',
    styleUrls: ['./_more-page.component.scss']
})
export class MorePageComponent implements OnInit {
    pageLoading: boolean;
    transition: { name: string; duration: number; curve: string; };
    constructor(
        private routerExtensions: RouterExtensions,
        private router: Router,
        private phoneContactSrv: PhoneContactService,

    ) {
        this.transition = transitionOptions;
        this.router.events.subscribe((val) => {
            if (val instanceof NavigationEnd) {
                if (this.router.url === '/home/more') {
                    this.pageLoading = false;
                }
            }
        });
    }
    ngOnInit(): void {
        this.pageLoading = false;
    }

    async onEmailTap() {
        await this.phoneContactSrv.createEmail('kapesniskautis@fire.fundersclub.com', 'Nápady pro kapesní skautIS');
    }

}
