Implementing tweets navigation in the NitterUser.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-03-31 20:49:30 -05:00
parent 204a462a2a
commit dd655260b4
4 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,10 @@
accessing
getMessages
| lastTweetsRaw lastTweets |
lastTweetsRaw := self rssFeed xmlDocument xpath: '//item'.
lastTweets := TweetsCollection new.
lastTweetsRaw do: [ :rssTweet |
lastTweets add: ((Tweet new fromNitterRssItem: rssTweet ))
].
^ lastTweets

View File

@ -0,0 +1,9 @@
accessing
fromNitterRssItem: xmlItem
| author |
author := (xmlItem xpath: 'dc:creator') stringValue allButFirst.
user := NitterUser new
userName: author .
created := (xmlItem xpath: 'pubDate') stringValue.
text := (XMLHTMLParser on: (xmlItem xpath: 'description') stringValue) parseDocument stringValue.
id := ((xmlItem xpath: 'guid') stringValue splitOn: '/') last copyReplaceAll: '#m' with: ''

View File

@ -41,7 +41,7 @@ asCardElement
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Tweets';
action: [ :e | e phlow spawnObject: self tweets ].
action: [ :e | e phlow spawnObject: self getMessages ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Web view';

View File

@ -1,3 +1,3 @@
accessing
tweets
^ tweets ifNil: [ self tweets: self getMessages ]
^ tweets ifNil: [ tweets := OrderedCollection new ]