Show cancel button when showing authenticationViewController

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2022-11-10 18:09:29 +01:00
Родитель fe55e8d69e
Коммит 06d5475eb3
2 изменённых файлов: 42 добавлений и 12 удалений

Просмотреть файл

@ -49,7 +49,6 @@ NSString * const kNCAuthTokenFlowEndpoint = @"/index.php/login/flo
self = [super init];
if (self) {
self.serverUrl = serverUrl;
self.modalPresentationStyle = ([[NCDatabaseManager sharedInstance] numberOfAccounts] == 0) ? UIModalPresentationFullScreen : UIModalPresentationAutomatic;
}
return self;
@ -101,6 +100,36 @@ NSString * const kNCAuthTokenFlowEndpoint = @"/index.php/login/flo
}];
}
- (void)viewWillAppear:(BOOL)animated
{
UIColor *themeColor = [NCAppBranding themeColor];
[self.view setBackgroundColor:themeColor];
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]}];
self.navigationController.navigationBar.tintColor = [NCAppBranding themeTextColor];
self.navigationController.navigationBar.translucent = YES;
self.navigationController.navigationBar.barTintColor = [NCAppBranding themeColor];
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(cancelButtonPressed)];
cancelButton.accessibilityHint = NSLocalizedString(@"Double tap to dismiss authentication dialog", nil);
self.navigationController.navigationBar.topItem.leftBarButtonItem = cancelButton;
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = themeColor;
appearance.titleTextAttributes = @{NSForegroundColorAttributeName:[NCAppBranding themeTextColor]};
self.navigationItem.standardAppearance = appearance;
self.navigationItem.compactAppearance = appearance;
self.navigationItem.scrollEdgeAppearance = appearance;
}
- (void)cancelButtonPressed
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];

Просмотреть файл

@ -201,7 +201,8 @@
_authenticationViewController.user = user;
}
[self presentViewController:_authenticationViewController animated:YES completion:nil];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:_authenticationViewController];
[self presentViewController:navController animated:YES completion:nil];
}
#pragma mark - Alerts