Fix all summaries usage, use summary session if needed in cell data

This commit is contained in:
ismailgulek
2021-12-28 23:18:41 +03:00
parent 017742c77e
commit c067a99f79
2 changed files with 14 additions and 4 deletions

View File

@@ -77,18 +77,21 @@
- (void)loadCellData
{
[self.fileStore.summariesModule fetchAllSummaries:^(NSArray<MXRoomSummary *> *roomsSummaries) {
[self.fileStore.summariesModule fetchAllSummaries:^(NSArray<id<MXRoomSummaryProtocol>> *roomsSummaries) {
NSMutableArray *cellData = [NSMutableArray array];
// Add a fake matrix session to each room summary to provide it a REST client (used to handle correctly the room avatar).
MXSession *session = [[MXSession alloc] initWithMatrixRestClient:[[MXRestClient alloc] initWithCredentials:self.credentials andOnUnrecognizedCertificateBlock:nil]];
for (MXRoomSummary *roomSummary in roomsSummaries)
for (id<MXRoomSummaryProtocol> roomSummary in roomsSummaries)
{
if (!roomSummary.hiddenFromUser && roomSummary.roomType == MXRoomTypeRoom)
{
[roomSummary setMatrixSession:session];
if ([roomSummary respondsToSelector:@selector(setMatrixSession:)])
{
[roomSummary setMatrixSession:session];
}
MXKRecentCellData *recentCellData = [[MXKRecentCellData alloc] initWithRoomSummary:roomSummary dataSource:nil];