mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 06:06:57 +02:00
Retrying & deleting failed messages
- If users press on Retry, send again the message and display a loading wheel - code and UI tweaks
This commit is contained in:
@@ -39,7 +39,7 @@ import Foundation
|
||||
case .more:
|
||||
title = VectorL10n.roomEventActionMore
|
||||
case .resend:
|
||||
title = VectorL10n.roomEventActionResend
|
||||
title = VectorL10n.retry
|
||||
case .delete:
|
||||
title = VectorL10n.roomEventActionDelete
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
|
||||
@property (nonatomic, strong) CellDataComponentIndexPair *sentCell;
|
||||
|
||||
@property (nonatomic, strong) NSMutableSet *failedEventIds;
|
||||
|
||||
@property (nonatomic) RoomBubbleCellData *roomCreationCellData;
|
||||
|
||||
@property (nonatomic) BOOL showRoomCreationCell;
|
||||
@@ -1028,6 +1030,11 @@
|
||||
- (void)updateStatusInfo
|
||||
{
|
||||
self.sentCell = nil;
|
||||
|
||||
if (!self.failedEventIds)
|
||||
{
|
||||
self.failedEventIds = [NSMutableSet new];
|
||||
}
|
||||
|
||||
NSInteger bubbleIndex = bubbles.count;
|
||||
while (bubbleIndex--)
|
||||
@@ -1037,14 +1044,20 @@
|
||||
NSInteger componentIndex = cellData.bubbleComponents.count;
|
||||
while (componentIndex--) {
|
||||
MXKRoomBubbleComponent *component = cellData.bubbleComponents[componentIndex];
|
||||
MXEventSentState eventState = component.event.sentState;
|
||||
|
||||
if (eventState == MXEventSentStateFailed)
|
||||
{
|
||||
[self.failedEventIds addObject:component.event.eventId];
|
||||
continue;
|
||||
}
|
||||
|
||||
NSArray<MXReceiptData*> *receipts = cellData.readReceipts[component.event.eventId];
|
||||
if (receipts.count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MXEventSentState eventState = component.event.sentState;
|
||||
|
||||
if (self.sentCell == nil && eventState == MXEventSentStateSent)
|
||||
{
|
||||
self.sentCell = [CellDataComponentIndexPair pairWithCellData:cellData componentIndex:componentIndex];
|
||||
@@ -1092,7 +1105,7 @@
|
||||
|| component.event.sentState == MXEventSentStatePreparing
|
||||
|| component.event.sentState == MXEventSentStateSending)
|
||||
{
|
||||
if (cellData.attachment && component.event.sentState != MXEventSentStateSending)
|
||||
if ([self.failedEventIds containsObject:component.event.eventId] || ( cellData.attachment && component.event.sentState != MXEventSentStateSending))
|
||||
{
|
||||
UIView *progressContentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
|
||||
CircleProgressView *progressView = [[CircleProgressView alloc] initWithFrame:CGRectMake(24, 24, 16, 16)];
|
||||
|
||||
@@ -2433,7 +2433,7 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo
|
||||
// Add actions for a failed event
|
||||
if (selectedEvent.sentState == MXEventSentStateFailed)
|
||||
{
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_resend", @"Vector", nil)
|
||||
[currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"retry", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
[self.resendButton.layer setCornerRadius:5];
|
||||
self.resendButton.clipsToBounds = YES;
|
||||
[self.resendButton setTitle:NSLocalizedStringFromTable(@"room_event_action_resend", @"Vector", nil) forState:UIControlStateNormal];
|
||||
[self.resendButton setTitle:NSLocalizedStringFromTable(@"retry", @"Vector", nil) forState:UIControlStateNormal];
|
||||
self.resendButton.backgroundColor = ThemeService.shared.theme.tintColor;
|
||||
|
||||
UIImage *image = [[UIImage imageNamed:@"room_context_menu_delete"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
@@ -129,6 +129,7 @@
|
||||
self.deleteButton.tintColor = ThemeService.shared.theme.warningColor;
|
||||
|
||||
self.unsentMessageLabel.textColor = ThemeService.shared.theme.textPrimaryColor;
|
||||
self.unsentMessagesContentView.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
Reference in New Issue
Block a user