Procházet zdrojové kódy

Switch to 280char twitter API

Carsten Porth před 5 roky
rodič
revize
c63a3e94e2

+ 1 - 1
app/src/components/tweet-body/tweet-body.html

@@ -1,4 +1,4 @@
 <!-- Generated template for the TweetBodyComponent component -->
 <div>
-  <p>{{ body }}</p>
+  <p>{{ text }}</p>
 </div>

+ 2 - 1
app/src/components/tweet-body/tweet-body.ts

@@ -12,7 +12,8 @@ import { Component, Input } from '@angular/core';
 })
 export class TweetBodyComponent {
 
-  @Input() body: any[];
+  @Input() text: any[];
+  @Input() entities: any[];
 
   constructor() {}
 

+ 1 - 1
app/src/components/tweet/tweet.html

@@ -1,5 +1,5 @@
 <ion-item text-wrap>
   <tweet-header [user]="data.user" [tweetCreatedAt]="data.created_at"></tweet-header>
-  <tweet-body [body]="data.text"></tweet-body>
+  <tweet-body [text]="data.full_text" [entities]="data.entities"></tweet-body>
   <tweet-actions [data]="data"></tweet-actions>
 </ion-item>

+ 5 - 4
app/src/providers/twitter-api/twitter-api.ts

@@ -31,8 +31,9 @@ export class TwitterApiProvider {
   }
 
   public fetchHomeFeed() {
-    return this.client.get('statuses/home_timeline', { count: 10 })
+    return this.client.get('statuses/home_timeline', { count: 10, include_entities: true, tweet_mode: "extended" })
       .then(res => {
+        console.log(res);
         return res;
       })
       .catch(err => {
@@ -41,7 +42,7 @@ export class TwitterApiProvider {
   }
 
   public fetchHomeFeedSince(id) {
-    return this.client.get('statuses/home_timeline', { max_id: id, count: 15 })
+    return this.client.get('statuses/home_timeline', { max_id: id, count: 15, include_entities: true, tweet_mode: "extended" })
       .then(res => {
         return res;
       })
@@ -61,7 +62,7 @@ export class TwitterApiProvider {
   }
 
   public fetchUserTimeline(userId) {
-    return this.client.get('statuses/user_timeline', { user_id: userId })
+    return this.client.get('statuses/user_timeline', { user_id: userId, include_entities: true, tweet_mode: "extended" })
       .then(res => {
         return res.data;
       })
@@ -72,7 +73,7 @@ export class TwitterApiProvider {
 
 
   public fetchUserTimelineSince(userId, maxId) {
-    return this.client.get('statuses/user_timeline', { user_id: userId, max_id: maxId })
+    return this.client.get('statuses/user_timeline', { user_id: userId, max_id: maxId, include_entities: true, tweet_mode: "extended" })
       .then(res => {
         return res.data;
       })