mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Remove flairs and related groups.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#import "GeneratedInterface-Swift.h"
|
||||
|
||||
@implementation MXKRoomBubbleCellData
|
||||
@synthesize senderId, targetId, roomId, senderDisplayName, senderAvatarUrl, senderAvatarPlaceholder, targetDisplayName, targetAvatarUrl, targetAvatarPlaceholder, isEncryptedRoom, isPaginationFirstBubble, shouldHideSenderInformation, date, isIncoming, isAttachmentWithThumbnail, isAttachmentWithIcon, attachment, senderFlair;
|
||||
@synthesize senderId, targetId, roomId, senderDisplayName, senderAvatarUrl, senderAvatarPlaceholder, targetDisplayName, targetAvatarUrl, targetAvatarPlaceholder, isEncryptedRoom, isPaginationFirstBubble, shouldHideSenderInformation, date, isIncoming, isAttachmentWithThumbnail, isAttachmentWithIcon, attachment;
|
||||
@synthesize textMessage, attributedTextMessage, attributedTextMessageWithoutPositioningSpace;
|
||||
@synthesize shouldHideSenderName, isTyping, showBubbleDateTime, showBubbleReceipts, useCustomDateTimeLabel, useCustomReceipts, useCustomUnsentButton, hasNoDisplay;
|
||||
@synthesize tag;
|
||||
@@ -122,9 +122,6 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// Reset any observer on publicised groups by user.
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession];
|
||||
|
||||
roomDataSource = nil;
|
||||
bubbleComponents = nil;
|
||||
}
|
||||
@@ -450,58 +447,6 @@
|
||||
- (void)setShouldHideSenderInformation:(BOOL)inShouldHideSenderInformation
|
||||
{
|
||||
shouldHideSenderInformation = inShouldHideSenderInformation;
|
||||
|
||||
if (!shouldHideSenderInformation)
|
||||
{
|
||||
// Refresh the flair
|
||||
[self refreshSenderFlair];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refreshSenderFlair
|
||||
{
|
||||
// Reset by default any observer on publicised groups by user.
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession];
|
||||
|
||||
// Check first whether the room enabled the flair for some groups
|
||||
NSArray<NSString *> *roomRelatedGroups = roomDataSource.roomState.relatedGroups;
|
||||
if (roomRelatedGroups.count && senderId)
|
||||
{
|
||||
NSArray<NSString *> *senderPublicisedGroups;
|
||||
|
||||
senderPublicisedGroups = [self.mxSession publicisedGroupsForUser:senderId];
|
||||
|
||||
if (senderPublicisedGroups.count)
|
||||
{
|
||||
// Cross the 2 arrays to keep only the common group ids
|
||||
NSMutableArray *flair = [NSMutableArray arrayWithCapacity:roomRelatedGroups.count];
|
||||
|
||||
for (NSString *groupId in roomRelatedGroups)
|
||||
{
|
||||
if ([senderPublicisedGroups indexOfObject:groupId] != NSNotFound)
|
||||
{
|
||||
MXGroup *group = [roomDataSource groupWithGroupId:groupId];
|
||||
[flair addObject:group];
|
||||
}
|
||||
}
|
||||
|
||||
if (flair.count)
|
||||
{
|
||||
self.senderFlair = flair;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.senderFlair = nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self.senderFlair = nil;
|
||||
}
|
||||
|
||||
// Observe any change on publicised groups for the message sender
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionUpdatePublicisedGroupsForUsers:) name:kMXSessionDidUpdatePublicisedGroupsForUsersNotification object:self.mxSession];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)hasThreadRoot
|
||||
@@ -1042,18 +987,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didMXSessionUpdatePublicisedGroupsForUsers:(NSNotification *)notif
|
||||
{
|
||||
// Retrieved the list of the concerned users
|
||||
NSArray<NSString*> *userIds = notif.userInfo[kMXSessionNotificationUserIdsArrayKey];
|
||||
if (userIds.count && self.senderId)
|
||||
{
|
||||
// Check whether the current sender is concerned.
|
||||
if ([userIds indexOfObject:self.senderId] != NSNotFound)
|
||||
{
|
||||
[self refreshSenderFlair];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user