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:
Gil Eluard
2021-03-03 10:27:08 +01:00
parent 1862197c39
commit 8d4d7c821f
7 changed files with 32 additions and 130 deletions
+16 -3
View File
@@ -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)];