import { Component } from '@angular/core' ; import { Router } from '@angular/router' ; import { ActionSheetController } from '@ionic/angular' ; import { ConferenceData } from '../../providers/conference-data' ; @ Component ( { selector : 'page-speaker-list' , templateUrl : 'speaker-list.html' , styleUrls : [ './speaker-list.scss' ] , } ) export class SpeakerListPage { speakers : any [ ] = [ ] ; constructor ( public actionSheetCtrl , public confData , public router ) { } ionViewDidEnter ( ) { this . confData . getSpeakers ( ) . subscribe ( ( speakers ) => { this . speakers = speakers ; } ) ; } goToSpeakerTwitter ( speaker ) { } async openSpeakerShare ( speaker ) { const actionSheet = await this . actionSheetCtrl . create ( { header : 'Share ' + speaker . name , buttons : [ { text : 'Copy Link' , handler : ( ) => { navigator . clipboard . writeText ( window . location . origin + `/app/tabs/speakers/speaker-details/${ speaker . id }` ) ; } } , { text : 'Cancel' , role : 'cancel' } ] } ) ; await actionSheet . present ( ) ; } async openContact ( speaker ) { const mode = 'ios' ; const actionSheet = await this . actionSheetCtrl . create ( { header : 'Contact ' + speaker . name , buttons : [ { text : `Email ( ${ speaker . email } )` , icon : mode !== 'ios' ? 'mail' : null , handler : ( ) => { window . open ( 'mailto:' + speaker . email ) ; } } , { text : `Call ( ${ speaker . phone } )` , icon : mode !== 'ios' ? 'call' : null , handler : ( ) => { window . open ( 'tel:' + speaker . phone ) ; } } ] } ) ; await actionSheet . present ( ) ; } }