Skip to content

Profilbilder in der Chatliste und in Gruppenchats anzeigen #499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
hasPhoto

^ self photoId isNil not
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ initializeFromChatEvent: anEvent
id: (anEvent at: 'id');
canSendMessages: ((anEvent at: 'permissions') at: 'can_send_messages');
muted: ((anEvent at: 'notification_settings') at: 'mute_for') > 0;
lastMessage: ''
lastMessage: ''.

(anEvent at: 'photo') ifNotNil: [
self photoId: (((anEvent at: 'photo') at: 'small') at: 'id').
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
photoId: aNumber

photoId := aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
photoId

^ photoId
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
"core" : "per 6/4/2021 16:00",
"core:" : "per 6/4/2021 15:58",
"getMessageById:" : "JS 5/26/2022 14:49",
"hasPhoto" : "rgw 6/2/2022 15:20",
"id" : "rs 6/7/2020 22:20",
"id:" : "pk 8/4/2021 11:25",
"ifNotWaitingForUpdate:" : "js 8/2/2020 13:17",
"infoLoaded" : "per 6/4/2021 15:59",
"infoLoaded:" : "per 6/4/2021 15:51",
"initialize" : "JS 5/26/2022 14:31",
"initializeFromChatEvent:" : "pk 8/5/2021 15:48",
"initializeFromChatEvent:" : "rgw 6/2/2022 15:24",
"isBasicGroup" : "per 6/15/2021 08:08",
"isChannel" : "per 7/17/2021 15:51",
"isChannel:" : "per 7/17/2021 15:50",
Expand All @@ -45,6 +46,8 @@
"numberOfMessages" : "RS 7/31/2021 15:19",
"numberOfRequestedMessages" : "js 8/1/2020 17:43",
"numberOfRequestedMessages:" : "JS 5/20/2022 11:34",
"photoId" : "rgw 6/2/2022 11:51",
"photoId:" : "rgw 6/2/2022 11:51",
"position" : "RS 5/10/2021 21:11",
"position:" : "pk 8/6/2021 18:59",
"positionKnown" : "pk 8/6/2021 18:25",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"isChannel",
"messageIds",
"messageDictionary",
"selectedReplyToMessageId" ],
"selectedReplyToMessageId",
"photoId" ],
"name" : "TCCChat",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ accessing
getFormFor: anImageId

| promise |
promise := self at: anImageId ifAbsent:
[self at: anImageId put: Promise new.
self requestImageFor: anImageId with: (self at: anImageId).
self at: anImageId].
promise := self getFormPromiseFor: anImageId.
promise wait.
^ self class imageFormFrom: promise value
^ promise value
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accessing
getFormPromiseFor: anImageId

| promise |
promise := self at: anImageId ifAbsent: [
self at: anImageId put: Promise new.
self requestImageFor: anImageId with: (self at: anImageId).
self at: anImageId
].
^ promise >>= [:aPath | self class imageFormFrom: aPath]
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"instance" : {
"core" : "pk 6/19/2021 16:13",
"core:" : "pk 6/19/2021 16:13",
"getFormFor:" : "pk 6/19/2021 17:25",
"requestImageFor:with:" : "JB 8/1/2021 11:35" } }
"getFormFor:" : "rgw 6/6/2022 18:51",
"getFormPromiseFor:" : "rgw 6/6/2022 18:43",
"requestImageFor:with:" : "rgw 6/2/2022 11:17" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ senderName

^ (self senderType) caseOf: {
[#messageSenderChat] -> [self chat title].
[#messageSenderUser] -> [(self core userStore getUserFor: self userId) fullName].
[#messageSenderUser] -> [self senderUser fullName].
} otherwise: ['Unsupported sender type']
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
senderUser

^ self core userStore getUserFor: self userId
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"replyText" : "rgw 5/12/2022 15:35",
"replyToMessageId" : "rgw 5/12/2022 13:43",
"replyToMessageId:" : "rgw 5/12/2022 13:43",
"senderName" : "tr 7/25/2021 18:00",
"senderName" : "JS 6/11/2022 09:50",
"senderType" : "tom.richter 7/25/2021 10:42",
"senderType:" : "pk 8/4/2021 11:42",
"senderUser" : "JS 6/11/2022 09:49",
"shouldNotify" : "per 6/16/2021 17:35",
"userId" : "tom.richter 7/25/2021 11:17",
"userId:" : "pk 8/4/2021 11:42" } }
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
instance creation
newFrom: anEvent

^ self new
| user |
user := self new
id: (anEvent at: 'id');
firstName: (anEvent at: 'first_name');
lastName: (anEvent at: 'last_name');
username: (anEvent at: 'username')
username: (anEvent at: 'username').

anEvent at: 'profile_photo' ifPresent: [:profilePhoto | user photoId: ((profilePhoto at: 'small') at: 'id')] ifAbsent: [].

^ user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
hasPhoto

^ self photoId isNil not
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
photoId: aNumber

photoId := aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
photoId

^ photoId
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"class" : {
"newFrom:" : "pk 8/5/2021 16:59" },
"newFrom:" : "JS 6/11/2022 10:19" },
"instance" : {
"=" : "pk 6/13/2021 12:52",
"firstName" : "per 5/15/2021 12:03",
"firstName:" : "pk 8/4/2021 11:57",
"fullName" : "JB 6/13/2021 10:28",
"hasPhoto" : "JS 6/11/2022 09:32",
"hash" : "JB 6/13/2021 14:01",
"id" : "pk 5/9/2021 16:33",
"id:" : "pk 8/4/2021 11:56",
"initialize" : "JB 6/13/2021 10:52",
"lastName" : "per 5/15/2021 12:03",
"lastName:" : "pk 8/4/2021 11:58",
"photoId" : "JS 6/11/2022 09:26",
"photoId:" : "JS 6/11/2022 09:26",
"username" : "pk 5/9/2021 16:33",
"username:" : "pk 8/4/2021 12:04" } }
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"id",
"username",
"firstName",
"lastName" ],
"lastName",
"photoId" ],
"name" : "TCCUser",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultImageWidth

^ self defaultHeight
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultLastMessageOffset

^ 20 @ -12
^ (15 @ -17) + (self defaultPhotoSize @ 0)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultMessagePreviewLength

^ 37
^ 30
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
as yet unclassified
defaultPhoto
"@linter-ignore"
"This is an auto-generated method"
^ (Form fromBinaryStream: (Base64MimeConverter mimeDecodeToBytes: 'iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAABhGlDQ1BJQ0MgcHJvZmlsZQAA
KJF9kT1Iw0AcxV/TakWqDlYQcchQnSyIijhqFYpQIdQKrTqYXPoFTRqSFBdHwbXg4Mdi1cHF
WVcHV0EQ/ABxdHJSdJES/5cWWsR4cNyPd/ced+8AoVZimhUYBzTdNpPxmJjOrIrBV3RCQC8G
EJCZZcxJUgKe4+sePr7eRXmW97k/R4+atRjgE4lnmWHaxBvE05u2wXmfOMwKskp8Tjxm0gWJ
H7muNPiNc95lgWeGzVRynjhMLObbWGljVjA14iniiKrplC+kG6xy3uKslSqseU/+wlBWX1nm
Os1hxLGIJUgQoaCCIkqwEaVVJ8VCkvZjHv4h1y+RSyFXEYwcCyhDg+z6wf/gd7dWbnKikRSK
AR0vjvMxAgR3gXrVcb6PHad+AvifgSu95S/XgJlP0qstLXIE9G0DF9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gP5sAIbb5MlCR/ev+MaiYQQnB63UK9W
A4v2QAcsJUnCh/Mz1Dls7OlUCn+dn6FaCTaBD21Geq4b6HR7cHc8gCKEoFGr4vDNfih9yNCn
9McTDYPhCLaz2bC5IAiolkvY32sGYhaRBPirLMvCdK7DMEwsHAeU0nuRlkqlkFMVFAsFlIuF
SHS+I3PRRlVVqL8YzGpFQekKPmMQRRGyJEXyrCVUgIwxuJ4H1/WwXC7hekusVkv4jMGnPhgY
GGMghEAURBACyLKMlCx/+5mSkc1kQgUbKEDHdaEbJizLwsK2YdsO/B2PQAkhyKTTULJZqIqC
fD4HJRscVK57IGMMc93AdDbHXNfv3X/jFhWiiHw+h0qphBLnvZILQMuyMBxr0Gaze2YQtARC
UCwWUK9WUSzknz0ynw0gYwyT6Qxft7g4GJTS6TQatRoatcqzReXOABljmM7m6PVvIzmV9dgS
399roFmv7zytsBNAw7TQ6XZ3vnEZlmRZRuvgzU7l31YAKaXo9QcYjseRHSTaRPl8Dm9bR1tV
NBsDtKwF2ledyM4Abm02goDjo4ONOzkb5YG3X4fo9W9fRNT9X77v4+q6C9Na4PjoEMKabr0W
QMYYOt0eRiHceQtao/EEjuPi/N3btZxaWAde+6rzKuD9NEcT/3xqY7lG4i+sAy/oW+BR0MK2
8bF98cdC4EmAN73+q4R3J9t28Oni6sl6/VGAw9EYX0cjvHYZponrm95mAG3Hwc2XPhJ9N5bJ
5NHvYRAe2vcurq65TLTHWZ2b3oOmIjxk4wvbTog9VH3dDp4GSCnFlwd+KdE3jSfavbpf+H2t
a1hG5JJ0FMUYw+1w+DjA4WicUPqDJtr0tyATftq1FZt+XthRqGnT+wBnup7QWVO/svoBUNeN
hMzaybX1oyMl3IVlkrqsL9/3sfjuxgIAeJ73Int8PHU3FCUBwIr6UJVsQmWTKPwecP8B+Yeq
UNZlH5EAAAAASUVORK5CYII=' readStream))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default values
defaultPhotoSize

^ self defaultHeight
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultTitleOffset

^ 20 @ 20
^ (15 @ 15) + (self defaultPhotoSize @ 0)
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ newWithChat: aChat width: aNumber
addTitle;
addLastMessage;
addBorder;
addPhoto;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
drawing
addPhoto

| promise morph |
TCUTelegram devMode ifTrue: [^ self].
self chat hasPhoto ifTrue: [
promise := self chat core imageStore getFormPromiseFor: self chat photoId.
promise >>= [:aForm |
morph := (aForm scaledToSize: self class defaultPhotoSize) asMorph.
morph position: self position.
self addMorphBack: morph.
]
] ifFalse: [
self addMorphBack: TCUDefaultValues defaultProfilePhoto asMorph.
]
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"class" : {
"defaultHeight" : "rs 7/4/2020 18:54",
"defaultLastMessageOffset" : "JB 6/11/2021 15:17",
"defaultMessagePreviewLength" : "JB 6/11/2021 15:17",
"defaultImageWidth" : "rgw 6/2/2022 15:26",
"defaultLastMessageOffset" : "rgw 6/2/2022 15:28",
"defaultMessagePreviewLength" : "rgw 6/2/2022 15:32",
"defaultPhoto" : "rgw 6/2/2022 16:26",
"defaultPhotoSize" : "rgw 6/2/2022 15:27",
"defaultSelectColor" : "JB 7/19/2021 12:11",
"defaultTitleLength" : "RK 7/4/2021 13:30",
"defaultTitleOffset" : "JB 6/11/2021 15:18",
"newWithChat:width:" : "RK 8/4/2021 10:45" },
"defaultTitleOffset" : "rgw 6/2/2022 15:28",
"newWithChat:width:" : "rgw 6/2/2022 15:18" },
"instance" : {
"addBorder" : "RK 8/4/2021 12:05",
"addLastMessage" : "RK 8/4/2021 12:06",
"addPhoto" : "js 6/13/2022 18:09",
"addTitle" : "RK 8/4/2021 12:06",
"chat" : "rs 6/17/2020 21:45",
"chat:" : "rs 6/17/2020 21:45",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultWidth

^ 890
^ 810
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ addAtBottom: aCoreMessage
(self isFromCurrentChat: aCoreMessage)
ifFalse: [ ^ self ].
wasFullyScrolledDown := self isFullyScrolledDown.
wrapper := self wrapperFor: (TCUMessage newFrom: aCoreMessage).
wrapper := TCUMessageWrapper newFromMessage: (TCUMessage newFrom: aCoreMessage) withWidth: self scroller width.
self scroller addMorphBack: wrapper.
self items addLast: wrapper.
wasFullyScrolledDown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ addAtTop: aCoreMessage
| wrapper |
(self isFromCurrentChat: aCoreMessage) ifFalse: [^ self].

wrapper := self wrapperFor: (TCUMessage newFrom: aCoreMessage).
wrapper := TCUMessageWrapper newFromMessage: (TCUMessage newFrom: aCoreMessage) withWidth: self scroller width.
self scroller addMorphFront: wrapper.
self items addFirst: wrapper.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"class" : {
"defaultMessageMargin" : "per 6/20/2021 11:51",
"defaultMessageWrapper" : "JB 6/28/2021 09:58",
"defaultScrollOffsetBeforeLoading" : "JB 6/26/2021 10:15",
"defaultWidth" : "RS 7/17/2021 17:39" },
"defaultWidth" : "rgw 6/2/2022 15:39" },
"instance" : {
"addAtBottom:" : "JB 8/4/2021 11:15",
"addAtTop:" : "JB 8/4/2021 11:15",
"addAtBottom:" : "JS 6/11/2022 11:14",
"addAtTop:" : "JS 6/11/2022 11:15",
"addMessages" : "RS 7/17/2021 17:40",
"chat" : "js 7/31/2020 16:39",
"chat:" : "js 7/31/2020 16:39",
Expand All @@ -17,5 +15,4 @@
"isFullyScrolledDown" : "JB 8/4/2021 11:15",
"scrollToNewestMessage" : "per 6/24/2021 23:14",
"showMessages" : "RS 7/17/2021 17:34",
"step" : "JB 7/19/2021 12:12",
"wrapperFor:" : "RK 8/4/2021 10:57" } }
"step" : "JB 7/19/2021 12:12" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default values
defaultWidth

^ 300
^ 375
Loading