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:
Frank Rotermund
2022-10-05 15:47:27 +02:00
744 changed files with 6999 additions and 3819 deletions
@@ -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
@@ -1846,7 +1846,17 @@ static NSString *const kHTMLATagRegexPattern = @"<a href=(?:'|\")(.*?)(?:'|\")>(
}
else
{
MXJSONModelSetString(repliedEventContent, repliedEvent.content[@"formatted_body"]);
MXReplyEventParser *parser = [[MXReplyEventParser alloc] init];
MXReplyEventParts *parts = [parser parse:repliedEvent];
MXJSONModelSetString(repliedEventContent, parts.formattedBodyParts.replyText)
if (!repliedEventContent)
{
MXJSONModelSetString(repliedEventContent, parts.bodyParts.replyText)
}
if (!repliedEventContent)
{
MXJSONModelSetString(repliedEventContent, repliedEvent.content[@"formatted_body"]);
}
if (!repliedEventContent)
{
MXJSONModelSetString(repliedEventContent, repliedEvent.content[kMXMessageBodyKey]);
@@ -166,10 +166,11 @@ private extension CMarkNode {
private extension String {
/// Returns array of URLs detected inside the String.
var containedUrls: [NSTextCheckingResult] {
guard let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) else {
guard let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue),
let percentEncoded = self.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else {
return []
}
return detector.matches(in: self, options: [], range: NSRange(location: 0, length: self.utf16.count))
return detector.matches(in: percentEncoded, options: [], range: NSRange(location: 0, length: percentEncoded.utf16.count))
}
}
@@ -192,7 +192,7 @@ static NSAttributedString *verticalWhitespace = nil;
NSString *claimedKey = _mxEvent.keysClaimed[@"ed25519"];
NSString *algorithm = _mxEvent.wireContent[@"algorithm"];
NSString *sessionId = _mxEvent.wireContent[@"session_id"];
NSString *untrusted = _mxEvent.isUntrusted ? [VectorL10n userVerificationSessionsListSessionUntrusted] : [VectorL10n userVerificationSessionsListSessionTrusted];
NSString *untrusted = _mxEvent.isUntrusted ? [VectorL10n roomEventEncryptionInfoKeyAuthenticityNotGuaranteed] : [VectorL10n userVerificationSessionsListSessionTrusted];
NSString *decryptionError;
if (_mxEvent.decryptionError)