mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
SettingsVC: Use CrossSigningSetupCoordinatorBridgePresenter to setup cross signing.
This commit is contained in:
@@ -249,6 +249,8 @@ TableViewSectionsDelegate>
|
||||
|
||||
@property (nonatomic, strong) InviteFriendsPresenter *inviteFriendsPresenter;
|
||||
|
||||
@property (nonatomic, strong) CrossSigningSetupCoordinatorBridgePresenter *crossSigningSetupCoordinatorBridgePresenter;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SettingsViewController
|
||||
@@ -4029,58 +4031,42 @@ TableViewSectionsDelegate>
|
||||
message:(NSString*)message
|
||||
success:(void (^)(void))success
|
||||
failure:(void (^)(NSError *error))failure
|
||||
{
|
||||
__block UIViewController *viewController;
|
||||
[self startActivityIndicator];
|
||||
|
||||
// Get credentials to set up cross-signing
|
||||
NSString *path = [NSString stringWithFormat:@"%@/keys/device_signing/upload", kMXAPIPrefixPathUnstable];
|
||||
_authenticatedSessionViewControllerFactory = [[AuthenticatedSessionViewControllerFactory alloc] initWithSession:self.mainSession];
|
||||
[_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:^{
|
||||
[self stopActivityIndicator];
|
||||
success();
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
[self stopActivityIndicator];
|
||||
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
failure(error);
|
||||
}];
|
||||
}
|
||||
|
||||
} onCancelled:^{
|
||||
[self stopActivityIndicator];
|
||||
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
viewController = nil;
|
||||
failure(nil);
|
||||
} onFailure:^(NSError * _Nonnull error) {
|
||||
|
||||
[self stopActivityIndicator];
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
|
||||
[viewController dismissViewControllerAnimated:NO completion:nil];
|
||||
viewController = nil;
|
||||
failure(error);
|
||||
}];
|
||||
}
|
||||
|
||||
{
|
||||
[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;
|
||||
};
|
||||
|
||||
CrossSigningSetupCoordinatorBridgePresenter *crossSigningSetupCoordinatorBridgePresenter = [[CrossSigningSetupCoordinatorBridgePresenter alloc] initWithSession:self.mainSession];
|
||||
|
||||
[crossSigningSetupCoordinatorBridgePresenter presentWith:title
|
||||
message:message
|
||||
from:self
|
||||
animated:YES
|
||||
success:^{
|
||||
animationCompletion();
|
||||
success();
|
||||
} cancel:^{
|
||||
animationCompletion();
|
||||
failure(nil);
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
animationCompletion();
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
failure(error);
|
||||
}];
|
||||
|
||||
self.crossSigningSetupCoordinatorBridgePresenter = crossSigningSetupCoordinatorBridgePresenter;
|
||||
}
|
||||
|
||||
#pragma mark - SingleImagePickerPresenterDelegate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user