mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 09:02:44 +02:00
Invites are collapsed incorrectly (#6300)
* Invites are collapsed incorrectly - use invitee avatar instead of the target avatar for collapsed membership cell
This commit is contained in:
@@ -68,20 +68,45 @@
|
||||
MXKImageView *avatarView = [[MXKImageView alloc] initWithFrame:CGRectMake(12 * self.avatarsView.subviews.count, 0, 16, 16)];
|
||||
|
||||
// Handle user's picture by considering it is stored unencrypted on Matrix media repository
|
||||
|
||||
// Use the Riot style placeholder
|
||||
if (!nextBubbleData.targetAvatarPlaceholder)
|
||||
{
|
||||
nextBubbleData.targetAvatarPlaceholder = [AvatarGenerator generateAvatarForMatrixItem:nextBubbleData.targetId withDisplayName:nextBubbleData.targetDisplayName];
|
||||
}
|
||||
|
||||
avatarView.enableInMemoryCache = YES;
|
||||
[avatarView setImageURI:nextBubbleData.targetAvatarUrl
|
||||
|
||||
UIImage *avatarPlaceholder;
|
||||
NSString *avatarUrl;
|
||||
|
||||
MXEvent *firstEvent = nextBubbleData.events.firstObject;
|
||||
MXRoomMemberEventContent *content = [MXRoomMemberEventContent modelFromJSON:firstEvent.content];
|
||||
|
||||
// We want to display the avatar of the invitee.
|
||||
// In case of a join event, the invitee is the sender. Otherwise, the invitee is the target.
|
||||
if (![content.membership isEqualToString:kMXMembershipStringJoin])
|
||||
{
|
||||
// Use the Riot style placeholder
|
||||
if (!nextBubbleData.targetAvatarPlaceholder)
|
||||
{
|
||||
nextBubbleData.targetAvatarPlaceholder = [AvatarGenerator generateAvatarForMatrixItem:nextBubbleData.targetId withDisplayName:nextBubbleData.targetDisplayName];
|
||||
}
|
||||
|
||||
avatarPlaceholder = nextBubbleData.targetAvatarPlaceholder;
|
||||
avatarUrl = nextBubbleData.targetAvatarUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the Riot style placeholder
|
||||
if (!nextBubbleData.senderAvatarPlaceholder)
|
||||
{
|
||||
nextBubbleData.senderAvatarPlaceholder = [AvatarGenerator generateAvatarForMatrixItem:nextBubbleData.senderId withDisplayName:nextBubbleData.senderDisplayName];
|
||||
}
|
||||
|
||||
avatarPlaceholder = nextBubbleData.senderAvatarPlaceholder;
|
||||
avatarUrl = nextBubbleData.senderAvatarUrl;
|
||||
}
|
||||
|
||||
[avatarView setImageURI:avatarUrl
|
||||
withType:nil
|
||||
andImageOrientation:UIImageOrientationUp
|
||||
toFitViewSize:avatarView.frame.size
|
||||
withMethod:MXThumbnailingMethodCrop
|
||||
previewImage:nextBubbleData.targetAvatarPlaceholder
|
||||
previewImage:avatarPlaceholder
|
||||
mediaManager:nextBubbleData.mxSession.mediaManager];
|
||||
|
||||
// Clear the default background color of a MXKImageView instance
|
||||
|
||||
Reference in New Issue
Block a user