Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajouter une action "Marquer comme lu" sur un salon #1054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion Riot/Modules/Common/Recents/RecentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1304,14 +1304,33 @@ - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView tra
leaveImage = [leaveImage vc_tintedImageUsingColor:selectedColor];
leaveAction.image = [leaveImage vc_notRenderedImage];

//Tchap: mark room as read action
UIContextualAction *markAllAsReadAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
title:title
handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
[self markAllAsReadInEditedRoom];

self->editedRoomId = nil; // Tchap: Reset editedRoomId else UI content does not refresh anymore.

completionHandler(YES);
}];
markAllAsReadAction.backgroundColor = actionBackgroundColor;

UIImage *markAllAsReadImage = [UIImage systemImageNamed:@"envelope.open"];
markAllAsReadImage = [markAllAsReadImage vc_tintedImageUsingColor:selectedColor];
markAllAsReadAction.image = [markAllAsReadImage vc_notRenderedImage];



// Create swipe action configuration
// Tchap: Disable unavailable actions in Tchap
NSArray<UIContextualAction*> *actions = @[
leaveAction,
//priorityAction,
favouriteAction,
muteAction,
//directChatAction
//directChatAction,
markAllAsReadAction // Tchap: mark all as read local action
];

UISwipeActionsConfiguration *swipeActionConfiguration = [UISwipeActionsConfiguration configurationWithActions:actions];
Expand Down Expand Up @@ -1644,6 +1663,25 @@ - (void)muteEditedRoomNotifications:(BOOL)mute
}
}

// Tchap: mark room as read action
- (void)markAllAsReadInEditedRoom
{
if (editedRoomId)
{
// Check whether the user didn't leave the room
MXRoom *room = [self.mainSession roomWithRoomId:editedRoomId];
if (room)
{
[room markAllAsRead];
}
else
{
// Leave editing mode
[self cancelEditionMode:isRefreshPending];
}
}
}

#pragma mark - UITableView delegate

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1053.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ajouter une action "Marquer comme lu" sur un salon
Loading