fix session id label width
This commit is contained in:
parent
23508fb936
commit
6a9a5b2752
|
@ -216,8 +216,7 @@ private final class EnterPublicKeyVC : UIViewController {
|
|||
result.spacing = UIDevice.current.isIPad ? Values.iPadButtonSpacing : Values.mediumSpacing
|
||||
result.distribution = .fillEqually
|
||||
if (UIDevice.current.isIPad) {
|
||||
let margin = (UIScreen.main.bounds.width - result.spacing - Values.iPadButtonWidth * 2) / 2
|
||||
result.layoutMargins = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
|
||||
result.layoutMargins = UIEdgeInsets(top: 0, left: Values.iPadButtonContainerMargin, bottom: 0, right: Values.iPadButtonContainerMargin)
|
||||
result.isLayoutMarginsRelativeArrangement = true
|
||||
}
|
||||
return result
|
||||
|
@ -227,6 +226,8 @@ private final class EnterPublicKeyVC : UIViewController {
|
|||
override func viewDidLoad() {
|
||||
// Remove background color
|
||||
view.backgroundColor = .clear
|
||||
// User session id container
|
||||
let userPublicKeyContainer = UIView(wrapping: userPublicKeyLabel, withInsets: .zero, shouldAdaptForIPadWithWidth: Values.iPadUserSessionIdContainerWidth)
|
||||
// Explanation label
|
||||
let explanationLabel = UILabel()
|
||||
explanationLabel.textColor = Colors.text.withAlphaComponent(Values.mediumOpacity)
|
||||
|
@ -246,9 +247,9 @@ private final class EnterPublicKeyVC : UIViewController {
|
|||
let nextButton = Button(style: .prominentOutline, size: .large)
|
||||
nextButton.setTitle(NSLocalizedString("next", comment: ""), for: UIControl.State.normal)
|
||||
nextButton.addTarget(self, action: #selector(startNewDMIfPossible), for: UIControl.Event.touchUpInside)
|
||||
let nextButtonContainer = UIView(wrapping: nextButton, withInsets: UIEdgeInsets(top: 0, leading: 80, bottom: 0, trailing: 80), shouldAdaptForIPad: true)
|
||||
let nextButtonContainer = UIView(wrapping: nextButton, withInsets: UIEdgeInsets(top: 0, leading: 80, bottom: 0, trailing: 80), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Main stack view
|
||||
let mainStackView = UIStackView(arrangedSubviews: [ publicKeyTextView, UIView.spacer(withHeight: Values.smallSpacing), explanationLabel, spacer1, separator, spacer2, userPublicKeyLabel, spacer3, buttonContainer, UIView.vStretchingSpacer(), nextButtonContainer ])
|
||||
let mainStackView = UIStackView(arrangedSubviews: [ publicKeyTextView, UIView.spacer(withHeight: Values.smallSpacing), explanationLabel, spacer1, separator, spacer2, userPublicKeyContainer, spacer3, buttonContainer, UIView.vStretchingSpacer(), nextButtonContainer ])
|
||||
mainStackView.axis = .vertical
|
||||
mainStackView.alignment = .fill
|
||||
mainStackView.layoutMargins = UIEdgeInsets(top: Values.largeSpacing, left: Values.largeSpacing, bottom: Values.largeSpacing, right: Values.largeSpacing)
|
||||
|
|
|
@ -196,7 +196,7 @@ private final class RecoveryPhraseVC : UIViewController {
|
|||
continueButton.titleLabel!.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
||||
continueButton.addTarget(self, action: #selector(handleContinueButtonTapped), for: UIControl.Event.touchUpInside)
|
||||
// Continue button container
|
||||
let continueButtonContainer = UIView(wrapping: continueButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPad: true)
|
||||
let continueButtonContainer = UIView(wrapping: continueButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Top stack view
|
||||
let topStackView = UIStackView(arrangedSubviews: [ titleLabel, spacer1, explanationLabel, spacer2, mnemonicTextView ])
|
||||
topStackView.axis = .vertical
|
||||
|
|
|
@ -52,7 +52,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
|
|||
registerButton.titleLabel!.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
||||
registerButton.addTarget(self, action: #selector(register), for: UIControl.Event.touchUpInside)
|
||||
// Set up register button container
|
||||
let registerButtonContainer = UIView(wrapping: registerButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPad: true)
|
||||
let registerButtonContainer = UIView(wrapping: registerButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Set up options stack view
|
||||
let optionsStackView = UIStackView(arrangedSubviews: optionViews)
|
||||
optionsStackView.axis = .vertical
|
||||
|
|
|
@ -71,7 +71,7 @@ final class RestoreVC : BaseVC {
|
|||
restoreButton.titleLabel!.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
||||
restoreButton.addTarget(self, action: #selector(restore), for: UIControl.Event.touchUpInside)
|
||||
// Set up restore button container
|
||||
let restoreButtonContainer = UIView(wrapping: restoreButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPad: true)
|
||||
let restoreButtonContainer = UIView(wrapping: restoreButton, withInsets: UIEdgeInsets(top: 0, leading: Values.massiveSpacing, bottom: 0, trailing: Values.massiveSpacing), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Set up top stack view
|
||||
let topStackView = UIStackView(arrangedSubviews: [ titleLabel, spacer1, explanationLabel, spacer2, mnemonicTextView, spacer3, legalLabel ])
|
||||
topStackView.axis = .vertical
|
||||
|
|
|
@ -203,7 +203,7 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate,
|
|||
let nextButton = Button(style: .prominentOutline, size: .large)
|
||||
nextButton.setTitle(NSLocalizedString("next", comment: ""), for: UIControl.State.normal)
|
||||
nextButton.addTarget(self, action: #selector(joinOpenGroup), for: UIControl.Event.touchUpInside)
|
||||
let nextButtonContainer = UIView(wrapping: nextButton, withInsets: UIEdgeInsets(top: 0, leading: 80, bottom: 0, trailing: 80), shouldAdaptForIPad: true)
|
||||
let nextButtonContainer = UIView(wrapping: nextButton, withInsets: UIEdgeInsets(top: 0, leading: 80, bottom: 0, trailing: 80), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Stack view
|
||||
let stackView = UIStackView(arrangedSubviews: [ urlTextView, UIView.spacer(withHeight: Values.mediumSpacing), suggestionGridTitleLabel,
|
||||
UIView.spacer(withHeight: Values.mediumSpacing), suggestionGrid, UIView.vStretchingSpacer(), nextButtonContainer ])
|
||||
|
|
|
@ -67,7 +67,7 @@ final class PathVC : BaseVC {
|
|||
spinner.center(in: pathStackViewContainer)
|
||||
// Set up rebuild path button
|
||||
let inset: CGFloat = isIPhone5OrSmaller ? 64 : 80
|
||||
let learnMoreButtonContainer = UIView(wrapping: learnMoreButton, withInsets: UIEdgeInsets(top: 0, leading: inset, bottom: 0, trailing: inset), shouldAdaptForIPad: true)
|
||||
let learnMoreButtonContainer = UIView(wrapping: learnMoreButton, withInsets: UIEdgeInsets(top: 0, leading: inset, bottom: 0, trailing: inset), shouldAdaptForIPadWithWidth: Values.iPadButtonWidth)
|
||||
// Set up spacers
|
||||
let topSpacer = UIView.vStretchingSpacer()
|
||||
let bottomSpacer = UIView.vStretchingSpacer()
|
||||
|
|
|
@ -176,12 +176,13 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
buttonContainer.spacing = UIDevice.current.isIPad ? Values.iPadButtonSpacing : Values.mediumSpacing
|
||||
buttonContainer.distribution = .fillEqually
|
||||
if (UIDevice.current.isIPad) {
|
||||
let margin = (UIScreen.main.bounds.width - buttonContainer.spacing - Values.iPadButtonWidth * 2) / 2
|
||||
buttonContainer.layoutMargins = UIEdgeInsets(top: 0, left: margin, bottom: 0, right: margin)
|
||||
buttonContainer.layoutMargins = UIEdgeInsets(top: 0, left: Values.iPadButtonContainerMargin, bottom: 0, right: Values.iPadButtonContainerMargin)
|
||||
buttonContainer.isLayoutMarginsRelativeArrangement = true
|
||||
}
|
||||
// User session id container
|
||||
let userPublicKeyContainer = UIView(wrapping: publicKeyLabel, withInsets: .zero, shouldAdaptForIPadWithWidth: Values.iPadUserSessionIdContainerWidth)
|
||||
// Top stack view
|
||||
let topStackView = UIStackView(arrangedSubviews: [ headerStackView, separator, publicKeyLabel, buttonContainer ])
|
||||
let topStackView = UIStackView(arrangedSubviews: [ headerStackView, separator, userPublicKeyContainer, buttonContainer ])
|
||||
topStackView.axis = .vertical
|
||||
topStackView.spacing = Values.largeSpacing
|
||||
topStackView.alignment = .fill
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
extension UIView {
|
||||
|
||||
convenience init(wrapping view: UIView, withInsets insets: UIEdgeInsets, shouldAdaptForIPad: Bool = false) {
|
||||
convenience init(wrapping view: UIView, withInsets insets: UIEdgeInsets, shouldAdaptForIPadWithWidth width: CGFloat? = nil) {
|
||||
self.init()
|
||||
addSubview(view)
|
||||
if UIDevice.current.isIPad && shouldAdaptForIPad {
|
||||
view.set(.width, to: Values.iPadButtonWidth)
|
||||
if UIDevice.current.isIPad, let width = width {
|
||||
view.set(.width, to: width)
|
||||
view.center(in: self)
|
||||
} else {
|
||||
view.pin(.leading, to: .leading, of: self, withInset: insets.left)
|
||||
|
|
|
@ -47,4 +47,6 @@ public final class Values : NSObject {
|
|||
@objc public static let iPadModalWidth = UIScreen.main.bounds.width / 2
|
||||
@objc public static let iPadButtonWidth = CGFloat(196)
|
||||
@objc public static let iPadButtonSpacing = CGFloat(32)
|
||||
@objc public static let iPadUserSessionIdContainerWidth = CGFloat(424) // iPadButtonWidth * 2 + iPadButtonSpacing
|
||||
@objc public static let iPadButtonContainerMargin = UIScreen.main.bounds.width / 2 - 236 // ScreenWidth / 2 - iPadButtonSpacing / 2 - iPadButtonWidth - largeSpacing
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue