mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Rename dataSource2
parameters and handle target profiles
This commit is contained in:
parent
ca5d9fd202
commit
e20e4bc159
6 changed files with 29 additions and 23 deletions
|
@ -37,12 +37,12 @@
|
|||
|
||||
#pragma mark - MXKRoomBubbleCellDataStoring
|
||||
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource2
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
||||
{
|
||||
self = [self init];
|
||||
if (self)
|
||||
{
|
||||
roomDataSource = roomDataSource2;
|
||||
self->roomDataSource = roomDataSource;
|
||||
|
||||
// Initialize read receipts
|
||||
self.readReceipts = [NSMutableDictionary dictionary];
|
||||
|
@ -58,12 +58,12 @@
|
|||
targetId = [event.type isEqualToString:kMXEventTypeStringRoomMember] ? event.stateKey : nil;
|
||||
roomId = roomDataSource.roomId;
|
||||
|
||||
MXRoomState *profileRoomState = RiotSettings.shared.roomScreenUseOnlyLatestProfiles ? roomDataSource2.roomState : roomState;
|
||||
MXRoomState *profileRoomState = RiotSettings.shared.roomScreenUseOnlyLatestProfiles ? roomDataSource.roomState : roomState;
|
||||
senderDisplayName = [roomDataSource.eventFormatter senderDisplayNameForEvent:event withRoomState:profileRoomState];
|
||||
senderAvatarUrl = [roomDataSource.eventFormatter senderAvatarUrlForEvent:event withRoomState:profileRoomState];
|
||||
senderAvatarPlaceholder = nil;
|
||||
targetDisplayName = [roomDataSource.eventFormatter targetDisplayNameForEvent:event withRoomState:roomState];
|
||||
targetAvatarUrl = [roomDataSource.eventFormatter targetAvatarUrlForEvent:event withRoomState:roomState];
|
||||
targetDisplayName = [roomDataSource.eventFormatter targetDisplayNameForEvent:event withRoomState:profileRoomState];
|
||||
targetAvatarUrl = [roomDataSource.eventFormatter targetAvatarUrlForEvent:event withRoomState:profileRoomState];
|
||||
targetAvatarPlaceholder = nil;
|
||||
isEncryptedRoom = roomState.isEncrypted;
|
||||
isIncoming = ([event.sender isEqualToString:roomDataSource.mxSession.myUser.userId] == NO);
|
||||
|
@ -107,16 +107,24 @@
|
|||
bubbleComponents = nil;
|
||||
}
|
||||
|
||||
- (void)refreshProfileWithRoomDataSource:(MXKRoomDataSource *)roomDataSource2
|
||||
- (void)refreshProfile
|
||||
{
|
||||
if (self.events.firstObject)
|
||||
MXRoomState *roomState = roomDataSource.roomState;
|
||||
MXEvent* firstEvent = self.events.firstObject;
|
||||
|
||||
if (firstEvent == nil || roomState == nil)
|
||||
{
|
||||
MXEvent* firstEvent = self.events.firstObject;
|
||||
senderDisplayName = [roomDataSource.eventFormatter senderDisplayNameForEvent:firstEvent
|
||||
withRoomState:roomDataSource2.roomState];
|
||||
senderAvatarUrl = [roomDataSource.eventFormatter senderAvatarUrlForEvent:firstEvent
|
||||
withRoomState:roomDataSource2.roomState];
|
||||
return;
|
||||
}
|
||||
|
||||
senderDisplayName = [roomDataSource.eventFormatter senderDisplayNameForEvent:firstEvent
|
||||
withRoomState:roomState];
|
||||
senderAvatarUrl = [roomDataSource.eventFormatter senderAvatarUrlForEvent:firstEvent
|
||||
withRoomState:roomState];
|
||||
targetDisplayName = [roomDataSource.eventFormatter targetDisplayNameForEvent:firstEvent
|
||||
withRoomState:roomState];
|
||||
targetAvatarUrl = [roomDataSource.eventFormatter targetAvatarUrlForEvent:firstEvent
|
||||
withRoomState:roomState];
|
||||
}
|
||||
|
||||
- (NSUInteger)updateEvent:(NSString *)eventId withEvent:(MXEvent *)event
|
||||
|
|
|
@ -233,10 +233,8 @@
|
|||
|
||||
/**
|
||||
Refreshes the avatar and display name if needed. Should be used only if `roomScreenUseOnlyLatestProfiles` is enabled.
|
||||
|
||||
@param roomDataSource the `MXKRoomDataSource` object that will use this instance.
|
||||
*/
|
||||
- (void)refreshProfileWithRoomDataSource:(MXKRoomDataSource*)roomDataSource;
|
||||
- (void)refreshProfile;
|
||||
|
||||
/**
|
||||
Update the event because its sent state changed or it is has been redacted.
|
||||
|
|
|
@ -24,9 +24,9 @@ static NSAttributedString *messageSeparator = nil;
|
|||
|
||||
#pragma mark - MXKRoomBubbleCellDataStoring
|
||||
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource2
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
||||
{
|
||||
self = [super initWithEvent:event andRoomState:roomState andRoomDataSource:roomDataSource2];
|
||||
self = [super initWithEvent:event andRoomState:roomState andRoomDataSource:roomDataSource];
|
||||
if (self)
|
||||
{
|
||||
// Set default settings
|
||||
|
|
|
@ -4341,7 +4341,7 @@ typedef NS_ENUM (NSUInteger, MXKRoomDataSourceError) {
|
|||
@synchronized (bubbles) {
|
||||
for (id<MXKRoomBubbleCellDataStoring> bubble in bubbles)
|
||||
{
|
||||
[bubble refreshProfileWithRoomDataSource:self];
|
||||
[bubble refreshProfile];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,9 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
|||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource2
|
||||
- (instancetype)initWithEvent:(MXEvent *)event andRoomState:(MXRoomState *)roomState andRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
||||
{
|
||||
self = [super initWithEvent:event andRoomState:roomState andRoomDataSource:roomDataSource2];
|
||||
self = [super initWithEvent:event andRoomState:roomState andRoomDataSource:roomDataSource];
|
||||
|
||||
if (self)
|
||||
{
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
|
||||
@implementation RoomSearchDataSource
|
||||
|
||||
- (instancetype)initWithRoomDataSource:(MXKRoomDataSource *)roomDataSource2
|
||||
- (instancetype)initWithRoomDataSource:(MXKRoomDataSource *)roomDataSource
|
||||
{
|
||||
self = [super initWithMatrixSession:roomDataSource2.mxSession];
|
||||
self = [super initWithMatrixSession:roomDataSource.mxSession];
|
||||
if (self)
|
||||
{
|
||||
roomDataSource = roomDataSource2;
|
||||
self->roomDataSource = roomDataSource;
|
||||
|
||||
// The messages search is limited to the room data.
|
||||
self.roomEventFilter.rooms = @[roomDataSource.roomId];
|
||||
|
|
Loading…
Reference in a new issue