mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Update font sizes in onboarding views.
This commit is contained in:
parent
6bc46fad66
commit
8cfe768e86
|
@ -488,9 +488,9 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
|
|||
[onboardingController
|
||||
updateWithPhoneNumber:[[OnboardingPhoneNumber alloc] initWithE164:@"+13213214321" userInput:@"3213214321"]];
|
||||
|
||||
// UIViewController *view = [onboardingController initialViewController];
|
||||
UIViewController *view =
|
||||
[[OnboardingPhoneNumberViewController alloc] initWithOnboardingController:onboardingController];
|
||||
UIViewController *view = [onboardingController initialViewController];
|
||||
// UIViewController *view =
|
||||
// [[OnboardingPermissionsViewController alloc] initWithOnboardingController:onboardingController];
|
||||
OWSNavigationController *navigationController =
|
||||
[[OWSNavigationController alloc] initWithRootViewController:view];
|
||||
[self presentViewController:navigationController animated:YES completion:nil];
|
||||
|
|
|
@ -31,7 +31,7 @@ public class OnboardingBaseViewController: OWSViewController {
|
|||
let titleLabel = UILabel()
|
||||
titleLabel.text = text
|
||||
titleLabel.textColor = Theme.primaryColor
|
||||
titleLabel.font = UIFont.ows_dynamicTypeTitle1.ows_mediumWeight()
|
||||
titleLabel.font = UIFont.ows_dynamicTypeTitle1Clamped.ows_mediumWeight()
|
||||
titleLabel.numberOfLines = 0
|
||||
titleLabel.lineBreakMode = .byWordWrapping
|
||||
titleLabel.textAlignment = .center
|
||||
|
@ -41,7 +41,7 @@ public class OnboardingBaseViewController: OWSViewController {
|
|||
func explanationLabel(explanationText: String) -> UILabel {
|
||||
let explanationLabel = UILabel()
|
||||
explanationLabel.textColor = Theme.secondaryColor
|
||||
explanationLabel.font = UIFont.ows_dynamicTypeCaption1
|
||||
explanationLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
|
||||
explanationLabel.text = explanationText
|
||||
explanationLabel.numberOfLines = 0
|
||||
explanationLabel.textAlignment = .center
|
||||
|
@ -51,9 +51,11 @@ public class OnboardingBaseViewController: OWSViewController {
|
|||
|
||||
func button(title: String, selector: Selector) -> OWSFlatButton {
|
||||
// TODO: Make sure this all fits if dynamic font sizes are maxed out.
|
||||
let buttonHeight: CGFloat = 48
|
||||
let font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
|
||||
// Button height should be 48pt if the font is 17pt.
|
||||
let buttonHeight = font.pointSize * 48 / 17
|
||||
let button = OWSFlatButton.button(title: title,
|
||||
font: OWSFlatButton.fontForHeight(buttonHeight),
|
||||
font: font,
|
||||
titleColor: .white,
|
||||
backgroundColor: .ows_materialBlue,
|
||||
target: self,
|
||||
|
@ -64,9 +66,11 @@ public class OnboardingBaseViewController: OWSViewController {
|
|||
|
||||
func linkButton(title: String, selector: Selector) -> OWSFlatButton {
|
||||
// TODO: Make sure this all fits if dynamic font sizes are maxed out.
|
||||
let buttonHeight: CGFloat = 48
|
||||
let font = UIFont.ows_dynamicTypeBodyClamped.ows_mediumWeight()
|
||||
// Button height should be 48pt if the font is 17pt.
|
||||
let buttonHeight = font.pointSize * 48 / 17
|
||||
let button = OWSFlatButton.button(title: title,
|
||||
font: OWSFlatButton.fontForHeight(buttonHeight),
|
||||
font: font,
|
||||
titleColor: .ows_materialBlue,
|
||||
backgroundColor: .white,
|
||||
target: self,
|
||||
|
|
|
@ -23,7 +23,6 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
|
|||
|
||||
let explanationLabel = self.explanationLabel(explanationText: NSLocalizedString("ONBOARDING_PERMISSIONS_EXPLANATION",
|
||||
comment: "Explanation in the 'onboarding permissions' view."))
|
||||
explanationLabel.setCompressionResistanceVerticalLow()
|
||||
|
||||
// TODO: Make sure this all fits if dynamic font sizes are maxed out.
|
||||
let giveAccessButton = self.button(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON",
|
||||
|
|
|
@ -36,7 +36,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
|
|||
let rowHeight: CGFloat = 40
|
||||
|
||||
countryNameLabel.textColor = Theme.primaryColor
|
||||
countryNameLabel.font = UIFont.ows_dynamicTypeBody
|
||||
countryNameLabel.font = UIFont.ows_dynamicTypeBodyClamped
|
||||
countryNameLabel.setContentHuggingHorizontalLow()
|
||||
countryNameLabel.setCompressionResistanceHorizontalLow()
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
|
|||
addBottomStroke(countryRow)
|
||||
|
||||
callingCodeLabel.textColor = Theme.primaryColor
|
||||
callingCodeLabel.font = UIFont.ows_dynamicTypeBody
|
||||
callingCodeLabel.font = UIFont.ows_dynamicTypeBodyClamped
|
||||
callingCodeLabel.setContentHuggingHorizontalHigh()
|
||||
callingCodeLabel.setCompressionResistanceHorizontalHigh()
|
||||
callingCodeLabel.isUserInteractionEnabled = true
|
||||
|
@ -73,7 +73,7 @@ public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
|
|||
phoneNumberTextField.delegate = self
|
||||
phoneNumberTextField.keyboardType = .numberPad
|
||||
phoneNumberTextField.textColor = Theme.primaryColor
|
||||
phoneNumberTextField.font = UIFont.ows_dynamicTypeBody
|
||||
phoneNumberTextField.font = UIFont.ows_dynamicTypeBodyClamped
|
||||
phoneNumberTextField.setContentHuggingHorizontalLow()
|
||||
phoneNumberTextField.setCompressionResistanceHorizontalLow()
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
|
|||
explanationLabel.text = NSLocalizedString("ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY",
|
||||
comment: "Link to the 'terms and privacy policy' in the 'onboarding splash' view.")
|
||||
explanationLabel.textColor = .ows_materialBlue
|
||||
explanationLabel.font = UIFont.ows_dynamicTypeCaption1
|
||||
explanationLabel.font = UIFont.ows_dynamicTypeSubheadlineClamped
|
||||
explanationLabel.numberOfLines = 0
|
||||
explanationLabel.textAlignment = .center
|
||||
explanationLabel.lineBreakMode = .byWordWrapping
|
||||
|
|
|
@ -1512,7 +1512,7 @@
|
|||
"ONBOARDING_CAPTCHA_TITLE" = "We need to verify that you're human";
|
||||
|
||||
/* Explanation in the 'onboarding permissions' view. */
|
||||
"ONBOARDING_PERMISSIONS_EXPLANATION" = "Allowing Signal to send you notifications and access your contacts makes it easier to communicate with your friends. Your contact information is always transmitted securely.";
|
||||
"ONBOARDING_PERMISSIONS_EXPLANATION" = "Your contact information is always transmitted securely.";
|
||||
|
||||
/* Label for the 'give access' button in the 'onboarding permissions' view. */
|
||||
"ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON" = "Enable Permissions";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
@ -36,6 +36,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption1Font;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption2Font;
|
||||
|
||||
#pragma mark - Dynamic Type Clamped
|
||||
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle1ClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle2ClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeTitle3ClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeHeadlineClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeBodyClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeSubheadlineClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeFootnoteClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption1ClampedFont;
|
||||
@property (class, readonly, nonatomic) UIFont *ows_dynamicTypeCaption2ClampedFont;
|
||||
|
||||
#pragma mark - Styles
|
||||
|
||||
- (UIFont *)ows_italic;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIFont+OWS.h"
|
||||
|
@ -97,6 +97,84 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2];
|
||||
}
|
||||
|
||||
#pragma mark - Dynamic Type Clamped
|
||||
|
||||
+ (UIFont *)preferredFontForTextStyleClamped:(UIFontTextStyle)fontTextStyle
|
||||
{
|
||||
static NSDictionary<UIFontTextStyle, NSNumber *> *maxPointSizeMap = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
maxPointSizeMap = @{
|
||||
UIFontTextStyleTitle1 : @(34.0),
|
||||
UIFontTextStyleTitle2 : @(28.0),
|
||||
UIFontTextStyleTitle3 : @(26.0),
|
||||
UIFontTextStyleHeadline : @(23.0),
|
||||
UIFontTextStyleBody : @(23.0),
|
||||
UIFontTextStyleSubheadline : @(21.0),
|
||||
UIFontTextStyleFootnote : @(19.0),
|
||||
UIFontTextStyleCaption1 : @(18.0),
|
||||
UIFontTextStyleCaption2 : @(17.0),
|
||||
};
|
||||
});
|
||||
|
||||
UIFont *font = [UIFont preferredFontForTextStyle:fontTextStyle];
|
||||
NSNumber *_Nullable maxPointSize = maxPointSizeMap[fontTextStyle];
|
||||
if (maxPointSize) {
|
||||
if (maxPointSize.floatValue < font.pointSize) {
|
||||
return [font fontWithSize:maxPointSize.floatValue];
|
||||
}
|
||||
} else {
|
||||
OWSFailDebug(@"Missing max point size for style: %@", fontTextStyle);
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeTitle1ClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle1];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeTitle2ClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle2];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeTitle3ClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleTitle3];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeHeadlineClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleHeadline];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeBodyClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleBody];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeSubheadlineClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleSubheadline];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeFootnoteClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleFootnote];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeCaption1ClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleCaption1];
|
||||
}
|
||||
|
||||
+ (UIFont *)ows_dynamicTypeCaption2ClampedFont
|
||||
{
|
||||
return [UIFont preferredFontForTextStyleClamped:UIFontTextStyleCaption2];
|
||||
}
|
||||
|
||||
#pragma mark - Styles
|
||||
|
||||
- (UIFont *)ows_italic
|
||||
|
|
Loading…
Reference in a new issue