Merge commit 'aaadcc73674cc8886e363693a7d7c08ac9b4f516' into feature/4260_merge_foss_1_10_2

# Conflicts:
#	Config/AppVersion.xcconfig
#	Podfile
#	Podfile.lock
#	Riot.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift
#	Riot/Modules/Application/LegacyAppDelegate.m
#	Riot/Modules/Authentication/AuthenticationCoordinator.swift
#	Riot/Modules/Authentication/Legacy/LegacyAuthenticationCoordinator.swift
#	Riot/Modules/ContextMenu/ActionProviders/RoomActionProvider.swift
#	Riot/Modules/Home/AllChats/AllChatsViewController.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift
#	Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift
#	Riot/Modules/Room/Settings/RoomSettingsViewController.m
#	fastlane/Fastfile
This commit is contained in:
JanNiklas Grabowski
2023-02-15 14:56:55 +01:00
279 changed files with 7285 additions and 2433 deletions
+84 -27
View File
@@ -26,7 +26,6 @@
#import "MXDecryptionResult.h"
#import "DecryptionFailureTracker.h"
#import "EventFormatter+DTCoreTextFix.h"
#import <MatrixSDK/MatrixSDK.h>
#pragma mark - Constants definitions
@@ -54,11 +53,6 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
@implementation EventFormatter
+ (void)load
{
[self fixDTCoreTextFont];
}
- (void)initDateTimeFormatters
{
[super initDateTimeFormatters];
@@ -367,7 +361,8 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
attributes:@{
NSLinkAttributeName: linkActionString,
NSForegroundColorAttributeName: self.sendingTextColor,
NSFontAttributeName: self.encryptedMessagesTextFont
NSFontAttributeName: self.encryptedMessagesTextFont,
NSUnderlineStyleAttributeName: [NSNumber numberWithInt:NSUnderlineStyleSingle]
}]];
[attributedStringWithRerequestMessage appendAttributedString:
@@ -392,8 +387,6 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@", [VectorL10n eventFormatterMessageEditedMention]]
attributes:@{
NSLinkAttributeName: linkActionString,
// NOTE: Color is curretly overidden by UIText.tintColor as we use `NSLinkAttributeName`.
// If we use UITextView.linkTextAttributes to set link color we will also have the issue that color will be the same for all kind of links.
NSForegroundColorAttributeName: self.editionMentionTextColor,
NSFontAttributeName: self.editionMentionTextFont
}]];
@@ -495,6 +488,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
self.bingTextColor = ThemeService.shared.theme.noticeColor;
self.encryptingTextColor = ThemeService.shared.theme.textPrimaryColor;
self.sendingTextColor = ThemeService.shared.theme.textPrimaryColor;
self.linksColor = ThemeService.shared.theme.colors.links;
self.errorTextColor = ThemeService.shared.theme.textPrimaryColor;
self.showEditionMention = YES;
self.editionMentionTextColor = ThemeService.shared.theme.textSecondaryColor;
@@ -556,8 +550,8 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
}
#pragma mark - MXRoomSummaryUpdating
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withLastEvent:(MXEvent *)event eventState:(MXRoomState *)eventState roomState:(MXRoomState *)roomState {
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withLastEvent:(MXEvent *)event eventState:(MXRoomState *)eventState roomState:(MXRoomState *)roomState
{
// Do not display voice broadcast chunk in last message.
if (event.eventType == MXEventTypeRoomMessage && event.content[VoiceBroadcastSettings.voiceBroadcastContentKeyChunkType])
{
@@ -565,31 +559,81 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
}
// Update last message if we have a voice broadcast in the room.
if ([event.type isEqualToString:VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType])
MXEvent *lastVoiceBroadcastInfoEvent = [self lastVoiceBroadcastInfoEventWithEvent:event roomState:roomState];
if (lastVoiceBroadcastInfoEvent != nil)
{
return [self session:session updateRoomSummary:summary withVoiceBroadcastInfoStateEvent:event roomState:roomState];
}
else
{
MXEvent *stateEvent = [roomState stateEventsWithType:VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType].lastObject;
if (stateEvent && ![VoiceBroadcastInfo isStoppedFor:[VoiceBroadcastInfo modelFromJSON: stateEvent.content].state])
MXEvent *voiceBroadcastInfoStartedEvent = [self voiceBroadcastInfoStartedEventWithEvent:lastVoiceBroadcastInfoEvent
roomId:summary.roomId
session:session];
if (voiceBroadcastInfoStartedEvent != nil
&& !(voiceBroadcastInfoStartedEvent.isRedactedEvent || [voiceBroadcastInfoStartedEvent.eventId isEqualToString:event.redacts]))
{
return [self session:session updateRoomSummary:summary withVoiceBroadcastInfoStateEvent:stateEvent roomState:roomState];
return [self session:session
updateRoomSummary:summary
withVoiceBroadcastInfoStateEvent:lastVoiceBroadcastInfoEvent
voiceBroadcastInfoStartedEvent:voiceBroadcastInfoStartedEvent
roomState:roomState];
}
}
BOOL updated = [super session:session updateRoomSummary:summary withLastEvent:event eventState:eventState roomState:roomState];
if (updated) {
if (updated)
{
// Force the default text color for the last message (cancel highlighted message color)
NSMutableAttributedString *lastEventDescription = [[NSMutableAttributedString alloc] initWithAttributedString:summary.lastMessage.attributedText];
[lastEventDescription addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.textSecondaryColor range:NSMakeRange(0, lastEventDescription.length)];
[lastEventDescription addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.textSecondaryColor
range:NSMakeRange(0, lastEventDescription.length)];
summary.lastMessage.attributedText = lastEventDescription;
}
return updated;
}
- (MXEvent *)lastVoiceBroadcastInfoEventWithEvent:(MXEvent *)event roomState:(MXRoomState *)roomState
{
MXEvent *voiceBroadcastInfoEvent = nil;
VoiceBroadcastInfo *info = nil;
if ([event.type isEqualToString:VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType])
{
info = [VoiceBroadcastInfo modelFromJSON: event.content];
if (info != nil)
{
voiceBroadcastInfoEvent = event;
}
}
else
{
MXEvent *stateEvent = [roomState stateEventsWithType:VoiceBroadcastSettings.voiceBroadcastInfoContentKeyType].lastObject;
if (stateEvent != nil)
{
info = [VoiceBroadcastInfo modelFromJSON: stateEvent.content];
if (info != nil && ![VoiceBroadcastInfo isStoppedFor:info.state])
{
voiceBroadcastInfoEvent = stateEvent;
}
}
}
return voiceBroadcastInfoEvent;
}
- (MXEvent *)voiceBroadcastInfoStartedEventWithEvent:(MXEvent *)voiceBroadcastInfoEvent roomId:(NSString *)roomId session:(MXSession *)session
{
VoiceBroadcastInfo *voiceBroadcastInfo = [VoiceBroadcastInfo modelFromJSON: voiceBroadcastInfoEvent.content];
if ([VoiceBroadcastInfo isStartedFor:voiceBroadcastInfo.state])
{
return voiceBroadcastInfoEvent;
}
else
{
// Search for the event only in the store to avoid network calls while updating the room summary (this a synchronous process and we cannot delay it).
return [mxSession.store eventWithEventId:voiceBroadcastInfo.voiceBroadcastId inRoom:roomId];
}
}
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withStateEvents:(NSArray<MXEvent *> *)stateEvents roomState:(MXRoomState *)roomState
{
BOOL updated = [super session:session updateRoomSummary:summary withStateEvents:stateEvents roomState:roomState];
@@ -613,18 +657,29 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
return updated;
}
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withVoiceBroadcastInfoStateEvent:(MXEvent *)stateEvent roomState:(MXRoomState *)roomState
- (BOOL)session:(MXSession *)session updateRoomSummary:(MXRoomSummary *)summary withVoiceBroadcastInfoStateEvent:(MXEvent *)stateEvent voiceBroadcastInfoStartedEvent:(MXEvent *)voiceBroadcastInfoStartedEvent roomState:(MXRoomState *)roomState
{
[summary updateLastMessage:[[MXRoomLastMessage alloc] initWithEvent:stateEvent]];
if (summary.lastMessage.others == nil)
BOOL isStoppedVoiceBroadcast = [VoiceBroadcastInfo isStoppedFor:[VoiceBroadcastInfo modelFromJSON: stateEvent.content].state];
if ([summary.lastMessage.eventId isEqualToString:voiceBroadcastInfoStartedEvent.eventId])
{
summary.lastMessage.others = [NSMutableDictionary dictionary];
if (!isStoppedVoiceBroadcast)
{
return NO;
}
}
else
{
[summary updateLastMessage:[[MXRoomLastMessage alloc] initWithEvent:voiceBroadcastInfoStartedEvent]];
if (summary.lastMessage.others == nil)
{
summary.lastMessage.others = [NSMutableDictionary dictionary];
}
}
summary.lastMessage.others[@"lastEventDate"] = [self dateStringFromEvent:stateEvent withTime:YES];
NSAttributedString *attachmentString = nil;
UIColor *textColor;
if ([VoiceBroadcastInfo isStoppedFor:[VoiceBroadcastInfo modelFromJSON: stateEvent.content].state])
if (isStoppedVoiceBroadcast)
{
textColor = ThemeService.shared.theme.textSecondaryColor;
NSString *senderDisplayName;
@@ -637,6 +692,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
senderDisplayName = [self senderDisplayNameForEvent:stateEvent withRoomState:roomState];
summary.lastMessage.text = [VectorL10n noticeVoiceBroadcastEnded:senderDisplayName];
}
summary.lastMessage.others[@"lastEventDate"] = [self dateStringFromEvent:stateEvent withTime:YES];
}
else
{
@@ -648,6 +704,7 @@ static NSString *const kEventFormatterTimeFormat = @"HH:mm";
attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
summary.lastMessage.text = VectorL10n.noticeVoiceBroadcastLive;
summary.lastMessage.others[@"lastEventDate"] = [self dateStringFromEvent:voiceBroadcastInfoStartedEvent withTime:YES];
}
// Compute the attribute text message