diff --git a/CHANGES.md b/CHANGES.md index d2e289625..ee4133fae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,20 @@ +## Changes in 1.11.0 (2023-08-15) + +✨ Features + +- Integrate Device Dehydration v2 through the Crypto SDK ([#7630](https://github.com/vector-im/element-ios/pull/7630)) + +🙌 Improvements + +- Upgrade MatrixSDK version ([v0.27.0](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.27.0)). +- Disable Siri, Share and Reply (from NSE) Extensions. ([#7618](https://github.com/vector-im/element-ios/issues/7618)) + +🐛 Bugfixes + +- Fix bug in SSO URL generation that was non-compliant with the spec. ([#7639](https://github.com/vector-im/element-ios/pull/7639)) +- Fix a crash when opening v11 rooms. ([#7633](https://github.com/vector-im/element-ios/issues/7633)) + + ## Changes in 1.10.14 (2023-06-21) 🙌 Improvements diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index b484e08dc..ec41e80dc 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 1.10.14 -CURRENT_PROJECT_VERSION = 1.10.14 +MARKETING_VERSION = 1.11.0 +CURRENT_PROJECT_VERSION = 1.11.0 diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index f58f969c1..faf730a90 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -192,7 +192,7 @@ final class BuildSettings: NSObject { #else /// The configuration to use for analytics. Set `isEnabled` to false to disable analytics. static let analyticsConfiguration = AnalyticsConfiguration(isEnabled: BuildSettings.baseBundleIdentifier.starts(with: "im.vector.app"), - host: "https://posthog.hss.element.io", + host: "https://posthog.element.io", apiKey: "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO", termsURL: URL(string: "https://element.io/cookie-policy")!) #endif diff --git a/Podfile b/Podfile index 4aabb6bbc..581fc76b0 100644 --- a/Podfile +++ b/Podfile @@ -16,7 +16,7 @@ use_frameworks! # - `{ :specHash => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for MatrixSDK repo. Used by Fastfile during CI # # Warning: our internal tooling depends on the name of this variable name, so be sure not to change it -$matrixSDKVersion = '= 0.26.12' +$matrixSDKVersion = '= 0.27.0' # $matrixSDKVersion = :local # $matrixSDKVersion = { :branch => 'develop'} # $matrixSDKVersion = { :specHash => { git: 'https://git.io/fork123', branch: 'fix' } } @@ -104,22 +104,12 @@ abstract_target 'RiotPods' do end end - target "RiotShareExtension" do - import_MatrixSDK - import_MatrixKit_pods - end - target "RiotSwiftUI" do import_SwiftUI_pods - end + end target "RiotSwiftUITests" do import_SwiftUI_pods - end - - target "SiriIntents" do - import_MatrixSDK - import_MatrixKit_pods end target "RiotNSE" do @@ -131,6 +121,18 @@ abstract_target 'RiotPods' do import_MatrixSDK end + # Disabled due to crypto corruption issues. + # https://github.com/vector-im/element-ios/issues/7618 + # target "RiotShareExtension" do + # import_MatrixSDK + # import_MatrixKit_pods + # end + # + # target "SiriIntents" do + # import_MatrixSDK + # import_MatrixKit_pods + # end + end post_install do |installer| diff --git a/Podfile.lock b/Podfile.lock index bdbbb2d00..988424488 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -39,20 +39,20 @@ PODS: - LoggerAPI (1.9.200): - Logging (~> 1.1) - Logging (1.4.0) - - MatrixSDK (0.26.12): - - MatrixSDK/Core (= 0.26.12) - - MatrixSDK/Core (0.26.12): + - MatrixSDK (0.27.0): + - MatrixSDK/Core (= 0.27.0) + - MatrixSDK/Core (0.27.0): - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) - - MatrixSDKCrypto (= 0.3.4) + - MatrixSDKCrypto (= 0.3.12) - OLMKit (~> 3.2.5) - Realm (= 10.27.0) - SwiftyBeaver (= 1.9.5) - - MatrixSDK/JingleCallStack (0.26.12): + - MatrixSDK/JingleCallStack (0.27.0): - JitsiMeetSDKLite (= 8.1.2-lite) - MatrixSDK/Core - - MatrixSDKCrypto (0.3.4) + - MatrixSDKCrypto (0.3.12) - OLMKit (3.2.12): - OLMKit/olmc (= 3.2.12) - OLMKit/olmcpp (= 3.2.12) @@ -102,8 +102,8 @@ DEPENDENCIES: - KeychainAccess (~> 4.2.2) - KTCenterFlowLayout (~> 1.3.1) - libPhoneNumber-iOS (~> 0.9.13) - - MatrixSDK (= 0.26.12) - - MatrixSDK/JingleCallStack (= 0.26.12) + - MatrixSDK (= 0.27.0) + - MatrixSDK/JingleCallStack (= 0.27.0) - OLMKit - PostHog (~> 2.0.0) - ReadMoreTextView (~> 3.0.1) @@ -187,8 +187,8 @@ SPEC CHECKSUMS: libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75 LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d Logging: beeb016c9c80cf77042d62e83495816847ef108b - MatrixSDK: 0af737bc461b82d0ec9edd6fdf8f70b02771ebd3 - MatrixSDKCrypto: ac805c22c24f79f349cdbfa065855c73a4c81b51 + MatrixSDK: 981c0e6abd40f0882e1316923edb2b3966d29513 + MatrixSDKCrypto: 25929a40733b4ab54f659aaf6a730552a0a06504 OLMKit: da115f16582e47626616874e20f7bb92222c7a51 PostHog: 660ec6c9d80cec17b685e148f17f6785a88b597d ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d @@ -208,6 +208,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 0e7e10f516d40d9df60cb874170b91603c632118 +PODFILE CHECKSUM: f8f66ce4fa24937192a493d3a0a5c2c2e429c8fc COCOAPODS: 1.11.3 diff --git a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme b/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme index 012a5a109..52ec9a4e1 100644 --- a/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme +++ b/Riot.xcodeproj/xcshareddata/xcschemes/Riot.xcscheme @@ -1,6 +1,6 @@ *credentials, void (^completion)(BOOL didUpdateCredentials))) { - [[MXKAccountManager sharedManager] readAndWriteCredentials:handler]; - } andUnauthenticatedHandler: nil]; - - MXWeakify(self); - [[MXKAccountManager sharedManager].dehydrationService rehydrateDeviceWithMatrixRestClient:mxRestClient dehydrationKey:keyData success:^(NSString * deviceId) { - MXStrongifyAndReturnIfNil(self); - - if (deviceId) - { - MXLogDebug(@"[MXKAuthenticationViewController] attemptDeviceRehydration: device %@ rehydrated successfully.", deviceId); - credentials.deviceId = deviceId; - } - else - { - MXLogDebug(@"[MXKAuthenticationViewController] attemptDeviceRehydration: device rehydration has been canceled."); - } - - [self _createAccountWithCredentials:credentials]; - } failure:^(NSError *error) { - MXStrongifyAndReturnIfNil(self); - - if (retry) - { - MXLogErrorDetails(@"[MXKAuthenticationViewController] attemptDeviceRehydration: device rehydration failed due to error: Retrying", @{ - @"error": error ?: @"unknown" - }); - [self attemptDeviceRehydrationWithKeyData:keyData credentials:credentials retry:NO]; - return; - } - - MXLogErrorDetails(@"[MXKAuthenticationViewController] attemptDeviceRehydration: device rehydration failed due to error", @{ - @"error": error ?: @"unknown" - }); - - [self _createAccountWithCredentials:credentials]; - }]; -} - - (void)_createAccountWithCredentials:(MXCredentials *)credentials { MXKAccount *account = [[MXKAccount alloc] initWithCredentials:credentials]; diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.h b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.h index 679e805f8..ecd5b3aad 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.h +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.h @@ -360,13 +360,6 @@ typedef BOOL (^MXKAccountOnCertificateChange)(MXKAccount *mxAccount, NSData *cer #pragma mark - Sync filter -/** - Call this method at an appropriate time to attempt dehydrating to a new backup device - */ -- (void)attemptDeviceDehydrationWithKeyData:(NSData *)keyData - success:(void (^)(void))success - failure:(void (^)(NSError *error))failure; - /** Handle unauthenticated errors from the server triggering hard/soft logouts as appropriate. */ diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m index 1d0382375..930a63f8a 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m @@ -1715,70 +1715,6 @@ static NSArray *initialSyncSilentErrorsHTTPStatusCodes; }]; } -- (void)attemptDeviceDehydrationWithKeyData:(NSData *)keyData - success:(void (^)(void))success - failure:(void (^)(NSError *error))failure -{ - [self attemptDeviceDehydrationWithKeyData:keyData retry:YES success:success failure:failure]; -} - -- (void)attemptDeviceDehydrationWithKeyData:(NSData *)keyData - retry:(BOOL)retry - success:(void (^)(void))success - failure:(void (^)(NSError *error))failure -{ - if (keyData == nil) - { - MXLogWarning(@"[MXKAccount] attemptDeviceDehydrationWithRetry: no key provided for device dehydration"); - - if (failure) - { - failure(nil); - } - - return; - } - - if (![mxSession.crypto.crossSigning isKindOfClass:[MXLegacyCrossSigning class]]) { - MXLogFailure(@"Device dehydratation is currently only supported by legacy cross signing, add support to all implementations"); - if (failure) - { - failure(nil); - } - return; - } - MXLegacyCrossSigning *crossSigning = (MXLegacyCrossSigning *)mxSession.crypto.crossSigning;; - - MXLogDebug(@"[MXKAccount] attemptDeviceDehydrationWithRetry: starting device dehydration"); - [[MXKAccountManager sharedManager].dehydrationService dehydrateDeviceWithMatrixRestClient:mxRestClient crossSigning:crossSigning dehydrationKey:keyData success:^(NSString *deviceId) { - MXLogDebug(@"[MXKAccount] attemptDeviceDehydrationWithRetry: device successfully dehydrated"); - - if (success) - { - success(); - } - } failure:^(NSError *error) { - if (retry) - { - [self attemptDeviceDehydrationWithKeyData:keyData retry:NO success:success failure:failure]; - MXLogErrorDetails(@"[MXKAccount] attemptDeviceDehydrationWithRetry: device dehydration failed due to error: Retrying.", @{ - @"error": error ?: @"unknown" - }); - } - else - { - MXLogErrorDetails(@"[MXKAccount] attemptDeviceDehydrationWithRetry: device dehydration failed due to error", @{ - @"error": error ?: @"unknown" - }); - - if (failure) - { - failure(error); - } - } - }]; -} - - (void)onMatrixSessionStateChange { // Check if pause has been requested diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.h b/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.h index 7881832e0..2e21bd9a4 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.h +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.h @@ -104,8 +104,6 @@ extern NSString *const MXKAccountManagerDataType; */ @property (nonatomic) BOOL isPushAvailable; -@property (nonatomic, readonly) MXDehydrationService *dehydrationService; - /** Retrieve the MXKAccounts manager. diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.m b/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.m index 6a69ee6a7..c779e5c47 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.m +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccountManager.m @@ -71,7 +71,6 @@ NSString *const MXKAccountManagerDataType = @"org.matrix.kit.MXKAccountManagerDa if (self) { _storeClass = [MXFileStore class]; - _dehydrationService = [MXDehydrationService new]; _savingAccountsEnabled = YES; // Migrate old account file to new format diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index 19fae141d..d6a3b5cfd 100644 --- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -830,38 +830,37 @@ static NSString *const kRepliedTextPattern = @".*
.*
(.* } case MXEventTypeRoomCreate: { - NSString *creatorId; - MXJSONModelSetString(creatorId, event.content[@"creator"]); + // Room version 11 removes `creator` in favour of `sender`. + // https://github.com/matrix-org/matrix-spec-proposals/pull/2175 + // Just use the sender as it is possible to create a v11 room and spoof the `creator`. + NSString *creatorId = event.sender; - if (creatorId) + if ([creatorId isEqualToString:mxSession.myUserId]) { - if ([creatorId isEqualToString:mxSession.myUserId]) + if (isRoomDirect) { - if (isRoomDirect) - { - displayText = [VectorL10n noticeRoomCreatedByYouForDm]; - } - else - { - displayText = [VectorL10n noticeRoomCreatedByYou]; - } + displayText = [VectorL10n noticeRoomCreatedByYouForDm]; } else { - if (isRoomDirect) - { - displayText = [VectorL10n noticeRoomCreatedForDm:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; - } - else - { - displayText = [VectorL10n noticeRoomCreated:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; - } + displayText = [VectorL10n noticeRoomCreatedByYou]; } - // Append redacted info if any - if (redactedInfo) + } + else + { + if (isRoomDirect) { - displayText = [NSString stringWithFormat:@"%@ %@", displayText, redactedInfo]; + displayText = [VectorL10n noticeRoomCreatedForDm:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; } + else + { + displayText = [VectorL10n noticeRoomCreated:(roomState ? [roomState.members memberName:creatorId] : creatorId)]; + } + } + // Append redacted info if any + if (redactedInfo) + { + displayText = [NSString stringWithFormat:@"%@ %@", displayText, redactedInfo]; } break; } diff --git a/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyCoordinator.swift b/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyCoordinator.swift index efb42a35a..27d05afb2 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyCoordinator.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyCoordinator.swift @@ -34,9 +34,9 @@ final class SecretsRecoveryWithKeyCoordinator: SecretsRecoveryWithKeyCoordinator // MARK: - Setup - init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, cancellable: Bool) { + init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, cancellable: Bool, dehydrationService: DehydrationService?) { - let secretsRecoveryWithKeyViewModel = SecretsRecoveryWithKeyViewModel(recoveryService: recoveryService, recoveryGoal: recoveryGoal) + let secretsRecoveryWithKeyViewModel = SecretsRecoveryWithKeyViewModel(recoveryService: recoveryService, recoveryGoal: recoveryGoal, dehydrationService: dehydrationService) let secretsRecoveryWithKeyViewController = SecretsRecoveryWithKeyViewController.instantiate(with: secretsRecoveryWithKeyViewModel, cancellable: cancellable) self.secretsRecoveryWithKeyViewController = secretsRecoveryWithKeyViewController self.secretsRecoveryWithKeyViewModel = secretsRecoveryWithKeyViewModel diff --git a/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyViewModel.swift b/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyViewModel.swift index f56562f7d..c18222bd0 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyViewModel.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyViewModel.swift @@ -24,6 +24,8 @@ final class SecretsRecoveryWithKeyViewModel: SecretsRecoveryWithKeyViewModelType private let recoveryService: MXRecoveryService + private let dehydrationService: DehydrationService? + // MARK: Public let recoveryGoal: SecretsRecoveryGoal @@ -39,8 +41,9 @@ final class SecretsRecoveryWithKeyViewModel: SecretsRecoveryWithKeyViewModelType // MARK: - Setup - init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal) { + init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, dehydrationService: DehydrationService?) { self.recoveryService = recoveryService + self.dehydrationService = dehydrationService self.recoveryGoal = recoveryGoal } @@ -83,6 +86,10 @@ final class SecretsRecoveryWithKeyViewModel: SecretsRecoveryWithKeyViewModelType } self.update(viewState: .loaded) self.coordinatorDelegate?.secretsRecoveryWithKeyViewModelDidRecover(self) + + Task { + await self.dehydrationService?.runDeviceDehydrationFlow(privateKeyData: privateKey) + } }, failure: { [weak self] error in guard let self = self else { return diff --git a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseCoordinator.swift b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseCoordinator.swift index 02133fcbc..52d34a2eb 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseCoordinator.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseCoordinator.swift @@ -34,8 +34,8 @@ final class SecretsRecoveryWithPassphraseCoordinator: SecretsRecoveryWithPassphr // MARK: - Setup - init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, cancellable: Bool) { - let secretsRecoveryWithPassphraseViewModel = SecretsRecoveryWithPassphraseViewModel(recoveryService: recoveryService, recoveryGoal: recoveryGoal) + init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, cancellable: Bool, dehydrationService: DehydrationService?) { + let secretsRecoveryWithPassphraseViewModel = SecretsRecoveryWithPassphraseViewModel(recoveryService: recoveryService, recoveryGoal: recoveryGoal, dehydrationService: dehydrationService) let secretsRecoveryWithPassphraseViewController = SecretsRecoveryWithPassphraseViewController.instantiate(with: secretsRecoveryWithPassphraseViewModel, cancellable: cancellable) self.secretsRecoveryWithPassphraseViewController = secretsRecoveryWithPassphraseViewController self.secretsRecoveryWithPassphraseViewModel = secretsRecoveryWithPassphraseViewModel diff --git a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewModel.swift b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewModel.swift index 71e51e270..dd05f8425 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewModel.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewModel.swift @@ -24,6 +24,8 @@ final class SecretsRecoveryWithPassphraseViewModel: SecretsRecoveryWithPassphras private let recoveryService: MXRecoveryService + private let dehydrationService: DehydrationService? + // MARK: Public let recoveryGoal: SecretsRecoveryGoal @@ -39,8 +41,9 @@ final class SecretsRecoveryWithPassphraseViewModel: SecretsRecoveryWithPassphras // MARK: - Setup - init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal) { + init(recoveryService: MXRecoveryService, recoveryGoal: SecretsRecoveryGoal, dehydrationService: DehydrationService?) { self.recoveryService = recoveryService + self.dehydrationService = dehydrationService self.recoveryGoal = recoveryGoal } @@ -103,6 +106,10 @@ final class SecretsRecoveryWithPassphraseViewModel: SecretsRecoveryWithPassphras } self.update(viewState: .loaded) self.coordinatorDelegate?.secretsRecoveryWithPassphraseViewModelDidRecover(self) + + Task { + await self.dehydrationService?.runDeviceDehydrationFlow(privateKeyData: privateKey) + } }, failure: { [weak self] error in guard let self = self else { return diff --git a/Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift b/Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift index 817414956..762c72a73 100644 --- a/Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift +++ b/Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift @@ -85,14 +85,28 @@ final class SecretsRecoveryCoordinator: SecretsRecoveryCoordinatorType { // MARK: - Private + private var dehydrationService: DehydrationService? { + if self.session.vc_homeserverConfiguration().encryption.deviceDehydrationEnabled { + return self.session.crypto.dehydrationService + } + + return nil + } + private func createRecoverFromKeyCoordinator() -> SecretsRecoveryWithKeyCoordinator { - let coordinator = SecretsRecoveryWithKeyCoordinator(recoveryService: self.session.crypto.recoveryService, recoveryGoal: self.recoveryGoal, cancellable: self.cancellable) + let coordinator = SecretsRecoveryWithKeyCoordinator(recoveryService: self.session.crypto.recoveryService, + recoveryGoal: self.recoveryGoal, + cancellable: self.cancellable, + dehydrationService: dehydrationService) coordinator.delegate = self return coordinator } private func createRecoverFromPassphraseCoordinator() -> SecretsRecoveryWithPassphraseCoordinator { - let coordinator = SecretsRecoveryWithPassphraseCoordinator(recoveryService: self.session.crypto.recoveryService, recoveryGoal: self.recoveryGoal, cancellable: self.cancellable) + let coordinator = SecretsRecoveryWithPassphraseCoordinator(recoveryService: self.session.crypto.recoveryService, + recoveryGoal: self.recoveryGoal, + cancellable: self.cancellable, + dehydrationService: dehydrationService) coordinator.delegate = self return coordinator } diff --git a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyCoordinator.swift b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyCoordinator.swift index 58ebf79ba..9dc055e49 100644 --- a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyCoordinator.swift +++ b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyCoordinator.swift @@ -42,8 +42,13 @@ final class SecretsSetupRecoveryKeyCoordinator: SecretsSetupRecoveryKeyCoordinat passphrase: String?, passphraseOnly: Bool, allowOverwrite: Bool = false, - cancellable: Bool) { - let secretsSetupRecoveryKeyViewModel = SecretsSetupRecoveryKeyViewModel(recoveryService: recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly, allowOverwrite: allowOverwrite) + cancellable: Bool, + dehydrationService: DehydrationService?) { + let secretsSetupRecoveryKeyViewModel = SecretsSetupRecoveryKeyViewModel(recoveryService: recoveryService, + passphrase: passphrase, + passphraseOnly: passphraseOnly, + allowOverwrite: allowOverwrite, + dehydrationService: dehydrationService) let secretsSetupRecoveryKeyViewController = SecretsSetupRecoveryKeyViewController.instantiate(with: secretsSetupRecoveryKeyViewModel, cancellable: cancellable) self.secretsSetupRecoveryKeyViewModel = secretsSetupRecoveryKeyViewModel self.secretsSetupRecoveryKeyViewController = secretsSetupRecoveryKeyViewController diff --git a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewModel.swift b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewModel.swift index af85b7eb7..c91cb6787 100644 --- a/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewModel.swift +++ b/Riot/Modules/Secrets/Setup/RecoveryKey/SecretsSetupRecoveryKeyViewModel.swift @@ -28,6 +28,7 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy private let passphrase: String? private let passphraseOnly: Bool private let allowOverwrite: Bool + private let dehydrationService: DehydrationService? // MARK: Public @@ -36,11 +37,12 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy // MARK: - Setup - init(recoveryService: MXRecoveryService, passphrase: String?, passphraseOnly: Bool, allowOverwrite: Bool = false) { + init(recoveryService: MXRecoveryService, passphrase: String?, passphraseOnly: Bool, allowOverwrite: Bool = false, dehydrationService: DehydrationService?) { self.recoveryService = recoveryService self.passphrase = passphrase self.passphraseOnly = passphraseOnly self.allowOverwrite = allowOverwrite + self.dehydrationService = dehydrationService } // MARK: - Public @@ -76,6 +78,10 @@ final class SecretsSetupRecoveryKeyViewModel: SecretsSetupRecoveryKeyViewModelTy self.recoveryService.createRecovery(forSecrets: nil, withPassphrase: self.passphrase, createServicesBackups: true, success: { secretStorageKeyCreationInfo in self.update(viewState: .recoveryCreated(secretStorageKeyCreationInfo.recoveryKey)) + + Task { + await self.dehydrationService?.runDeviceDehydrationFlow(privateKeyData: secretStorageKeyCreationInfo.privateKey) + } }, failure: { error in self.update(viewState: .error(error)) }) diff --git a/Riot/Modules/SecureBackup/Setup/SecureBackupSetupCoordinator.swift b/Riot/Modules/SecureBackup/Setup/SecureBackupSetupCoordinator.swift index 0cb633945..9752e3609 100644 --- a/Riot/Modules/SecureBackup/Setup/SecureBackupSetupCoordinator.swift +++ b/Riot/Modules/SecureBackup/Setup/SecureBackupSetupCoordinator.swift @@ -104,8 +104,21 @@ final class SecureBackupSetupCoordinator: SecureBackupSetupCoordinatorType { return introViewController } + private var dehydrationService: DehydrationService? { + if self.session.vc_homeserverConfiguration().encryption.deviceDehydrationEnabled { + return self.session.crypto.dehydrationService + } + + return nil + } + private func showSetupKey(passphraseOnly: Bool, passphrase: String? = nil) { - let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, passphrase: passphrase, passphraseOnly: passphraseOnly, allowOverwrite: allowOverwrite, cancellable: self.cancellable) + let coordinator = SecretsSetupRecoveryKeyCoordinator(recoveryService: self.recoveryService, + passphrase: passphrase, + passphraseOnly: passphraseOnly, + allowOverwrite: allowOverwrite, + cancellable: self.cancellable, + dehydrationService: dehydrationService) coordinator.delegate = self coordinator.start() diff --git a/Riot/SupportingFiles/Riot-Bridging-Header.h b/Riot/SupportingFiles/Riot-Bridging-Header.h index 296545a4e..8c2df6f56 100644 --- a/Riot/SupportingFiles/Riot-Bridging-Header.h +++ b/Riot/SupportingFiles/Riot-Bridging-Header.h @@ -44,7 +44,7 @@ #import "ContactDetailsViewController.h" #import "RoomInputToolbarView.h" #import "NSArray+Element.h" -#import "ShareItemSender.h" +#import "ShareItemSenderProtocol.h" #import "Contact.h" #import "RoomTimelineCellProvider.h" #import "PlainRoomTimelineCellProvider.h" diff --git a/Riot/target.yml b/Riot/target.yml index 8139be715..929af6e3a 100644 --- a/Riot/target.yml +++ b/Riot/target.yml @@ -34,8 +34,10 @@ targets: platform: iOS dependencies: - - target: RiotShareExtension - - target: SiriIntents + # Disabled due to crypto corruption issues. + # https://github.com/vector-im/element-ios/issues/7618 + # - target: RiotShareExtension + # - target: SiriIntents - target: RiotNSE - target: BroadcastUploadExtension - target: DesignKit diff --git a/RiotNSE/NotificationService.swift b/RiotNSE/NotificationService.swift index 1f953583b..6c41f34c6 100644 --- a/RiotNSE/NotificationService.swift +++ b/RiotNSE/NotificationService.swift @@ -799,7 +799,9 @@ class NotificationService: UNNotificationServiceExtension { return Constants.toBeRemovedNotificationCategoryIdentifier } - return "QUICK_REPLY" + // Don't return QUICK_REPLY here as there is an issue + // with crypto corruption when sending from extensions. + return nil } /// Attempts to send trigger a VoIP push for the given event diff --git a/project.yml b/project.yml index 8cbc73192..430b39cbc 100644 --- a/project.yml +++ b/project.yml @@ -29,8 +29,6 @@ options: include: - path: Riot/target.yml - path: RiotTests/target.yml - - path: RiotShareExtension/target.yml - - path: SiriIntents/target.yml - path: RiotNSE/target.yml - path: BroadcastUploadExtension/target.yml - path: DesignKit/target.yml @@ -39,6 +37,10 @@ include: - path: RiotSwiftUI/targetUITests.yml - path: CommonKit/target.yml - path: CommonKit/targetUnitTests.yml + # Disabled due to crypto corruption issues. + # https://github.com/vector-im/element-ios/issues/7618 + # - path: RiotShareExtension/target.yml + # - path: SiriIntents/target.yml packages: AnalyticsEvents: