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
at: DateAndTime now asString put: key;
yourself.
response tweets add: tempTweet.
response messages add: tempTweet.
]
].
response tweets doWithIndex: [ :tweet :i |
response messages doWithIndex: [ :tweet :i |
| current previous |
current := response tweets at: i.
i < response tweets size ifTrue: [
previous := response tweets at: i + 1.
current := response messages at: i.
i < response messages size ifTrue: [
previous := response messages at: i + 1.
current timelines
at: self userName put: previous id;
yourself ]].

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ storeContents
| objectString directory tempFile oldFile dehidratated |
dehidratated := self copy.
dehidratated tweets: nil.
dehidratated messages: nil.
objectString := STON toStringPretty: dehidratated.
directory := self folder ensureCreateDirectory.
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
| rawTweets rawWords collectionsWords count |
self tweets ifNil: [ ^ self ].
rawTweets := self tweets tweets.
self messages ifNil: [ ^ self ].
rawTweets := self messages messages.
rawWords := OrderedCollection new.
collectionsWords := ((rawTweets select:

View File

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

View File

@ -11,7 +11,7 @@ gtTweetsFor: aView
c vertical fitContent.
c horizontal matchParent ];
padding: (BlInsets all: 10).
self tweets do: [ :each |
self messages do: [ :each |
imageContainer := BrAsyncWidget new
aptitude: BrShadowAptitude new;
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
size
^ self tweets size
^ self messages size

View File

@ -1,7 +1,7 @@
accessing
store
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 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 |
currentTweet := Tweet new fromDictionary: tweetDict.
currentTweet user: user.
user tweets add: currentTweet.
user messages add: currentTweet.
].
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",
"description",
"metrics",
"tweets",
"createdAt",
"groups",
"url",
"profileBio"
"profileBio",
"messages"
],
"name" : "TwitterUser",
"type" : "normal"

View File

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