|
@@ -1,4 +1,5 @@
|
|
|
import { Component, Input } from "@angular/core";
|
|
|
+import { TwitterApiProvider } from "../../providers/twitter-api/twitter-api";
|
|
|
|
|
|
/**
|
|
|
* Generated class for the TweetActionsComponent component.
|
|
@@ -14,5 +15,21 @@ export class TweetActionsComponent {
|
|
|
@Input()
|
|
|
data: any[];
|
|
|
|
|
|
- constructor() {}
|
|
|
+ constructor(private twitter: TwitterApiProvider) {}
|
|
|
+
|
|
|
+ like(id) {
|
|
|
+ if (!this.data["private_tweet"]) {
|
|
|
+ this.twitter.likeTweet(id);
|
|
|
+ this.data["favorited"] = true;
|
|
|
+ this.data["favorite_count"]++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ removeLike(id) {
|
|
|
+ if (!this.data["private_tweet"]) {
|
|
|
+ this.twitter.unlikeTweet(id);
|
|
|
+ this.data["favorited"] = false;
|
|
|
+ this.data["favorite_count"]--;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|