mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
Device Verification: Hack EncryptionInfoView to display the new device verification flow when the user taps on "Verify"
This commit is contained in:
@@ -20,6 +20,15 @@
|
||||
#import "ThemeService.h"
|
||||
#import "Riot-Swift.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface EncryptionInfoView() <DeviceVerificationCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
DeviceVerificationCoordinatorBridgePresenter *deviceVerificationCoordinatorBridgePresenter;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation EncryptionInfoView
|
||||
|
||||
#pragma mark - Override MXKView
|
||||
@@ -37,4 +46,38 @@
|
||||
self.confirmVerifyButton.tintColor = ThemeService.shared.theme.tintColor;
|
||||
}
|
||||
|
||||
- (void)displayLegacyVerificationScreen
|
||||
{
|
||||
[super onButtonPressed:self.verifyButton];
|
||||
}
|
||||
|
||||
- (void)onButtonPressed:(id)sender
|
||||
{
|
||||
UIViewController *rootViewController = [AppDelegate theDelegate].window.rootViewController;
|
||||
if (sender == self.verifyButton && self.mxDeviceInfo.verified != MXDeviceVerified
|
||||
&& self.mxDeviceInfo
|
||||
&& rootViewController)
|
||||
{
|
||||
// Redirect to the interactive device verification flow
|
||||
deviceVerificationCoordinatorBridgePresenter = [[DeviceVerificationCoordinatorBridgePresenter alloc] initWithSession:self.mxSession];
|
||||
deviceVerificationCoordinatorBridgePresenter.delegate = self;
|
||||
|
||||
// Show it on the root view controller
|
||||
[deviceVerificationCoordinatorBridgePresenter presentFrom:rootViewController otherUserId:self.mxDeviceInfo.userId otherDeviceId:self.mxDeviceInfo.deviceId animated:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[super onButtonPressed:sender];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deviceVerificationCoordinatorBridgePresenterDelegateDidComplete:(DeviceVerificationCoordinatorBridgePresenter * _Nonnull)coordinatorBridgePresenter otherUserId:(NSString * _Nonnull)otherUserId otherDeviceId:(NSString * _Nonnull)otherDeviceId {
|
||||
|
||||
[deviceVerificationCoordinatorBridgePresenter dismissWithAnimated:YES];
|
||||
deviceVerificationCoordinatorBridgePresenter = nil;
|
||||
|
||||
// Eject like MXKEncryptionInfoView does
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user