|
@@ -59,19 +59,24 @@ export class MockProvider {
|
|
|
}
|
|
|
|
|
|
public async replyTweet() {}
|
|
|
-
|
|
|
|
|
|
- public writeTweet(twt: string , isPrivate: boolean, retwt, replyid) {
|
|
|
- console.log('inside writetweet',retwt,replyid);
|
|
|
+
|
|
|
+ public writeTweet(twt: string, isPrivate: boolean, retwt, replyid) {
|
|
|
+ console.log('inside writetweet', retwt, replyid);
|
|
|
// console.log('inside writetweet obj is:',this.mockTweets[0].full_text);
|
|
|
let newTweet = Object.assign({}, this.mockTweets[0]);
|
|
|
- newTweet.full_text = twt;
|
|
|
- newTweet.id = Math.floor(100000 + Math.random() * 900000);
|
|
|
- newTweet.id_str = newTweet.id ;
|
|
|
newTweet.full_text = twt;
|
|
|
- newTweet.retweet = retwt;
|
|
|
- newTweet.replyToStatusId = replyid;
|
|
|
- if(isPrivate){
|
|
|
+ newTweet.id = Math.floor(100000 + Math.random() * 900000);
|
|
|
+ newTweet.id_str = newTweet.id;
|
|
|
+ newTweet.full_text = twt;
|
|
|
+ if(retwt){
|
|
|
+ newTweet.is_quote_status = true;
|
|
|
+ newTweet.quoted_status = retwt;
|
|
|
+ newTweet.quoted_status_id = retwt.id;
|
|
|
+ newTweet.quoted_status_id_str = retwt.id_str;
|
|
|
+ }
|
|
|
+ newTweet.replyToStatusId = replyid;
|
|
|
+ if (isPrivate) {
|
|
|
newTweet.private_tweet = true;
|
|
|
}
|
|
|
console.log('new tweet ', newTweet);
|
|
@@ -112,31 +117,34 @@ export class MockProvider {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public likeTweet(id){
|
|
|
- console.log('fetch tweet id:',id , this.mockTweets);
|
|
|
- const result = this.mockTweets.find(x=>x.id_str == id);
|
|
|
- // this.mockTweets.forEach(el=>{
|
|
|
+ public likeTweet(id) {
|
|
|
+ console.log('fetch tweet id:', id, this.mockTweets);
|
|
|
+ const result = this.mockTweets.find(x => x.id_str == id);
|
|
|
+ // this.mockTweets.forEach(el=>{
|
|
|
// console.log("mocktweet el is:",el);
|
|
|
// })
|
|
|
result.favorited = true;
|
|
|
result.favorite_count++;
|
|
|
- console.log('tweet found and modified:',result);
|
|
|
+ console.log('tweet found and modified:', result);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public unlikeTweet(id){
|
|
|
- console.log('fetch tweet id:',id , this.mockTweets);
|
|
|
- const result = this.mockTweets.find(x=>x.id_str == id);
|
|
|
- // this.mockTweets.forEach(el=>{
|
|
|
+ public unlikeTweet(id) {
|
|
|
+ console.log('fetch tweet id:', id, this.mockTweets);
|
|
|
+ const result = this.mockTweets.find(x => x.id_str == id);
|
|
|
+ // this.mockTweets.forEach(el=>{
|
|
|
// console.log("mocktweet el is:",el);
|
|
|
// })
|
|
|
result.favorited = false;
|
|
|
result.favorite_count--;
|
|
|
- console.log('tweet found and modified:',result);
|
|
|
+ console.log('tweet found and modified:', result);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public fetchTweet(tweetID) {
|
|
|
+ return this.mockTweets.find(x => x.id_str == tweetID);
|
|
|
+ }
|
|
|
|
|
|
private async fetchPrivateTweets(privateTweetsData: object[]) {
|
|
|
|