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
avatarPicture
| response |
| response tempImage |
response := ZnClient new url: (self profileImageUrl); get; response.
response contentType = ZnMimeType imageJpeg
ifTrue: [ ^ (JPEGReadWriter gtFromBuffer: response contents) asElement ].
ifTrue: [ ^ (PluginBasedJPEGReadWriter gtFromBuffer: response contents) asElement ].
response contentType = ZnMimeType imagePng
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;
priority: 5;
stencil: [
| container imageContainer |
| container |
container := BlElement new
layout: BlFlowLayout new;
constraintsDo: [ :c |
c vertical fitContent.
c horizontal matchParent ];
padding: (BlInsets all: 10).
imageContainer := self avatarPicture;
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].
container addChild: self asCardElement ].

View File

@ -1,8 +1,3 @@
accessing
profileImage
| imageTemp |
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?"
^ self avatarPicture