Improving tweets view and user profile image methods.
This commit is contained in:
parent
6e69fa5b3a
commit
03355de4f4
@ -1,4 +1,12 @@
|
||||
accessing
|
||||
downloadProfileImage
|
||||
|
||||
^ self exportProfileImageOn: self folder / 'profile-image', 'jpg'
|
||||
self remoteIsFound
|
||||
ifTrue: [ ^ self exportProfileImageOn: self folder / 'profile-image', 'jpg' ]
|
||||
ifFalse: [ | tempFile |
|
||||
tempFile := (self folder / 'profile-image', 'jpg') asFileReference.
|
||||
tempFile ensureCreateFile.
|
||||
tempFile binaryWriteStreamDo: [ :stream |
|
||||
stream nextPutAll: 'https://mutabit.com/repos.fossil/mutabit/uv/wiki/commons/twitter-user-image-default.jpg' asUrl retrieveContents.
|
||||
super class inform: 'Exported as: ', String cr, tempFile fullName.
|
||||
^ self folder / 'profile-image', 'jpg' ]]
|
@ -3,5 +3,7 @@ profileImageFile
|
||||
|
||||
| file |
|
||||
file := (self folder / 'profile-image', 'jpg').
|
||||
file exists ifTrue: [ ^ file ].
|
||||
file exists ifTrue: [ file asFileReference size = 0
|
||||
ifTrue:[ ^ self downloadProfileImage ].
|
||||
^ file. ].
|
||||
^ self downloadProfileImage
|
@ -2,5 +2,7 @@ accessing
|
||||
profileImageUrl
|
||||
|
||||
| documentTree |
|
||||
documentTree := [ self documentTree ] onErrorDo: [ ^ nil ].
|
||||
self remoteIsFound
|
||||
ifFalse:[ ^ nil ].
|
||||
documentTree := self documentTree.
|
||||
^ profileImageUrl := self class nitterProvider, (((documentTree xpath: '//div[@class="profile-card-info"]//a[@class="profile-card-avatar"]') @ 'href') stringValue copyReplaceAll: '%2F' with: '/') copyWithoutFirst
|
@ -0,0 +1,5 @@
|
||||
accessing
|
||||
remoteIsFound
|
||||
|
||||
^ (ZnClient new url: (self userNameLink asUrl); get; response) isNotFound not
|
||||
|
@ -1,5 +1,7 @@
|
||||
accessing
|
||||
url
|
||||
self remoteIsFound
|
||||
ifFalse: [ ^ url := nil ].
|
||||
^ url ifNil: [ | temp |
|
||||
temp := ((self documentTree xpath: '//div[@class="profile-website"]') // 'a' @@ 'href') first.
|
||||
temp ifNil: [ ^ url := nil ].
|
||||
|
@ -22,4 +22,5 @@ gtTweetsFor: aView
|
||||
stencil: [ each asCardElement margin: (BlInsets all: 15) ].
|
||||
container addChild: imageContainer
|
||||
].
|
||||
container asScrollableElement ]
|
||||
container asScrollableElement ];
|
||||
actionUpdateButtonTooltip: 'Update view'
|
@ -2,6 +2,11 @@ accessing
|
||||
asCardElement
|
||||
| aModeLook anEditor textInfoPane buttonsPane webpageButton |
|
||||
|
||||
self remoteIsFound
|
||||
ifFalse:[ description := 'The user does not exist'.
|
||||
url := nil.
|
||||
createdAt := ZTimestamp now. ].
|
||||
|
||||
aModeLook := BrEditorModeAptitude new
|
||||
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
|
||||
editableUnfocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors editorBorderColor width: 1) ];
|
||||
|
@ -0,0 +1,4 @@
|
||||
accessing
|
||||
remoteIsFound
|
||||
|
||||
^ SubclassResponsibility
|
Loading…
Reference in New Issue
Block a user