08.1376 Migration: Fixing profile previews problems caused by BlLazyElement deprecation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-09 23:09:23 -05:00
parent 36c261d534
commit 01a62b2b2a
4 changed files with 10 additions and 20 deletions

View File

@ -1,9 +1,10 @@
accessing accessing
avatarPicture avatarPicture
| response | | response tempImage |
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: [ ^ (JPEGReadWriter gtFromBuffer: response contents) asElement ]. ifTrue: [ ^ (PluginBasedJPEGReadWriter gtFromBuffer: response contents) asElement ].
response contentType = ZnMimeType imagePng response contentType = ZnMimeType imagePng
ifTrue: [ ^ (PNGReadWriter gtFromBuffer: response contents) asElement ]. ifTrue: [ ^ (PNGReadWriter gtFromBuffer: response contents) asElement ].
^ BlElement new background: Color gray tempImage on: Error do: [ ^ GtABContact new avatar ].
^ tempImage value asElement .

View File

@ -0,0 +1,3 @@
ui
avatarPicture
^ self subclassResponsibility

View File

@ -5,20 +5,11 @@ gtViewProfileDetailsOn: aView
title: 'Details' translated; title: 'Details' translated;
priority: 5; priority: 5;
stencil: [ stencil: [
| container imageContainer | | container |
container := BlElement new container := BlElement new
layout: BlFlowLayout new; layout: BlFlowLayout new;
constraintsDo: [ :c | constraintsDo: [ :c |
c vertical fitContent. c vertical fitContent.
c horizontal matchParent ]; c horizontal matchParent ];
padding: (BlInsets all: 10). padding: (BlInsets all: 10).
imageContainer := self avatarPicture; container addChild: self asCardElement ].
withGlamorousPreview;
aptitude: BrShadowAptitude new;
background: Color white;
margin: (BlInsets all: 20);
constraintsDo: [ :c |
c vertical exact: 175.
c horizontal matchParent ];
elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ].
container addChild: imageContainer].

View File

@ -1,8 +1,3 @@
accessing accessing
profileImage profileImage
| imageTemp | ^ self avatarPicture
imageTemp := BrAsyncFileWidget new url: self profileImageUrl.
"Going back to the previous version after BlLazyElement that solved the issues was deprecated"
imageTemp on: Error do: [ ^ GtABContact new avatar ].
^ imageTemp value asElement
"Should a generic avatar be reimplemented?"