Merge remote-tracking branch 'origin/develop' into jitsi_widget

# Conflicts:
#	Riot.xcodeproj/project.pbxproj
This commit is contained in:
manuroe
2017-08-16 17:14:20 +02:00
140 changed files with 2582 additions and 536 deletions
+43 -8
View File
@@ -26,6 +26,14 @@
#import "MXRoom+Riot.h"
@interface RoomDataSource()
{
// Observe kRiotDesignValuesDidChangeThemeNotification to handle user interface theme change.
id kRiotDesignValuesDidChangeThemeNotificationObserver;
}
@end
@implementation RoomDataSource
- (instancetype)initWithRoomId:(NSString *)roomId andMatrixSession:(MXSession *)matrixSession
@@ -36,14 +44,8 @@
// Replace default Cell data class
[self registerCellDataClass:RoomBubbleCellData.class forCellIdentifier:kMXKRoomBubbleCellDataIdentifier];
// Replace event formatter
self.eventFormatter = [[EventFormatter alloc] initWithMatrixSession:self.mxSession];
self.eventFormatter.treatMatrixUserIdAsLink = YES;
self.eventFormatter.treatMatrixRoomIdAsLink = YES;
self.eventFormatter.treatMatrixRoomAliasAsLink = YES;
// Apply the event types filter to display only the wanted event types.
self.eventFormatter.eventTypesFilterForMessages = [MXKAppSettings standardAppSettings].eventsFilterForMessages;
// Replace the event formatter
[self updateEventFormatter];
// Handle timestamp and read receips display at Vector app level (see [tableView: cellForRowAtIndexPath:])
self.useCustomDateTimeLabel = YES;
@@ -54,10 +56,43 @@
self.bubblesPagination = MXKRoomDataSourceBubblesPaginationPerDay;
self.markTimelineInitialEvent = NO;
// Observe user interface theme change.
kRiotDesignValuesDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kRiotDesignValuesDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
// Force room data reload.
[self updateEventFormatter];
[self reload];
}];
}
return self;
}
- (void)updateEventFormatter
{
// Set a new event formatter
// TODO: We should use the same EventFormatter instance for all the rooms of a mxSession.
self.eventFormatter = [[EventFormatter alloc] initWithMatrixSession:self.mxSession];
self.eventFormatter.treatMatrixUserIdAsLink = YES;
self.eventFormatter.treatMatrixRoomIdAsLink = YES;
self.eventFormatter.treatMatrixRoomAliasAsLink = YES;
// Apply the event types filter to display only the wanted event types.
self.eventFormatter.eventTypesFilterForMessages = [MXKAppSettings standardAppSettings].eventsFilterForMessages;
}
- (void)destroy
{
if (kRiotDesignValuesDidChangeThemeNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kRiotDesignValuesDidChangeThemeNotificationObserver];
kRiotDesignValuesDidChangeThemeNotificationObserver = nil;
}
[super destroy];
}
- (void)didReceiveReceiptEvent:(MXEvent *)receiptEvent roomState:(MXRoomState *)roomState
{
// Override this callback to force rendering of each cell with read receipts information.