profile-header.ts 984 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { Component, Input } from "@angular/core";
  2. import { PhotoViewer } from "@ionic-native/photo-viewer";
  3. @Component({
  4. selector: "profile-header",
  5. templateUrl: "profile-header.html"
  6. })
  7. export class ProfileHeaderComponent {
  8. @Input()
  9. user: any;
  10. constructor(
  11. private photoViewer: PhotoViewer
  12. ) {}
  13. get banner() {
  14. if (this.user.profile_banner_url) {
  15. return this.user.profile_banner_url + "/1500x500";
  16. } else {
  17. return this.user.profile_background_image_url_https;
  18. }
  19. }
  20. async follow(userId) {
  21. // await this.twitter.createFriendship(userId);
  22. this.user.following = true;
  23. }
  24. async unfollow(userId) {
  25. // await this.twitter.destroyFriendship(userId);
  26. this.user.following = false;
  27. }
  28. showProfilePicture() {
  29. const profilePicutreHighResUrl = this.user.profile_image_url_https.replace(
  30. "_normal",
  31. ""
  32. );
  33. this.photoViewer.show(profilePicutreHighResUrl, this.user.name, {
  34. share: true
  35. });
  36. }
  37. }