Adapt to cell data changes

This commit is contained in:
ismailgulek
2021-09-22 11:46:12 +03:00
parent 0903e38e44
commit b9b7b4e1da
6 changed files with 13 additions and 17 deletions
@@ -44,8 +44,9 @@
- (NSUInteger)notificationCount
{
MXRoom *room = [self.mxSession roomWithRoomId:self.roomSummary.roomId];
// Ignore the regular notification count if the room is in 'mentions only" mode at the Riot level.
if (self.roomSummary.room.isMentionsOnly)
if (room.isMentionsOnly)
{
// Only the highlighted missed messages must be considered here.
return self.roomSummary.highlightCount;
@@ -894,7 +894,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
{
id<MXKRecentCellDataStoring> cellDataStoring = (id<MXKRecentCellDataStoring> )cellData;
if (cellDataStoring.roomSummary.room.summary.membership != MXMembershipInvite)
if (cellDataStoring.roomSummary.membership != MXMembershipInvite)
{
return RecentTableViewCell.class;
}
@@ -1444,9 +1444,8 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
id<MXKRecentCellDataStoring> cellData = [self.dataSource cellDataAtIndexPath:indexPath];
// Retrieve the invited room
MXRoom* invitedRoom = cellData.roomSummary.room;
if (invitedRoom.summary.roomType == MXRoomTypeSpace)
if (cellData.roomSummary.roomType == MXRoomTypeSpace)
{
// Indicates that spaces are not supported
[self showSpaceInviteNotAvailable];
@@ -1455,7 +1454,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro
else if ([self canShowRoomPreviewFor:cellData.roomSummary])
{
// Display the room preview
[self dispayRoomWithRoomId:invitedRoom.roomId inMatrixSession:invitedRoom.mxSession];
[self dispayRoomWithRoomId:cellData.roomSummary.roomId inMatrixSession:cellData.mxSession];
}
else
{
+1 -1
View File
@@ -562,7 +562,7 @@
id<MXKRecentCellDataStoring> renderedCellData = (id<MXKRecentCellDataStoring>)roomCollectionViewCell.renderedCellData;
[self.delegate recentListViewController:self didSelectRoom:renderedCellData.roomSummary.roomId inMatrixSession:renderedCellData.roomSummary.room.mxSession];
[self.delegate recentListViewController:self didSelectRoom:renderedCellData.roomSummary.roomId inMatrixSession:renderedCellData.mxSession];
}
// Hide the keyboard when user select a room
@@ -26,8 +26,8 @@ extension InviteRecentTableViewCell {
}
/// Update buttons according to current MXMembershipChangeState of the room
@objc func updateButtonViews(with room: MXRoom) {
let membershipTransitionState = room.summary.membershipTransitionState
@objc func updateButtonViews(with summary: MXRoomSummaryProtocol) {
let membershipTransitionState = summary.membershipTransitionState
var joinButtonIsLoading = false
var leaveButtonIsLoading = false
@@ -87,7 +87,7 @@ NSString *const kInviteRecentTableViewCellRoomKey = @"kInviteRecentTableViewCell
{
if (self.delegate)
{
MXRoom *room = roomCellData.roomSummary.room;
MXRoom *room = [roomCellData.mxSession roomWithRoomId:roomCellData.roomSummary.roomId];
if (room)
{
@@ -99,16 +99,11 @@ NSString *const kInviteRecentTableViewCellRoomKey = @"kInviteRecentTableViewCell
- (void)render:(MXKCellData *)cellData
{
[super render:cellData];
MXRoom *room = roomCellData.roomSummary.room;
if (room.roomId)
{
[self updateViewsWithRoom:room showPreviewButton:NO];
}
[self updateViewsWithRoom:roomCellData.roomSummary showPreviewButton:NO];
}
- (void)updateViewsWithRoom:(MXRoom*)room showPreviewButton:(BOOL)showPreviewButton
- (void)updateViewsWithRoom:(id<MXRoomSummaryProtocol>)room showPreviewButton:(BOOL)showPreviewButton
{
NSString *rightButtonTitle;