mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Adapt sentStatus changes
This commit is contained in:
parent
1241ca8a88
commit
c71386a2ba
5 changed files with 12 additions and 46 deletions
|
@ -19,13 +19,6 @@
|
|||
|
||||
#import "UserEncryptionTrustLevel.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RoomSentStatus)
|
||||
{
|
||||
RoomSentStatusOk,
|
||||
RoomSentStatusSentFailed,
|
||||
RoomSentStatusSentFailedDueToUnknownDevices
|
||||
};
|
||||
|
||||
/**
|
||||
Define a `MXRoom` category at Riot level.
|
||||
*/
|
||||
|
@ -51,9 +44,6 @@ typedef NS_ENUM(NSUInteger, RoomSentStatus)
|
|||
*/
|
||||
@property (nonatomic) id notificationCenterDidUpdateObserver;
|
||||
|
||||
/// Check if all messages have been sent.
|
||||
@property (nonatomic, readonly) RoomSentStatus sentStatus;
|
||||
|
||||
/**
|
||||
Update the room tag.
|
||||
|
||||
|
|
|
@ -656,30 +656,4 @@
|
|||
return objc_getAssociatedObject(self, @selector(notificationCenterDidUpdateObserver));
|
||||
}
|
||||
|
||||
#pragma mark - Unread messages
|
||||
|
||||
- (RoomSentStatus)sentStatus
|
||||
{
|
||||
RoomSentStatus status = RoomSentStatusOk;
|
||||
NSArray<MXEvent*> *outgoingMsgs = self.outgoingMessages;
|
||||
|
||||
for (MXEvent *event in outgoingMsgs)
|
||||
{
|
||||
if (event.sentState == MXEventSentStateFailed)
|
||||
{
|
||||
status = RoomSentStatusSentFailed;
|
||||
|
||||
// Check if the error is due to unknown devices
|
||||
if ([event.sentError.domain isEqualToString:MXEncryptingErrorDomain]
|
||||
&& event.sentError.code == MXEncryptingErrorUnknownDeviceCode)
|
||||
{
|
||||
status = RoomSentStatusSentFailedDueToUnknownDevices;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -88,7 +88,8 @@
|
|||
self.lastEventDescription.text = roomCellData.lastEventTextMessage;
|
||||
}
|
||||
|
||||
self.unsentImageView.hidden = roomCellData.roomSummary.room.sentStatus == RoomSentStatusOk;
|
||||
MXRoom *room = [roomCellData.mxSession roomWithRoomId:roomCellData.roomSummary.roomId];
|
||||
self.unsentImageView.hidden = roomCellData.roomSummary.sentStatus == MXRoomSummarySentStatusOk;
|
||||
self.lastEventDecriptionLabelTrailingConstraint.constant = self.unsentImageView.hidden ? 10 : 30;
|
||||
|
||||
// Notify unreads and bing
|
||||
|
@ -124,7 +125,7 @@
|
|||
self.roomTitle.font = [UIFont systemFontOfSize:17 weight:UIFontWeightMedium];
|
||||
}
|
||||
|
||||
[roomCellData.roomSummary setRoomAvatarImageIn:self.roomAvatar];
|
||||
[room.summary setRoomAvatarImageIn:self.roomAvatar];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -101,8 +101,8 @@
|
|||
}
|
||||
|
||||
// Notify unreads and bing
|
||||
if (roomCellData.roomSummary.room.summary.membership == MXMembershipInvite
|
||||
|| roomCellData.roomSummary.room.sentStatus != RoomSentStatusOk)
|
||||
if (roomCellData.roomSummary.membership == MXMembershipInvite
|
||||
|| roomCellData.roomSummary.sentStatus != MXRoomSummarySentStatusOk)
|
||||
{
|
||||
self.badgeLabel.hidden = NO;
|
||||
self.badgeLabel.badgeColor = ThemeService.shared.theme.noticeColor;
|
||||
|
@ -130,7 +130,8 @@
|
|||
|
||||
}
|
||||
|
||||
[roomCellData.roomSummary setRoomAvatarImageIn:self.roomAvatar];
|
||||
MXRoom *room = [roomCellData.mxSession roomWithRoomId:roomCellData.roomSummary.roomId];
|
||||
[room.summary setRoomAvatarImageIn:self.roomAvatar];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4993,14 +4993,14 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
|||
|
||||
-(BOOL)checkUnsentMessages
|
||||
{
|
||||
RoomSentStatus sentStatus = RoomSentStatusOk;
|
||||
MXRoomSummarySentStatus sentStatus = MXRoomSummarySentStatusOk;
|
||||
if ([self.activitiesView isKindOfClass:RoomActivitiesView.class])
|
||||
{
|
||||
sentStatus = self.roomDataSource.room.sentStatus;
|
||||
sentStatus = self.roomDataSource.room.summary.sentStatus;
|
||||
|
||||
if (sentStatus != RoomSentStatusOk)
|
||||
if (sentStatus != MXRoomSummarySentStatusOk)
|
||||
{
|
||||
NSString *notification = sentStatus == RoomSentStatusSentFailedDueToUnknownDevices ?
|
||||
NSString *notification = sentStatus == MXRoomSummarySentStatusSentFailedDueToUnknownDevices ?
|
||||
NSLocalizedStringFromTable(@"room_unsent_messages_unknown_devices_notification", @"Vector", nil) :
|
||||
NSLocalizedStringFromTable(@"room_unsent_messages_notification", @"Vector", nil);
|
||||
|
||||
|
@ -5071,7 +5071,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
|
|||
}
|
||||
}
|
||||
|
||||
return sentStatus != RoomSentStatusOk;
|
||||
return sentStatus != MXRoomSummarySentStatusOk;
|
||||
}
|
||||
|
||||
- (void)eventDidChangeSentState:(NSNotification *)notif
|
||||
|
|
Loading…
Reference in a new issue