Refactoring for improving display times.

This commit is contained in:
ruidajo 2023-07-26 20:52:32 -05:00
parent 7d77d26691
commit 43662d3fce
7 changed files with 27 additions and 1 deletions

View File

@ -2,6 +2,8 @@ accessing
asDictionary asDictionary
| tweets tweetsHistogramData repliesHistogramData quotesHistogramData retweetsHistogramData | | tweets tweetsHistogramData repliesHistogramData quotesHistogramData retweetsHistogramData |
[self config at: 'lang']
onErrorDo: [ ^ self inform: 'Please put a lang key with a language (for example: en) in the object config.' ].
tweets := self messages. tweets := self messages.
tweetsHistogramData := self tweetsByWeeksTimeSpan. tweetsHistogramData := self tweetsByWeeksTimeSpan.
repliesHistogramData := self repliesByWeeksTimeSpan. repliesHistogramData := self repliesByWeeksTimeSpan.

View File

@ -1,6 +1,9 @@
accessing accessing
avatarPicture avatarPicture
| response | | response profileImgFile|
profileImgFile := self profileImageFile.
profileImgFile exists
ifTrue: [ ^ (ImageReadWriter formFromFileNamed: profileImgFile fullName) asElement ].
response := ZnClient new url: (self profileImageUrl); get; response. response := ZnClient new url: (self profileImageUrl); get; response.
response contentType = ZnMimeType imageJpeg response contentType = ZnMimeType imageJpeg
ifTrue: [ ^ (PluginBasedJPEGReadWriter gtFromBuffer: response contents) asElement ]. ifTrue: [ ^ (PluginBasedJPEGReadWriter gtFromBuffer: response contents) asElement ].

View File

@ -2,6 +2,7 @@ accessing
messages messages
messages ifNil: [ messages := TweetsCollection new ]. messages ifNil: [ messages := TweetsCollection new ].
messages ifEmpty: [ self getLocalMessages ].
messages ifEmpty: [ self getRemoteMessagesFromHtml ]. messages ifEmpty: [ self getRemoteMessagesFromHtml ].
[ config at: 'reportingPeriod' ] [ config at: 'reportingPeriod' ]
onErrorDo: [ self config onErrorDo: [ self config

View File

@ -0,0 +1,7 @@
accessing
correctMetadataUrl
self metadata keysAndValuesDo: [ :key :value |
(value includesSubstring: '42l.fr')
ifTrue: [ self metadata at: key put: (value copyReplaceAll: '42l.fr' with: 'net' )]
].
^ self

View File

@ -0,0 +1,7 @@
accessing
updateFromWeb
| url webContents |
url := (NitterUser nitterProvider, self user userName, '/status/', self id) asUrl.
webContents := XMLHTMLParser parse: url retrieveContents.
^ Tweet new fromNitterHtmlItem: webContents.

View File

@ -4,7 +4,9 @@ reStoreDefinition
"defineAsID: #id;" "defineAsID: #id;"
define: #id as: String; define: #id as: String;
define: #userName as: String; define: #userName as: String;
define: #name as: String;
define: #profileImageUrl as: String; define: #profileImageUrl as: String;
define: #profileBio as: String; define: #profileBio as: String;
define: #description as: String;
"define: #createdAt as: String;" "define: #createdAt as: String;"
yourself. yourself.

View File

@ -0,0 +1,4 @@
accessing
profileImageUrl: anUrl
profileImageUrl := anUrl