Skip to content

Commit

Permalink
Fix issue #9 Retweets on Feed display the wrong username.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fbriere committed Jul 15, 2023
1 parent 44f255a commit 2528cb4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class _SquawkerTwitterClient extends TwitterClient {

var response = await http.get(uri, headers: {
...?headers,
'Authorization': 'Bearer $_accessToken',
'authorization': 'Bearer $_accessToken',
'x-guest-token': await getToken(),
'x-twitter-active-user': 'yes',
'user-agent': faker.internet.userAgent()
Expand Down Expand Up @@ -502,16 +502,22 @@ class Twitter {
for (var tweetData in tweets) {
var tweet = TweetWithCard.fromJson(tweetData);

if (!includeReplies && tweet.inReplyToStatusIdStr != null) {
// Exclude replies
continue;
}

var quotedStatusMap = tweetData['quoted_status'];
if (quotedStatusMap != null) {
TweetWithCard quotedStatus = TweetWithCard.fromJson(quotedStatusMap);
tweet.quotedStatus = quotedStatus;
tweet.quotedStatusWithCard = quotedStatus;
}

if (!includeReplies && tweet.inReplyToStatusIdStr != null) {
// Exclude replies
continue;
var retweetedStatusMap = tweetData['retweeted_status'];
if (retweetedStatusMap != null) {
TweetWithCard retweetedStatus = TweetWithCard.fromJson(retweetedStatusMap);
tweet.retweetedStatus = retweetedStatus;
tweet.retweetedStatusWithCard = retweetedStatus;
}

tweetMap[tweet.idStr!] = tweet;
Expand Down

0 comments on commit 2528cb4

Please sign in to comment.