mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-27 11:46:58 +02:00
HomeViewController: Use CrossSigningSetupCoordinatorBridgePresenter to setup cross signing.
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
@property (nonatomic, strong) SecureBackupBannerCell *secureBackupBannerPrototypeCell;
|
||||
|
||||
@property (nonatomic, strong) CrossSigningSetupBannerCell *keyVerificationSetupBannerPrototypeCell;
|
||||
@property (nonatomic, strong) AuthenticatedSessionViewControllerFactory *authenticatedSessionViewControllerFactory;
|
||||
@property (nonatomic, strong) CrossSigningSetupCoordinatorBridgePresenter *crossSigningSetupCoordinatorBridgePresenter;
|
||||
|
||||
@end
|
||||
|
||||
@@ -736,68 +736,47 @@
|
||||
message:(NSString*)message
|
||||
success:(void (^)(void))success
|
||||
failure:(void (^)(NSError *error))failure
|
||||
|
||||
{
|
||||
__block UIViewController *viewController;
|
||||
[self startActivityIndicator];
|
||||
self.view.userInteractionEnabled = NO;
|
||||
|
||||
MXWeakify(self);
|
||||
|
||||
void (^animationCompletion)(void) = ^void () {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
|
||||
[self stopActivityIndicator];
|
||||
self.view.userInteractionEnabled = YES;
|
||||
[self.crossSigningSetupCoordinatorBridgePresenter dismissWithAnimated:YES completion:^{}];
|
||||
self.crossSigningSetupCoordinatorBridgePresenter = nil;
|
||||
};
|
||||
|
||||
// Get credentials to set up cross-signing
|
||||
NSString *path = [NSString stringWithFormat:@"%@/keys/device_signing/upload", kMXAPIPrefixPathUnstable];
|
||||
self.authenticatedSessionViewControllerFactory = [[AuthenticatedSessionViewControllerFactory alloc] initWithSession:self.mainSession];
|
||||
[self.authenticatedSessionViewControllerFactory viewControllerForPath:path
|
||||
httpMethod:@"POST"
|
||||
title:title
|
||||
message:message
|
||||
onViewController:^(UIViewController * _Nonnull theViewController)
|
||||
{
|
||||
viewController = theViewController;
|
||||
[self presentViewController:viewController animated:YES completion:nil];
|
||||
|
||||
} onAuthenticated:^(NSDictionary * _Nonnull authParams) {
|
||||
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
viewController = nil;
|
||||
|
||||
MXCrossSigning *crossSigning = self.mainSession.crypto.crossSigning;
|
||||
if (crossSigning)
|
||||
{
|
||||
[crossSigning setupWithAuthParams:authParams success:^{
|
||||
animationCompletion();
|
||||
|
||||
// TODO: Remove this line and refresh key verification setup banner by listening to a local notification cross-signing state change (Add this behavior into the SDK).
|
||||
[self->recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeHome];
|
||||
|
||||
[self refreshRecentsTable];
|
||||
success();
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
animationCompletion();
|
||||
[self refreshRecentsTable];
|
||||
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
failure(error);
|
||||
}];
|
||||
}
|
||||
|
||||
} onCancelled:^{
|
||||
animationCompletion();
|
||||
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
viewController = nil;
|
||||
failure(nil);
|
||||
} onFailure:^(NSError * _Nonnull error) {
|
||||
|
||||
animationCompletion();
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
viewController = nil;
|
||||
failure(error);
|
||||
}];
|
||||
CrossSigningSetupCoordinatorBridgePresenter *crossSigningSetupCoordinatorBridgePresenter = [[CrossSigningSetupCoordinatorBridgePresenter alloc] initWithSession:self.mainSession];
|
||||
|
||||
[crossSigningSetupCoordinatorBridgePresenter presentWith:title
|
||||
message:message
|
||||
from:self
|
||||
animated:YES
|
||||
success:^{
|
||||
animationCompletion();
|
||||
|
||||
// TODO: Remove this line and refresh key verification setup banner by listening to a local notification cross-signing state change (Add this behavior into the SDK).
|
||||
[self->recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeHome];
|
||||
[self refreshRecentsTable];
|
||||
|
||||
success();
|
||||
} cancel:^{
|
||||
animationCompletion();
|
||||
failure(nil);
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
animationCompletion();
|
||||
[self refreshRecentsTable];
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
failure(error);
|
||||
}];
|
||||
|
||||
self.crossSigningSetupCoordinatorBridgePresenter = crossSigningSetupCoordinatorBridgePresenter;
|
||||
}
|
||||
|
||||
#pragma mark - Empty view management
|
||||
|
||||
Reference in New Issue
Block a user