Merge pull request #3107 from vector-im/riot_2993

DeactivateAccountViewController theme, fixes #2993
This commit is contained in:
ismailgulek
2020-04-16 11:23:43 +03:00
committed by GitHub
4 changed files with 33 additions and 26 deletions
@@ -84,17 +84,18 @@ 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 setupStringAttributes];
[self setupViews];
[self userInterfaceThemeDidChange];
[self registerThemeNotification];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self userInterfaceThemeDidChange];
// Screen tracking
[[Analytics sharedInstance] trackScreen:@"DeactivateAccount"];
@@ -126,9 +127,17 @@ static CGFloat const kTextFontSize = 15.0;
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar];
self.activityIndicator.backgroundColor = ThemeService.shared.theme.overlayBackgroundColor;
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;
[self updateStringAttributes];
[self updateNavigationBar];
[self updateDeactivateAcccountButton];
[self updateDeactivateAccountInfosLabel];
[self updateForgetMessagesInfoLabel];
}
- (void)setupStringAttributes
- (void)updateStringAttributes
{
self.normalStringAttributes = @{
NSFontAttributeName: [UIFont systemFontOfSize:kTextFontSize],
@@ -144,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];
@@ -188,7 +194,7 @@ static CGFloat const kTextFontSize = 15.0;
[self.deactivateAccountInfosLabel setAttributedText:attributedString];
}
- (void)setupForgetMessagesInfoLabel
- (void)updateForgetMessagesInfoLabel
{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="IHf-2R-Nmh">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="IHf-2R-Nmh">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -57,7 +56,7 @@ Message visibility in Matrix is similar to email. Our forgetting your messages m
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7fz-Dy-5pc">
<rect key="frame" x="83" y="586" width="208" height="30"/>
<rect key="frame" x="83.5" y="586" width="208" height="30"/>
<color key="backgroundColor" red="0.028153735480000001" green="0.82494870580000002" blue="0.051896891280000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="AuthenticationVCLoginButton"/>
<constraints>
@@ -93,6 +92,7 @@ Message visibility in Matrix is similar to email. Our forgetting your messages m
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="r6I-6D-FLD" secondAttribute="trailing" id="Cv8-1O-u62"/>
<constraint firstItem="r6I-6D-FLD" firstAttribute="width" secondItem="OSw-nj-Wdk" secondAttribute="width" id="LbL-Rk-YWQ"/>
@@ -3730,7 +3730,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate>
{
DeactivateAccountViewController *deactivateAccountViewController = [DeactivateAccountViewController instantiateWithMatrixSession:self.mainSession];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:deactivateAccountViewController];
UINavigationController *navigationController = [[RiotNavigationController alloc] initWithRootViewController:deactivateAccountViewController];
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navigationController animated:YES completion:nil];