Renaming methods for clarity.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-14 17:40:41 -05:00
parent b9eedc6ec3
commit f97b193c5e
24 changed files with 51 additions and 36 deletions

View File

@ -17,14 +17,14 @@ collectRawTweetsForPages: anInteger
tempTweet metadata tempTweet metadata
at: DateAndTime now asString put: key; at: DateAndTime now asString put: key;
yourself. yourself.
response tweets add: tempTweet. response messages add: tempTweet.
] ]
]. ].
response tweets doWithIndex: [ :tweet :i | response messages doWithIndex: [ :tweet :i |
| current previous | | current previous |
current := response tweets at: i. current := response messages at: i.
i < response tweets size ifTrue: [ i < response messages size ifTrue: [
previous := response tweets at: i + 1. previous := response messages at: i + 1.
current timelines current timelines
at: self userName put: previous id; at: self userName put: previous id;
yourself ]]. yourself ]].

View File

@ -1,15 +1,14 @@
accessing accessing
getLocalMessages getLocalMessages
"TO DO! This method should return messages from the local database" "TO DO! This method should return messages from the local database"
| allTweets myTweets tempTweets tempUsername | | allTweets myTweets tweetsWithAntecesor |
tempUsername := self userName.
TweetsCollection storeDB. TweetsCollection storeDB.
allTweets := Tweet storedInstances asOrderedCollection. allTweets := Tweet storedInstances asOrderedCollection.
allTweets ifNil: [ ^ nil ]. allTweets ifNil: [ ^ nil ].
myTweets := TweetsCollection new. myTweets := TweetsCollection new.
tempTweets := allTweets select: [ :each | each timelines isNotEmpty and: [each timelines keys first = tempUsername] ]. tweetsWithAntecesor := allTweets select: [ :each | each timelines isNotEmpty and: [ each timelines keys first = self userName ]].
myTweets tweets: tempTweets. myTweets messages: tweetsWithAntecesor.
self tweets: myTweets. self messages: myTweets.
^ {self tweets. self userName. tempTweets} ^ self messages

View File

@ -1,4 +1,4 @@
accessing accessing
getMessages getMessages
self getLocalMessages ifNil: [ self getRemoteMessagesFromRss ]. self getLocalMessages ifNil: [ self getRemoteMessagesFromRss ].
^ self tweets ^ self messages

View File

@ -19,4 +19,4 @@ getRemoteMessagesFromRss
yourself ]. yourself ].
current queries add: customQuery. current queries add: customQuery.
lastTweets add: current ]. lastTweets add: current ].
self tweets: lastTweets self messages: lastTweets

View File

@ -4,7 +4,7 @@ storeContents
| objectString directory tempFile oldFile dehidratated | | objectString directory tempFile oldFile dehidratated |
dehidratated := self copy. dehidratated := self copy.
dehidratated tweets: nil. dehidratated messages: nil.
objectString := STON toStringPretty: dehidratated. objectString := STON toStringPretty: dehidratated.
directory := self folder ensureCreateDirectory. directory := self folder ensureCreateDirectory.
oldFile := directory / 'profile', 'ston'. oldFile := directory / 'profile', 'ston'.

View File

@ -0,0 +1,6 @@
accessing
tweets
self messages ifNil: [ ^ nil ].
^ TweetsCollection new
messages: (self messages messages select: [ :each | each authorId = self id ]);
yourself

View File

@ -2,8 +2,8 @@ accessing
writeWordsFile writeWordsFile
| rawTweets rawWords collectionsWords count | | rawTweets rawWords collectionsWords count |
self tweets ifNil: [ ^ self ]. self messages ifNil: [ ^ self ].
rawTweets := self tweets tweets. rawTweets := self messages messages.
rawWords := OrderedCollection new. rawWords := OrderedCollection new.
collectionsWords := ((rawTweets select: collectionsWords := ((rawTweets select:

View File

@ -1,3 +1,3 @@
accessing accessing
add: aTweet add: aTweet
self tweets add: aTweet self messages add: aTweet

View File

@ -11,7 +11,7 @@ gtTweetsFor: aView
c vertical fitContent. c vertical fitContent.
c horizontal matchParent ]; c horizontal matchParent ];
padding: (BlInsets all: 10). padding: (BlInsets all: 10).
self tweets do: [ :each | self messages do: [ :each |
imageContainer := BrAsyncWidget new imageContainer := BrAsyncWidget new
aptitude: BrShadowAptitude new; aptitude: BrShadowAptitude new;
background: Color white; background: Color white;

View File

@ -0,0 +1,3 @@
accessing
messages: aTweetsCollection
^ tweets := aTweetsCollection

View File

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

View File

@ -0,0 +1,7 @@
accessing
newest
self messages ifNil: [ ^ nil ].
self messages ifNilEmpty: [ ^ nil ].
self pinned created > self messages second created
ifTrue: [ ^ self pinned ]
ifFalse: [ ^ self messages second ]

View File

@ -0,0 +1,3 @@
accessing
oldest
^ self messages last

View File

@ -1,3 +1,3 @@
accessing accessing
size size
^ self tweets size ^ self messages size

View File

@ -1,7 +1,7 @@
accessing accessing
store store
ReStore isConnected ifFalse: [ self class storeDB]. "Starting the ReStore singleton." ReStore isConnected ifFalse: [ self class storeDB]. "Starting the ReStore singleton."
self tweets do: [:each | ReStore evaluateAsTransaction: [ self messages do: [:each | ReStore evaluateAsTransaction: [
each store. each store.
each user isInDB ifFalse: [ each user store ] each user isInDB ifFalse: [ each user store ]
] ]

View File

@ -1,3 +0,0 @@
accessing
tweets: aTweetsCollection
^ tweets := aTweetsCollection

View File

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

View File

@ -8,7 +8,7 @@ messagesAuthors
(groupedTweets at: (user id)) do: [:tweetDict | | currentTweet | (groupedTweets at: (user id)) do: [:tweetDict | | currentTweet |
currentTweet := Tweet new fromDictionary: tweetDict. currentTweet := Tweet new fromDictionary: tweetDict.
currentTweet user: user. currentTweet user: user.
user tweets add: currentTweet. user messages add: currentTweet.
]. ].
user. user.
] ]

View File

@ -0,0 +1,3 @@
accessing
messages: aTweetsCollection
messages := aTweetsCollection

View File

@ -0,0 +1,3 @@
accessing
messages
^ messages ifNil: [ messages := OrderedCollection new ]

View File

@ -1,3 +0,0 @@
accessing
tweets: aTweetsCollection
tweets := aTweetsCollection

View File

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

View File

@ -12,11 +12,11 @@
"profileImageUrl", "profileImageUrl",
"description", "description",
"metrics", "metrics",
"tweets",
"createdAt", "createdAt",
"groups", "groups",
"url", "url",
"profileBio" "profileBio",
"messages"
], ],
"name" : "TwitterUser", "name" : "TwitterUser",
"type" : "normal" "type" : "normal"

View File

@ -10,4 +10,4 @@ gtTwitterUsersGroupOn: aView
width: 75; width: 75;
column: 'User Name' text: [ :aTwitterUser | '@', aTwitterUser userName ]; column: 'User Name' text: [ :aTwitterUser | '@', aTwitterUser userName ];
column: 'Name' text: [ :aTwitterUser | aTwitterUser name ]; column: 'Name' text: [ :aTwitterUser | aTwitterUser name ];
column: 'Mentions' text: [ :aTwitterUser | aTwitterUser tweets size asString ] column: 'Mentions' text: [ :aTwitterUser | aTwitterUser messages size asString ]