import { Component, Input } from "@angular/core"; import { NavController, ActionSheetController } from "ionic-angular"; import { ProfilePage } from "../../pages/profile/profile"; import { TwitterApiProvider } from "../../providers/twitter-api/twitter-api"; /** * Generated class for the TweetHeaderComponent component. * * See https://angular.io/api/core/Component for more info on Angular * Components. */ @Component({ selector: "tweet-header", templateUrl: "tweet-header.html" }) export class TweetHeaderComponent { @Input() user: any[]; @Input() tweetCreatedAt: string; constructor( public navCtrl: NavController, public actionSheetCtrl: ActionSheetController, private twitter: TwitterApiProvider ) {} showProfile(userId) { this.navCtrl.push(ProfilePage, { userId }); } showActions(userId) { let actionSheet = this.actionSheetCtrl.create({ title: "@" + this.user["screen_name"], buttons: [ { text: "Unfollow", role: "destructive", handler: () => { this.twitter.destroyFriendship(userId); } }, { text: "Mute", role: "destructive", handler: () => { this.twitter.muteUser(userId); } }, { text: "Block", role: "destructive", handler: () => { this.twitter.blockUser(userId); } }, { text: "Cancel", role: "cancel", handler: () => { console.log("Cancel clicked"); } } ] }); actionSheet.present(); } }