mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
MESSENGER-3671 Merge FOSS 1.9.8
Conflicts: - CommonConfiguration.swift - BuildSettings.swift - Generated/images.Swift - RoomMemberDetailsViewController.m - LiveLocationSharingViewModell - PinCodeEnterViewController.m
This commit is contained in:
@@ -920,7 +920,7 @@
|
||||
{
|
||||
for (MXKRoomBubbleComponent *component in bubbleComponents)
|
||||
{
|
||||
if (component.showEncryptionBadge)
|
||||
if (component.encryptionDecoration != EventEncryptionDecorationNone)
|
||||
{
|
||||
containsBubbleComponentWithEncryptionBadge = YES;
|
||||
break;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#import "MXKEventFormatter.h"
|
||||
#import "MXKURLPreviewDataProtocol.h"
|
||||
#import "EventEncryptionDecoration.h"
|
||||
|
||||
@protocol MXThreadProtocol;
|
||||
|
||||
@@ -101,9 +102,9 @@ typedef enum : NSUInteger {
|
||||
@property (nonatomic) MXEventScan *eventScan;
|
||||
|
||||
/**
|
||||
Indicate if an encryption badge should be shown.
|
||||
Type of encryption decoration (if any) for this event
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL showEncryptionBadge;
|
||||
@property (nonatomic, readonly) EventEncryptionDecoration encryptionDecoration;
|
||||
|
||||
/**
|
||||
Thread for the bubble component. Should only exist for thread root events.
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
_showEncryptionBadge = [self shouldShowWarningBadgeForEvent:event roomState:(MXRoomState*)roomState session:session];
|
||||
_encryptionDecoration = [self encryptionDecorationForEvent:event roomState:(MXRoomState*)roomState session:session];
|
||||
|
||||
[self updateLinkWithRoomState:roomState];
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
andLatestRoomState:latestRoomState
|
||||
error:&error];
|
||||
|
||||
_showEncryptionBadge = [self shouldShowWarningBadgeForEvent:event roomState:roomState session:session];
|
||||
_encryptionDecoration = [self encryptionDecorationForEvent:event roomState:roomState session:session];
|
||||
|
||||
[self updateLinkWithRoomState:roomState];
|
||||
}
|
||||
@@ -167,24 +167,24 @@
|
||||
self.link = url;
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowWarningBadgeForEvent:(MXEvent*)event roomState:(MXRoomState*)roomState session:(MXSession*)session
|
||||
- (EventEncryptionDecoration)encryptionDecorationForEvent:(MXEvent*)event roomState:(MXRoomState*)roomState session:(MXSession*)session
|
||||
{
|
||||
// Warning badges are unnecessary in unencrypted rooms
|
||||
if (!roomState.isEncrypted)
|
||||
{
|
||||
return NO;
|
||||
return EventEncryptionDecorationNone;
|
||||
}
|
||||
|
||||
// Not all events are encrypted (e.g. state/reactions/redactions) and we only have encrypted cell subclasses for messages and attachments.
|
||||
if (event.eventType != MXEventTypeRoomMessage && !event.isMediaAttachment)
|
||||
{
|
||||
return NO;
|
||||
return EventEncryptionDecorationNone;
|
||||
}
|
||||
|
||||
// Always show a warning badge if there was a decryption error.
|
||||
if (event.decryptionError)
|
||||
{
|
||||
return YES;
|
||||
return EventEncryptionDecorationDecryptionError;
|
||||
}
|
||||
|
||||
// Unencrypted message events should show a warning unless they're pending local echoes
|
||||
@@ -193,10 +193,10 @@
|
||||
if (event.isLocalEvent
|
||||
|| event.contentHasBeenEdited) // Local echo for an edit is clear but uses a true event id, the one of the edited event
|
||||
{
|
||||
return NO;
|
||||
return EventEncryptionDecorationNone;
|
||||
}
|
||||
|
||||
return YES;
|
||||
return EventEncryptionDecorationNotEncrypted;
|
||||
}
|
||||
|
||||
// The encryption is in a good state.
|
||||
@@ -208,12 +208,17 @@
|
||||
|
||||
if (userTrustLevel.isVerified && !deviceInfo.trustLevel.isVerified)
|
||||
{
|
||||
return YES;
|
||||
return EventEncryptionDecorationUntrustedDevice;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.isUntrusted)
|
||||
{
|
||||
return EventEncryptionDecorationUnsafeKey;
|
||||
}
|
||||
|
||||
// Everything was fine
|
||||
return NO;
|
||||
return EventEncryptionDecorationNone;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user