mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
allow to hide cancel-Button in authenticator view controller
so the user is stuck in authentication
This commit is contained in:
parent
d7f45267dd
commit
9ae6fa060e
@ -19,6 +19,11 @@
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL requirePassword;
|
||||
|
||||
/** configure if user can abort authentication or not
|
||||
*
|
||||
* defaults to YES
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL showsCancelButton;
|
||||
/**
|
||||
* TODO: instead of passing the whole authenticator, we actually only need
|
||||
* something to create and enqueue BITHTTPOperations
|
||||
|
@ -41,11 +41,8 @@
|
||||
|
||||
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||
target:self
|
||||
action:@selector(dismissAction:)];
|
||||
|
||||
[self updateCancelButton];
|
||||
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
|
||||
target:self
|
||||
@ -60,6 +57,23 @@
|
||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
||||
}
|
||||
|
||||
- (void)setShowsCancelButton:(BOOL)showsCancelButton {
|
||||
if(_showsCancelButton != showsCancelButton) {
|
||||
_showsCancelButton = showsCancelButton;
|
||||
[self updateCancelButton];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) updateCancelButton {
|
||||
if(self.showsCancelButton) {
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||
target:self
|
||||
action:@selector(dismissAction:)];
|
||||
} else {
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UIViewController Rotation
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
|
||||
|
Loading…
x
Reference in New Issue
Block a user