Update methods

Signed-off-by: ismailgulek <gulekismail@gmail.com>
This commit is contained in:
ismailgulek
2020-04-15 20:02:13 +03:00
parent 10c48e9634
commit 671d836bff

View File

@@ -84,6 +84,8 @@ static CGFloat const kTextFontSize = 15.0;
// Do any additional setup after loading the view.
self.title = NSLocalizedStringFromTable(@"deactivate_account_title", @"Vector", nil);
[self setupViews];
self.errorPresentation = [[MXKErrorAlertPresentation alloc] init];
[self registerThemeNotification];
@@ -128,12 +130,14 @@ static CGFloat const kTextFontSize = 15.0;
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;
[self setupStringAttributes];
[self setupViews];
[self updateStringAttributes];
[self updateNavigationBar];
[self updateDeactivateAcccountButton];
[self updateDeactivateAccountInfosLabel];
[self updateForgetMessagesInfoLabel];
}
- (void)setupStringAttributes
- (void)updateStringAttributes
{
self.normalStringAttributes = @{
NSFontAttributeName: [UIFont systemFontOfSize:kTextFontSize],
@@ -149,34 +153,31 @@ static CGFloat const kTextFontSize = 15.0;
- (void)setupViews
{
[self setupNavigationBar];
[self setupDeactivateAcccountButton];
[self setupDeactivateAccountInfosLabel];
[self setupForgetMessagesInfoLabel];
}
- (void)setupNavigationBar
{
self.navigationController.navigationBar.titleTextAttributes = @{ NSForegroundColorAttributeName: ThemeService.shared.theme.warningColor };
// Cancel bar button
UIBarButtonItem *cancelBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:UIBarButtonItemStylePlain target:self action:@selector(cancelButtonAction:)];
self.navigationItem.rightBarButtonItem = cancelBarButtonItem;
}
- (void)setupDeactivateAcccountButton
{
// Deactivate button
// Adjust button font size for small devices
self.deactivateAcccountButton.titleLabel.adjustsFontSizeToFitWidth = YES;
self.deactivateAcccountButton.titleLabel.minimumScaleFactor = 0.5;
self.deactivateAcccountButton.titleLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
self.deactivateAcccountButton.layer.masksToBounds = YES;
[self.deactivateAcccountButton setTitle:NSLocalizedStringFromTable(@"deactivate_account_validate_action", @"Vector", nil) forState:UIControlStateNormal];
}
- (void)updateNavigationBar
{
self.navigationController.navigationBar.titleTextAttributes = @{ NSForegroundColorAttributeName: ThemeService.shared.theme.warningColor };
}
- (void)updateDeactivateAcccountButton
{
self.deactivateAcccountButton.backgroundColor = ThemeService.shared.theme.tintColor;
[self.deactivateAcccountButton setTitle:NSLocalizedStringFromTable(@"deactivate_account_validate_action", @"Vector", nil) forState:UIControlStateNormal];
[self.deactivateAcccountButton setTitleColor:ThemeService.shared.theme.headerTextSecondaryColor forState:UIControlStateDisabled];
}
- (void)setupDeactivateAccountInfosLabel
- (void)updateDeactivateAccountInfosLabel
{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
@@ -193,7 +194,7 @@ static CGFloat const kTextFontSize = 15.0;
[self.deactivateAccountInfosLabel setAttributedText:attributedString];
}
- (void)setupForgetMessagesInfoLabel
- (void)updateForgetMessagesInfoLabel
{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];