Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding tweets that are not being rendered correctly #14

Closed
joesnarky opened this issue Jan 20, 2020 · 7 comments
Closed

Finding tweets that are not being rendered correctly #14

joesnarky opened this issue Jan 20, 2020 · 7 comments

Comments

@joesnarky
Copy link

This tweet is not rendered correctly. I am seeing many others like this.

{
"created_at": "Mon Jan 20 00:45:29 +0000 2020",
"id": 1219058331102347264,
"id_str": "1219058331102347264",
"full_text": "so me & 4 girls at work are taking a weekend trip to Chicago this June & one of them today said \u201chold on ashlyn, I meant to ask you beforehand....are you gonna do anything to get the police called on us?\u201d \ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02\ud83d\ude02",
"truncated": false,
"display_text_range": [0, 219],
"entities": {
"hashtags": [],
"symbols": [],
"user_mentions": [],
"urls": []
},
"metadata": {
"iso_language_code": "en",
"result_type": "recent"
},
"source": "\u003ca href="http://twitter.com/download/iphone" rel="nofollow"\u003eTwitter for iPhone\u003c/a\u003e",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 46506347,
"id_str": "46506347",
"name": "ash",
"screen_name": "ashlynluckett11",
"location": "",
"description": "University of Kentucky alumna",
"url": "https://t.co/fI37XghgnK",
"entities": {
"url": {
"urls": [{
"url": "https://t.co/fI37XghgnK",
"expanded_url": "http://www.ovinternational.org/donate",
"display_url": "ovinternational.org/donate",
"indices": [0, 23]
}]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 866,
"friends_count": 368,
"listed_count": 1,
"created_at": "Thu Jun 11 22:13:51 +0000 2009",
"favourites_count": 16649,
"utc_offset": null,
"time_zone": null,
"geo_enabled": true,
"verified": false,
"statuses_count": 39968,
"lang": null,
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "C0DEED",
"profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
"profile_background_tile": true,
"profile_image_url": "http://pbs.twimg.com/profile_images/1214380088604733440/F_2CxJA5_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1214380088604733440/F_2CxJA5_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/46506347/1577842418",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "C0DEED",
"profile_sidebar_fill_color": "DDEEF6",
"profile_text_color": "333333",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false,
"translator_type": "none"
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 0,
"favorite_count": 0,
"favorited": false,
"retweeted": false,
"lang": "en"
}

TWEET_UI renders it like this

image

TWITTER renders it like this
image

@joesnarky
Copy link
Author

Also you be nice to have time along with the date.

@kawa89
Copy link
Collaborator

kawa89 commented Feb 3, 2020

Nice catch. Will try to fix it ASAP ;-)

@kawa89
Copy link
Collaborator

kawa89 commented Feb 5, 2020

Fixed in version 1.1.0 :-) I also added time to the byline (for now only 24H format).

@kawa89 kawa89 closed this as completed Feb 5, 2020
@joesnarky
Copy link
Author

I made this change for 12hr time since I needed it.

image

changed tweet_vm.dart

added a createdAtTime: _createdAtTime(tweet), to the tweetvm model

and the method
static String _createdAtTime(Tweet tweet) {
DateFormat twitterFormat = new DateFormat("EEE MMM dd HH:mm:ss '+0000' yyyy");
final dateTime = twitterFormat.parseUTC(tweet.createdAt).toLocal();

DateFormat displayFormatTime = new DateFormat("h:mm a");
return displayFormatTime.format(dateTime);

}

and for byline.dart added a row for the date with time

Row(
      mainAxisSize: MainAxisSize.max,
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        Expanded(
          child: Row(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
			Text(
                  tweetVM.createdAt,
                  style: userScreenNameStyle,
                  textAlign: TextAlign.start,
                  softWrap: false,
                ),
			Text(
                " • " + tweetVM.createdAtTime,
                style: userScreenNameStyle,
                textAlign: TextAlign.start,
              )]))])
			
			
	]);

@kawa89
Copy link
Collaborator

kawa89 commented Feb 7, 2020

Nice. Will try to add some configuration for this in the next release ;-)

@joesnarky
Copy link
Author

joesnarky commented Feb 22, 2020

Oops I just realized even the Date displayed in your code is not correct for the users local timezone as well.

A tweet with created_at = "Sat Feb 22 04:39:00 +0000 2020" where my local timezone is -5h from this time. That means its 11:39PM on Sat Feb 21 my local time. Your code displays "Sat Feb 22"

Had to include the .toLocal() in your function to ensure the date is adjusted to my local date of the tweet. That way, when I click on the tweet and it jumps to twitter.com, the date matches with what twitter displays.

static String _createdAt(Tweet tweet) {
DateFormat twitterFormat = new DateFormat("EEE MMM dd HH:mm:ss '+0000' yyyy");
DateFormat displayFormat = new DateFormat("MM.dd.yyyy");
final dateTime = twitterFormat.parseUTC(tweet.createdAt).toLocal();
return displayFormat.format(dateTime);
}

@kawa89
Copy link
Collaborator

kawa89 commented Feb 24, 2020

👍 Will check it this week with a PR that is pending from another user ;)

kawa89 pushed a commit that referenced this issue Feb 28, 2020
* Add CONTRIBUTING.md file

* Release 0.1.1

* Update video_player and intl packages (#5)

* Release 0.1.1+1 (#6)

* Update video_player, chewie and photo_view packages (#8)

* Release 0.0.1+2 (#9)

* Update dependencies

* Release 0.1.1+3

* Update cached_network_image, photo_view, url_launcher packages

* release 0.1.1+4

* Fix cached_network_image and photo_view dependency version range

* Fix cached_network_image and photo_view dependency version range

* release 0.1.1+6

* Release 0.1.1+7 Revert updating cached_network_image, photo_view packages

* Update libraries to fix problem with new flutter versions (#10)

* Release 0.2.0-rc

* Release 0.2.0-rc.1

* Update cached_network_image, video_player and url_launcher. Updated JSON examples. (#13)

* Release 1.0.0

* #14 Fix default tweet text color when entities array was empty

* Add displaying time when tweet was created. For now only 24H format

* Update intl, video_player, photo_view

* Release 1.1.0 05.02.2020

* * Force en_US locale to support apps with a different default locale (#15)

* Add possibility to set the createdAt date format (#16)

* Release 1.2.0 28.02.2020

Co-authored-by: Jaime Blasco <[email protected]>
Co-authored-by: tristan-vrt <[email protected]>
kawa89 pushed a commit that referenced this issue Mar 17, 2020
* Update video_player and intl packages (#5)

* Release 0.1.1+1 (#6)

* Update video_player, chewie and photo_view packages (#8)

* Release 0.0.1+2 (#9)

* Update dependencies

* Release 0.1.1+3

* Update cached_network_image, photo_view, url_launcher packages

* release 0.1.1+4

* Fix cached_network_image and photo_view dependency version range

* release 0.1.1+6

* Release 0.1.1+7 Revert updating cached_network_image, photo_view packages

* Release 0.2.0-rc

* Release 0.2.0-rc.1

* Update cached_network_image, video_player and url_launcher. Updated JSON examples. (#13)

* Release 1.0.0

* #14 Fix default tweet text color when entities array was empty

* Add displaying time when tweet was created. For now only 24H format

* Update intl, video_player, photo_view

* Release 1.1.0 05.02.2020

* Add possibility to set the createdAt date format (#16)

* Release 1.2.0 28.02.2020

* Updated dependencies (#18)

* Update video_player, photo_view, url_launcher, chewie (#20)

* Release 1.2.1

Co-authored-by: Erik Carlsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants