FreeRDP/client/iOS/Controllers/VerifyCertificateController.m

87 lines
2.2 KiB
Mathematica
Raw Normal View History

/*
Certificate verification controller
2019-11-06 17:24:51 +03:00
2013-12-04 14:37:57 +04:00
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
2019-11-06 17:24:51 +03:00
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at
http://mozilla.org/MPL/2.0/.
*/
#import "VerifyCertificateController.h"
#import "RDPSession.h"
@implementation VerifyCertificateController
2019-11-06 17:24:51 +03:00
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
session:(RDPSession *)session
params:(NSMutableDictionary *)params
{
2019-11-06 17:24:51 +03:00
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
_session = session;
_params = params;
[self setModalPresentationStyle:UIModalPresentationFormSheet];
}
return self;
}
- (void)viewDidLoad
{
2019-11-06 17:24:51 +03:00
[super viewDidLoad];
NSString *message = NSLocalizedString(
@"The identity of the remote computer cannot be verified. Do you want to connect anyway?",
@"Verify certificate view message");
2019-11-06 17:24:51 +03:00
// init strings
[_label_message setText:message];
[_label_for_issuer
setText:NSLocalizedString(@"Issuer:", @"Verify certificate view issuer label")];
[_btn_accept setTitle:NSLocalizedString(@"Yes", @"Yes Button") forState:UIControlStateNormal];
[_btn_decline setTitle:NSLocalizedString(@"No", @"No Button") forState:UIControlStateNormal];
2019-11-06 17:24:51 +03:00
[_label_issuer setText:[_params valueForKey:@"issuer"]];
}
- (void)viewDidUnload
{
2019-11-06 17:24:51 +03:00
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (void)viewDidDisappear:(BOOL)animated
{
2019-11-06 17:24:51 +03:00
[super viewDidDisappear:animated];
2019-11-06 17:24:51 +03:00
// set signal
[[_session uiRequestCompleted] signal];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
2019-11-06 17:24:51 +03:00
return YES;
}
#pragma mark - Action handlers
- (IBAction)acceptPressed:(id)sender
{
2019-11-06 17:24:51 +03:00
[_params setValue:[NSNumber numberWithBool:YES] forKey:@"result"];
// dismiss controller
[self dismissModalViewControllerAnimated:YES];
}
- (IBAction)declinePressed:(id)sender
{
2019-11-06 17:24:51 +03:00
[_params setValue:[NSNumber numberWithBool:NO] forKey:@"result"];
// dismiss controller
[self dismissModalViewControllerAnimated:YES];
}
@end