diff --git a/Riot/Modules/Authentication/AuthenticationViewController.m b/Riot/Modules/Authentication/AuthenticationViewController.m index c3b939335..4efb30d30 100644 --- a/Riot/Modules/Authentication/AuthenticationViewController.m +++ b/Riot/Modules/Authentication/AuthenticationViewController.m @@ -143,21 +143,18 @@ self.authenticationScrollView.backgroundColor = ThemeService.shared.theme.backgroundColor; self.authFallbackContentView.backgroundColor = ThemeService.shared.theme.backgroundColor; - - if (ThemeService.shared.theme.placeholderTextColor) + + if (self.homeServerTextField.placeholder) { - if (self.homeServerTextField.placeholder) - { - self.homeServerTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.homeServerTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - if (self.identityServerTextField.placeholder) - { - self.identityServerTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.identityServerTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + self.homeServerTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.homeServerTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + } + if (self.identityServerTextField.placeholder) + { + self.identityServerTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.identityServerTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; } self.submitButton.backgroundColor = ThemeService.shared.theme.tintColor; diff --git a/Riot/Modules/Authentication/Views/AuthInputsView.m b/Riot/Modules/Authentication/Views/AuthInputsView.m index 6f024caff..c8b11a933 100644 --- a/Riot/Modules/Authentication/Views/AuthInputsView.m +++ b/Riot/Modules/Authentication/Views/AuthInputsView.m @@ -71,12 +71,9 @@ self.userLoginTextField.placeholder = NSLocalizedStringFromTable(@"auth_user_id_placeholder", @"Vector", nil); self.repeatPasswordTextField.placeholder = NSLocalizedStringFromTable(@"auth_repeat_password_placeholder", @"Vector", nil); self.passWordTextField.placeholder = NSLocalizedStringFromTable(@"auth_password_placeholder", @"Vector", nil); - - if (ThemeService.shared.theme.placeholderTextColor) - { - // Apply placeholder color - [self customizeViewRendering]; - } + + // Apply placeholder color + [self customizeViewRendering]; } - (void)destroy @@ -115,44 +112,41 @@ self.messageLabel.textColor = ThemeService.shared.theme.textSecondaryColor; self.messageLabel.numberOfLines = 0; - - if (ThemeService.shared.theme.placeholderTextColor) + + if (self.userLoginTextField.placeholder) { - if (self.userLoginTextField.placeholder) - { - self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.userLoginTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - - if (self.repeatPasswordTextField.placeholder) - { - self.repeatPasswordTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.repeatPasswordTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - - } - - if (self.passWordTextField.placeholder) - { - self.passWordTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.passWordTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - - if (self.phoneTextField.placeholder) - { - self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.phoneTextField.placeholder + self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.userLoginTextField.placeholder attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - - if (self.emailTextField.placeholder) - { - self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.emailTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + } + + if (self.repeatPasswordTextField.placeholder) + { + self.repeatPasswordTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.repeatPasswordTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + + } + + if (self.passWordTextField.placeholder) + { + self.passWordTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.passWordTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + } + + if (self.phoneTextField.placeholder) + { + self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.phoneTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + } + + if (self.emailTextField.placeholder) + { + self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.emailTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; } } @@ -195,16 +189,13 @@ self.userLoginTextField.placeholder = NSLocalizedStringFromTable(@"auth_user_id_placeholder", @"Vector", nil); self.messageLabel.text = NSLocalizedStringFromTable(@"or", @"Vector", nil); self.phoneTextField.placeholder = NSLocalizedStringFromTable(@"auth_phone_placeholder", @"Vector", nil); - - if (ThemeService.shared.theme.placeholderTextColor) - { - self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.userLoginTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.phoneTextField.placeholder + + self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.userLoginTextField.placeholder attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.phoneTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; self.userLoginContainer.hidden = NO; self.messageLabel.hidden = NO; @@ -1024,17 +1015,10 @@ if (thirdPartyIdentifiersHidden) { self.passWordTextField.returnKeyType = UIReturnKeyNext; - - if (ThemeService.shared.theme.placeholderTextColor) - { - self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:NSLocalizedStringFromTable(@"auth_user_name_placeholder", @"Vector", nil) - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - else - { - self.userLoginTextField.placeholder = NSLocalizedStringFromTable(@"auth_user_name_placeholder", @"Vector", nil); - } + + self.userLoginTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:NSLocalizedStringFromTable(@"auth_user_name_placeholder", @"Vector", nil) + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; self.userLoginContainer.hidden = NO; self.passwordContainer.hidden = NO; @@ -1057,12 +1041,9 @@ self.emailTextField.placeholder = NSLocalizedStringFromTable(@"auth_optional_email_placeholder", @"Vector", nil); } - if (ThemeService.shared.theme.placeholderTextColor) - { - self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] + self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.emailTextField.placeholder attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } self.emailContainer.hidden = NO; @@ -1085,12 +1066,9 @@ self.phoneTextField.placeholder = NSLocalizedStringFromTable(@"auth_optional_phone_placeholder", @"Vector", nil); } - if (ThemeService.shared.theme.placeholderTextColor) - { - self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.phoneTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + self.phoneTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.phoneTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; self.phoneContainer.hidden = NO; diff --git a/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m b/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m index 0da181158..6f16f2533 100644 --- a/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m +++ b/Riot/Modules/Authentication/Views/ForgotPasswordInputsView.m @@ -60,11 +60,8 @@ self.passWordTextField.placeholder = NSLocalizedStringFromTable(@"auth_new_password_placeholder", @"Vector", nil); self.repeatPasswordTextField.placeholder = NSLocalizedStringFromTable(@"auth_repeat_new_password_placeholder", @"Vector", nil); - if (ThemeService.shared.theme.placeholderTextColor) - { - // Apply placeholder color - [self customizeViewRendering]; - } + // Apply placeholder color + [self customizeViewRendering]; } - (void)destroy @@ -116,27 +113,24 @@ [self.nextStepButton.layer setCornerRadius:5]; self.nextStepButton.clipsToBounds = YES; self.nextStepButton.backgroundColor = ThemeService.shared.theme.tintColor; - - if (ThemeService.shared.theme.placeholderTextColor) + + if (self.emailTextField.placeholder) { - if (self.emailTextField.placeholder) - { - self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.emailTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - if (self.passWordTextField.placeholder) - { - self.passWordTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.passWordTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } - if (self.repeatPasswordTextField.placeholder) - { - self.repeatPasswordTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:self.repeatPasswordTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + self.emailTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.emailTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + } + if (self.passWordTextField.placeholder) + { + self.passWordTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.passWordTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; + } + if (self.repeatPasswordTextField.placeholder) + { + self.repeatPasswordTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:self.repeatPasswordTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; } } diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index 27e3b1c60..706a75f4f 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -2499,12 +2499,9 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti addAddressTextField = addAddressCell.mxkTextField; addAddressTextField.placeholder = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_details_new_address_placeholder", @"Vector", nil), self.mainSession.matrixRestClient.homeserverSuffix]; - if (ThemeService.shared.theme.placeholderTextColor) - { - addAddressTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:addAddressTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + addAddressTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:addAddressTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; addAddressTextField.userInteractionEnabled = YES; addAddressTextField.text = currentValue; addAddressTextField.textColor = ThemeService.shared.theme.textSecondaryColor; @@ -2590,12 +2587,9 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti addGroupTextField = addCommunityCell.mxkTextField; addGroupTextField.placeholder = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_details_new_flair_placeholder", @"Vector", nil), self.mainSession.matrixRestClient.homeserverSuffix]; - if (ThemeService.shared.theme.placeholderTextColor) - { - addGroupTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:addGroupTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + addGroupTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:addGroupTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; addGroupTextField.userInteractionEnabled = YES; addGroupTextField.text = currentValue; addGroupTextField.textColor = ThemeService.shared.theme.textSecondaryColor; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index d0f9798d0..18d7e3fb7 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -1526,12 +1526,9 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)(void); { newEmailCell.mxkLabel.text = nil; newEmailCell.mxkTextField.placeholder = NSLocalizedStringFromTable(@"settings_email_address_placeholder", @"Vector", nil); - if (ThemeService.shared.theme.placeholderTextColor) - { - newEmailCell.mxkTextField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:newEmailCell.mxkTextField.placeholder - attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; - } + newEmailCell.mxkTextField.attributedPlaceholder = [[NSAttributedString alloc] + initWithString:newEmailCell.mxkTextField.placeholder + attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.placeholderTextColor}]; newEmailCell.mxkTextField.text = newEmailTextField.text; newEmailCell.mxkTextField.userInteractionEnabled = YES; newEmailCell.mxkTextField.keyboardType = UIKeyboardTypeEmailAddress;