Make remove actions destructive & move remove action to the bottom

This commit is contained in:
ismailgulek
2021-11-30 01:29:52 +03:00
parent 25f52e2473
commit 4164512542
3 changed files with 31 additions and 31 deletions
+29 -29
View File
@@ -3240,7 +3240,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}]];
[actionsMenu addAction:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionDelete]
style:UIAlertActionStyleDefault
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
@@ -3506,34 +3506,6 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
}
}
// Do not allow to redact the event that enabled encryption (m.room.encryption)
// because it breaks everything
if (selectedEvent.eventType != MXEventTypeRoomEncryption)
{
[actionsMenu addAction:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionRedact]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
[self cancelEventSelection];
[self startActivityIndicator];
MXWeakify(self);
[self.roomDataSource.room redactEvent:selectedEvent.eventId reason:nil success:^{
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
MXLogDebug(@"[RoomVC] Redact event (%@) failed", selectedEvent.eventId);
//Alert user
[self showError:error];
}];
}]];
}
if (BuildSettings.messageDetailsAllowPermalink)
{
[actionsMenu addAction:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionPermalink]
@@ -3707,6 +3679,34 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
[self showEncryptionInformation:selectedEvent];
}]];
}
// Do not allow to redact the event that enabled encryption (m.room.encryption)
// because it breaks everything
if (selectedEvent.eventType != MXEventTypeRoomEncryption)
{
[actionsMenu addAction:[UIAlertAction actionWithTitle:[VectorL10n roomEventActionRedact]
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
MXStrongifyAndReturnIfNil(self);
[self cancelEventSelection];
[self startActivityIndicator];
MXWeakify(self);
[self.roomDataSource.room redactEvent:selectedEvent.eventId reason:nil success:^{
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
[self stopActivityIndicator];
MXLogDebug(@"[RoomVC] Redact event (%@) failed", selectedEvent.eventId);
//Alert user
[self showError:error];
}];
}]];
}
}
[actionsMenu addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]