Merge commit 'ace42be63764c1f1aec82d6e3448ca8980adc784' into feature/3746_merge_element_1.9.10

# Conflicts:
#	Config/AppConfiguration.swift
#	Config/AppVersion.xcconfig
#	Podfile.lock
#	Riot/Modules/Application/AppCoordinator.swift
#	Riot/Modules/Common/Avatar/AvatarView.swift
#	Riot/Modules/Room/TimelineCells/Styles/Bubble/BubbleRoomTimelineCellProvider.m
#	Riot/Modules/Room/TimelineCells/Styles/Plain/PlainRoomTimelineCellProvider.m
#	Riot/Modules/Settings/Security/SecurityViewController.m
#	Riot/Modules/Settings/SettingsViewController.m
#	Riot/Modules/TabBar/TabBarCoordinator.swift
#	Riot/target.yml
#	fastlane/Fastfile
#	project.yml
This commit is contained in:
Frank Rotermund
2022-11-02 14:05:36 +01:00
467 changed files with 18708 additions and 2131 deletions
@@ -106,8 +106,6 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
}
}
NotificationCenter.default.addObserver(self, selector: #selector(self.newAppLayoutToggleDidChange(notification:)), name: RiotSettings.newAppLayoutBetaToggleDidChange, object: nil)
// NOTE: When split view is shown there can be no Matrix sessions ready. Keep this behavior or use a loading screen before showing the split view.
self.showSplitView()
MXLog.debug("[AppCoordinator] Showed split view")
@@ -163,12 +161,6 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
ThemePublisher.shared.republish(themeIdPublisher: themeIdPublisher)
}
@objc private func newAppLayoutToggleDidChange(notification: Notification) {
if BWIBuildSettings.shared.enableSideMenu {
self.addSideMenu()
}
}
private func excludeAllItemsFromBackup() {
let manager = FileManager.default
+3 -1
View File
@@ -196,7 +196,9 @@ UINavigationControllerDelegate
- (BOOL)presentIncomingKeyVerificationRequest:(id<MXKeyVerificationRequest>)incomingKeyVerificationRequest
inSession:(MXSession*)session;
- (BOOL)presentUserVerificationForRoomMember:(MXRoomMember*)roomMember session:(MXSession*)mxSession;
- (BOOL)presentUserVerificationForRoomMember:(MXRoomMember*)roomMember
session:(MXSession*)mxSession
completion:(void (^)(void))completion;
- (BOOL)presentCompleteSecurityForSession:(MXSession*)mxSession;
+62 -34
View File
@@ -129,6 +129,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
If any the currently displayed key verification dialog
*/
KeyVerificationCoordinatorBridgePresenter *keyVerificationCoordinatorBridgePresenter;
/**
Completion block for the requester of key verification
*/
void (^keyVerificationCompletionBlock)(void);
/**
Currently displayed secure backup setup
@@ -614,6 +619,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Analytics: Force to send the pending actions
[[DecryptionFailureTracker sharedInstance] dispatch];
[Analytics.shared forceUpload];
// Pause Voice Broadcast recording if needed
[VoiceBroadcastRecorderProvider.shared pauseRecording];
}
- (void)applicationWillEnterForeground:(UIApplication *)application
@@ -2401,9 +2409,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Stay in launching during the first server sync if the store is empty.
isLaunching = (mainSession.rooms.count == 0 && launchAnimationContainerView);
if (mainSession.crypto.crossSigning && mainSession.crypto.crossSigning.state == MXCrossSigningStateCrossSigningExists)
if (mainSession.crypto.crossSigning && mainSession.crypto.crossSigning.state == MXCrossSigningStateCrossSigningExists && [mainSession.crypto isKindOfClass:[MXLegacyCrypto class]])
{
[mainSession.crypto setOutgoingKeyRequestsEnabled:NO onComplete:nil];
[(MXLegacyCrypto *)mainSession.crypto setOutgoingKeyRequestsEnabled:NO onComplete:nil];
}
break;
case MXSessionStateRunning:
@@ -2617,6 +2625,12 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
- (void)checkLocalPrivateKeysInSession:(MXSession*)mxSession
{
if (![mxSession.crypto isKindOfClass:[MXLegacyCrypto class]])
{
return;
}
MXLegacyCrypto *crypto = (MXLegacyCrypto *)mxSession.crypto;
MXRecoveryService *recoveryService = mxSession.crypto.recoveryService;
NSUInteger keysCount = 0;
if ([recoveryService hasSecretWithSecretId:MXSecretId.keyBackup])
@@ -2637,7 +2651,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
{
// We should have 3 of them. If not, request them again as mitigation
MXLogDebug(@"[AppDelegate] checkLocalPrivateKeysInSession: request keys because keysCount = %@", @(keysCount));
[mxSession.crypto requestAllPrivateKeys];
[crypto requestAllPrivateKeys];
}
}
@@ -3596,17 +3610,24 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
MXLogDebug(@"[AppDelegate] checkPendingRoomKeyRequestsInSession called while the app is not active. Ignore it.");
return;
}
if (![mxSession.crypto isKindOfClass:[MXLegacyCrypto class]])
{
MXLogDebug(@"[AppDelegate] checkPendingRoomKeyRequestsInSession: Only legacy crypto allows manually accepting/rejecting key requests");
return;
}
MXLegacyCrypto *crypto = (MXLegacyCrypto *)mxSession.crypto;
MXWeakify(self);
[mxSession.crypto pendingKeyRequests:^(MXUsersDevicesMap<NSArray<MXIncomingRoomKeyRequest *> *> *pendingKeyRequests) {
[crypto pendingKeyRequests:^(MXUsersDevicesMap<NSArray<MXIncomingRoomKeyRequest *> *> *pendingKeyRequests) {
MXStrongifyAndReturnIfNil(self);
MXLogDebug(@"[AppDelegate] checkPendingRoomKeyRequestsInSession: cross-signing state: %ld, pendingKeyRequests.count: %@. Already displayed: %@",
mxSession.crypto.crossSigning.state,
crypto.crossSigning.state,
@(pendingKeyRequests.count),
self->roomKeyRequestViewController ? @"YES" : @"NO");
if (!mxSession.crypto.crossSigning || mxSession.crypto.crossSigning.state == MXCrossSigningStateNotBootstrapped)
if (!crypto.crossSigning || crypto.crossSigning.state == MXCrossSigningStateNotBootstrapped)
{
if (self->roomKeyRequestViewController)
{
@@ -3636,13 +3657,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Give the client a chance to refresh the device list
MXWeakify(self);
[mxSession.crypto downloadKeys:@[userId] forceDownload:NO success:^(MXUsersDevicesMap<MXDeviceInfo *> *usersDevicesInfoMap, NSDictionary<NSString *,MXCrossSigningInfo *> *crossSigningKeysMap) {
[crypto downloadKeys:@[userId] forceDownload:NO success:^(MXUsersDevicesMap<MXDeviceInfo *> *usersDevicesInfoMap, NSDictionary<NSString *,MXCrossSigningInfo *> *crossSigningKeysMap) {
MXStrongifyAndReturnIfNil(self);
MXDeviceInfo *deviceInfo = [usersDevicesInfoMap objectForDevice:deviceId forUser:userId];
if (deviceInfo)
{
if (!mxSession.crypto.crossSigning || mxSession.crypto.crossSigning.state == MXCrossSigningStateNotBootstrapped)
if (!crypto.crossSigning || crypto.crossSigning.state == MXCrossSigningStateNotBootstrapped)
{
BOOL wasNewDevice = (deviceInfo.trustLevel.localVerificationStatus == MXDeviceUnknown);
@@ -3650,7 +3671,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
{
MXLogDebug(@"[AppDelegate] checkPendingRoomKeyRequestsInSession: Open dialog for %@", deviceInfo);
self->roomKeyRequestViewController = [[RoomKeyRequestViewController alloc] initWithDeviceInfo:deviceInfo wasNewDevice:wasNewDevice andMatrixSession:mxSession onComplete:^{
self->roomKeyRequestViewController = [[RoomKeyRequestViewController alloc] initWithDeviceInfo:deviceInfo wasNewDevice:wasNewDevice andMatrixSession:mxSession crypto:crypto onComplete:^{
self->roomKeyRequestViewController = nil;
@@ -3664,7 +3685,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// If the device was new before, it's not any more.
if (wasNewDevice)
{
[mxSession.crypto setDeviceVerification:MXDeviceUnverified forDevice:deviceId ofUser:userId success:openDialog failure:nil];
[crypto setDeviceVerification:MXDeviceUnverified forDevice:deviceId ofUser:userId success:openDialog failure:nil];
}
else
{
@@ -3673,13 +3694,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
}
else if (deviceInfo.trustLevel.isVerified)
{
[mxSession.crypto acceptAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[crypto acceptAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[self checkPendingRoomKeyRequests];
}];
}
else
{
[mxSession.crypto ignoreAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[crypto ignoreAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[self checkPendingRoomKeyRequests];
}];
}
@@ -3687,7 +3708,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
else
{
MXLogDebug(@"[AppDelegate] checkPendingRoomKeyRequestsInSession: No details found for device %@:%@", userId, deviceId);
[mxSession.crypto ignoreAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[crypto ignoreAllPendingKeyRequestsFromUser:userId andDevice:deviceId onComplete:^{
[self checkPendingRoomKeyRequests];
}];
}
@@ -3720,7 +3741,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
usingBlock:^(NSNotification *notif)
{
NSObject *object = notif.userInfo[MXKeyVerificationManagerNotificationTransactionKey];
if ([object isKindOfClass:MXIncomingSASTransaction.class])
if ([object conformsToProtocol:@protocol(MXSASTransaction)] && ((id<MXSASTransaction>)object).isIncoming)
{
[self checkPendingIncomingKeyVerificationsInSession:mxSession];
}
@@ -3751,9 +3772,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
for (id<MXKeyVerificationTransaction> transaction in transactions)
{
if (transaction.isIncoming)
if ([transaction conformsToProtocol:@protocol(MXSASTransaction)] && transaction.isIncoming)
{
MXIncomingSASTransaction *incomingTransaction = (MXIncomingSASTransaction*)transaction;
id<MXSASTransaction> incomingTransaction = (id<MXSASTransaction>)transaction;
if (incomingTransaction.state == MXSASTransactionStateIncomingShowAccept)
{
[self presentIncomingKeyVerification:incomingTransaction inSession:mxSession];
@@ -3797,7 +3818,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
return presented;
}
- (BOOL)presentIncomingKeyVerification:(MXIncomingSASTransaction*)transaction inSession:(MXSession*)mxSession
- (BOOL)presentIncomingKeyVerification:(id<MXSASTransaction>)transaction inSession:(MXSession*)mxSession
{
MXLogDebug(@"[AppDelegate][MXKeyVerification] presentIncomingKeyVerification: %@", transaction);
@@ -3818,7 +3839,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
return presented;
}
- (BOOL)presentUserVerificationForRoomMember:(MXRoomMember*)roomMember session:(MXSession*)mxSession
- (BOOL)presentUserVerificationForRoomMember:(MXRoomMember*)roomMember
session:(MXSession*)mxSession
completion:(void (^)(void))completion;
{
MXLogDebug(@"[AppDelegate][MXKeyVerification] presentUserVerificationForRoomMember: %@", roomMember);
@@ -3831,6 +3854,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
[keyVerificationCoordinatorBridgePresenter presentFrom:self.presentedViewController roomMember:roomMember animated:YES];
presented = YES;
keyVerificationCompletionBlock = completion;
}
else
{
@@ -3862,11 +3887,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
- (void)keyVerificationCoordinatorBridgePresenterDelegateDidComplete:(KeyVerificationCoordinatorBridgePresenter *)coordinatorBridgePresenter otherUserId:(NSString * _Nonnull)otherUserId otherDeviceId:(NSString * _Nonnull)otherDeviceId
{
MXCrypto *crypto = coordinatorBridgePresenter.session.crypto;
if (!crypto.backup.hasPrivateKeyInCryptoStore || !crypto.backup.enabled)
id<MXCrypto> crypto = coordinatorBridgePresenter.session.crypto;
if ([crypto isKindOfClass:[MXLegacyCrypto class]] && (!crypto.backup.hasPrivateKeyInCryptoStore || !crypto.backup.enabled))
{
MXLogDebug(@"[AppDelegate][MXKeyVerification] requestAllPrivateKeys: Request key backup private keys");
[crypto setOutgoingKeyRequestsEnabled:YES onComplete:nil];
[(MXLegacyCrypto *)crypto setOutgoingKeyRequestsEnabled:YES onComplete:nil];
}
[self dismissKeyVerificationCoordinatorBridgePresenter];
[BWIAnalytics.sharedTracker trackEvent:@"Session" action:@"Login"];
@@ -3884,20 +3909,25 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
}];
keyVerificationCoordinatorBridgePresenter = nil;
if (keyVerificationCompletionBlock) {
keyVerificationCompletionBlock();
}
keyVerificationCompletionBlock = nil;
}
#pragma mark - New request
- (void)registerNewRequestNotificationForSession:(MXSession*)session
{
MXKeyVerificationManager *keyverificationManager = session.crypto.keyVerificationManager;
id<MXKeyVerificationManager> keyVerificationManager = session.crypto.keyVerificationManager;
if (!keyverificationManager)
if (!keyVerificationManager)
{
return;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyVerificationNewRequestNotification:) name:MXKeyVerificationManagerNewRequestNotification object:keyverificationManager];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyVerificationNewRequestNotification:) name:MXKeyVerificationManagerNewRequestNotification object:keyVerificationManager];
}
- (void)keyVerificationNewRequestNotification:(NSNotification *)notification
@@ -3922,28 +3952,26 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
id<MXKeyVerificationRequest> keyVerificationRequest = userInfo[MXKeyVerificationManagerNotificationRequestKey];
if ([keyVerificationRequest isKindOfClass:MXKeyVerificationByDMRequest.class])
if (keyVerificationRequest.transport == MXKeyVerificationTransportDirectMessage)
{
MXKeyVerificationByDMRequest *keyVerificationByDMRequest = (MXKeyVerificationByDMRequest*)keyVerificationRequest;
if (!keyVerificationByDMRequest.isFromMyUser && keyVerificationByDMRequest.state == MXKeyVerificationRequestStatePending)
if (!keyVerificationRequest.isFromMyUser && keyVerificationRequest.state == MXKeyVerificationRequestStatePending)
{
MXKAccount *currentAccount = [MXKAccountManager sharedManager].activeAccounts.firstObject;
MXSession *session = currentAccount.mxSession;
MXRoom *room = [currentAccount.mxSession roomWithRoomId:keyVerificationByDMRequest.roomId];
MXRoom *room = [currentAccount.mxSession roomWithRoomId:keyVerificationRequest.roomId];
if (!room)
{
MXLogDebug(@"[AppDelegate][KeyVerification] keyVerificationRequestDidChangeNotification: Unknown room");
return;
}
NSString *sender = keyVerificationByDMRequest.otherUser;
NSString *sender = keyVerificationRequest.otherUser;
[room state:^(MXRoomState *roomState) {
NSString *senderName = [roomState.members memberName:sender];
[self presentNewKeyVerificationRequestAlertForSession:session senderName:senderName senderId:sender request:keyVerificationByDMRequest];
[self presentNewKeyVerificationRequestAlertForSession:session senderName:senderName senderId:sender request:keyVerificationRequest];
}];
}
}
@@ -3980,7 +4008,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// This happens when they or our user do not have cross-signing enabled
MXLogDebug(@"[AppDelegate][KeyVerification] keyVerificationNewRequestNotification: Device verification from other user %@:%@", keyVerificationRequest.otherUser, keyVerificationRequest.otherDevice);
NSString *myUserId = ((MXKeyVerificationByToDeviceRequest*)keyVerificationRequest).to;
NSString *myUserId = keyVerificationRequest.myUserId;
NSString *userId = keyVerificationRequest.otherUser;
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:myUserId];
if (account)
@@ -4105,7 +4133,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
- (void)registerUserDidSignInOnNewDeviceNotificationForSession:(MXSession*)session
{
MXCrossSigning *crossSigning = session.crypto.crossSigning;
id<MXCrossSigning> crossSigning = session.crypto.crossSigning;
if (!crossSigning)
{
@@ -4196,7 +4224,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
- (void)registerDidChangeCrossSigningKeysNotificationForSession:(MXSession*)session
{
MXCrossSigning *crossSigning = session.crypto.crossSigning;
id<MXCrossSigning> crossSigning = session.crypto.crossSigning;
if (!crossSigning)
{