Starting profile image preview support.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-08-12 19:58:41 -05:00
parent a7d7b66403
commit 63f409fad8
7 changed files with 33 additions and 4 deletions

View File

@ -0,0 +1,12 @@
accessing
gtUsersMentioning: userName On: aView
<gtView>
^ aView columnedList
title: 'Users mentioning @',userName translated;
priority: 5;
items: [ self usersMentioning: userName ];
column: 'Imagen'
icon: [ :aTwitterUser | aTwitterUser profileImage asElement asScalableElement size: 32 @ 32 ]
width: 75;
column: 'User Name' text: [ :aTwitterUser | aTwitterUser userName ];
column: 'Name' text: [ :aTwitterUser | aTwitterUser name ]

View File

@ -1,7 +1,7 @@
accessing
userEndPointFor: username selecting: tweetsOrMentions
"I build a shared URL for querying last 100 mentions or tweets for a particular user.
Second parameter should be only 'tweets' or 'mentions', dateString should be YYYY-MM-DD."
Second parameter should be only 'tweets' or 'mentions', dateString, if present, should be YYYY-MM-DD."
| commonQueryParameters |
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username&max_results=100'.
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username,profile_image_url&max_results=100'.
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters

View File

@ -0,0 +1,3 @@
accessing
usersMentioning: userName
^ (self userMentionsFor: userName) messagesAuthors

View File

@ -2,4 +2,5 @@ accessing
fromDictionary: userDict
id := userDict at: 'id'.
name := userDict at: 'name'.
userName := userDict at: 'username'.
userName := userDict at: 'username'.
profileImageUrl := userDict at: 'profile_image_url'.

View File

@ -0,0 +1,9 @@
accessing
profileImage
| response |
response := ZnClient new url: (self profileImageUrl); get; response.
response contentType = ZnMimeType imageJpeg
ifTrue: [ ^ (JPEGReadWriter gtFromBuffer: response contents) asElement ].
response contentType = ZnMimeType imagePng
ifTrue: [ ^ (PNGReadWriter gtFromBuffer: response contents) asElement ].
^ BlElement new background: Color gray

View File

@ -0,0 +1,3 @@
accessing
profileImageUrl
^ profileImageUrl

View File

@ -8,7 +8,8 @@
"instvars" : [
"id",
"name",
"userName"
"userName",
"profileImageUrl"
],
"name" : "TwitterUser",
"type" : "normal"