mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 16:42:44 +02:00
Merged element 1.11.3 into bum
This commit is contained in:
@@ -46,7 +46,7 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
@interface ManageSessionViewController () <UserVerificationCoordinatorBridgePresenterDelegate>
|
||||
@interface ManageSessionViewController () <UserVerificationCoordinatorBridgePresenterDelegate, SSOAuthenticationPresenterDelegate>
|
||||
{
|
||||
// The device to display
|
||||
MXDevice *device;
|
||||
@@ -65,6 +65,8 @@ enum {
|
||||
|
||||
@property (nonatomic, strong) ReauthenticationCoordinatorBridgePresenter *reauthenticationCoordinatorBridgePresenter;
|
||||
|
||||
@property (nonatomic, strong) SSOAuthenticationPresenter *ssoAuthenticationPresenter;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ManageSessionViewController
|
||||
@@ -701,17 +703,19 @@ enum {
|
||||
{
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle: [VectorL10n manageSessionRedirect] message: nil preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
MXWeakify(self);
|
||||
UIAlertAction *action = [UIAlertAction actionWithTitle:[VectorL10n ok]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler: ^(UIAlertAction * action) {
|
||||
[UIApplication.sharedApplication openURL:url options:@{} completionHandler:^(BOOL success) {
|
||||
if (success && weakSelf)
|
||||
{
|
||||
[weakSelf withdrawViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
}];
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
SSOAccountService *service = [[SSOAccountService alloc] initWithAccountURL:url];
|
||||
SSOAuthenticationPresenter *presenter = [[SSOAuthenticationPresenter alloc] initWithSsoAuthenticationService:service];
|
||||
presenter.delegate = self;
|
||||
self.ssoAuthenticationPresenter = presenter;
|
||||
|
||||
[presenter presentForIdentityProvider:nil with:@"" from:self animated:YES];
|
||||
}];
|
||||
|
||||
[alert addAction: action];
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
@@ -777,4 +781,27 @@ enum {
|
||||
[self reloadDeviceWithCompletion:^{}];
|
||||
}
|
||||
|
||||
#pragma mark - SSOAuthenticationPresenterDelegate
|
||||
|
||||
- (void)ssoAuthenticationPresenterDidCancel:(SSOAuthenticationPresenter *)presenter
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogDebug(@"OIDC account management complete.")
|
||||
[self withdrawViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)ssoAuthenticationPresenter:(SSOAuthenticationPresenter *)presenter authenticationDidFailWithError:(NSError *)error
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogError(@"OIDC account management failed.")
|
||||
}
|
||||
|
||||
- (void)ssoAuthenticationPresenter:(SSOAuthenticationPresenter *)presenter
|
||||
authenticationSucceededWithToken:(NSString *)token
|
||||
usingIdentityProvider:(SSOIdentityProvider *)identityProvider
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogWarning(@"Unexpected callback after OIDC account management.")
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user