mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-19 13:14:09 +01:00
1 parent
df95ba566c
commit
534cabe35b
3278 files changed
+472914
-130130
No files matched your search
+38
-18
@@ -514,9 +514,22 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
layout = layout.withUpdatedInputHeight(previousInputHeight)
|
||||
}
|
||||
|
||||
let maximumWidth: CGFloat = min(430.0, layout.size.width)
|
||||
// iPhone Duo: beside a side strip the content keeps to the band between the side insets. With equal
|
||||
// insets (every other phone) it keeps the full width.
|
||||
let insetsDiffer = layout.safeInsets.left != layout.safeInsets.right
|
||||
let bandMinX: CGFloat = insetsDiffer ? layout.safeInsets.left : 0.0
|
||||
let bandWidth: CGFloat = insetsDiffer ? layout.size.width - layout.safeInsets.left - layout.safeInsets.right : layout.size.width
|
||||
|
||||
let maximumWidth: CGFloat = min(430.0, bandWidth)
|
||||
let inset: CGFloat = 24.0
|
||||
|
||||
// The bottom buttons (and the divider above Sign in with Apple) span iPhone Duo's side strip; they keep clear
|
||||
// only of a corner block at the bottom.
|
||||
let bottomSideInsets = layout.bottomEdgeSideInsets()
|
||||
let bottomBandMinX: CGFloat = insetsDiffer ? bottomSideInsets.left : 0.0
|
||||
let bottomBandWidth: CGFloat = insetsDiffer ? layout.size.width - bottomSideInsets.left - bottomSideInsets.right : layout.size.width
|
||||
let bottomMaximumWidth: CGFloat = min(430.0, bottomBandWidth)
|
||||
|
||||
var insets = layout.insets(options: [])
|
||||
insets.top = layout.statusBarHeight ?? 20.0
|
||||
|
||||
@@ -582,8 +595,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
let currentOptionInfoSize = self.currentOptionInfoNode.measure(CGSize(width: maximumWidth - 48.0, height: CGFloat.greatestFiniteMagnitude))
|
||||
let nextOptionSize = self.nextOptionTitleNode.updateLayout(CGSize(width: maximumWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||
|
||||
let proceedHeight = self.proceedNode.updateLayout(width: maximumWidth - inset * 2.0, transition: transition)
|
||||
let proceedSize = CGSize(width: maximumWidth - inset * 2.0, height: proceedHeight)
|
||||
let proceedHeight = self.proceedNode.updateLayout(width: bottomMaximumWidth - inset * 2.0, transition: transition)
|
||||
let proceedSize = CGSize(width: bottomMaximumWidth - inset * 2.0, height: proceedHeight)
|
||||
|
||||
let codeLength: Int
|
||||
var codePrefix: String = ""
|
||||
@@ -750,7 +763,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
let inset: CGFloat = 24.0
|
||||
if case .fragment = codeType {
|
||||
self.proceedNode.isHidden = false
|
||||
let buttonFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - proceedSize.width) / 2.0), y: layout.size.height - insets.bottom - proceedSize.height - inset), size: proceedSize)
|
||||
let buttonFrame = CGRect(origin: CGPoint(x: bottomBandMinX + floorToScreenPixels((bottomBandWidth - proceedSize.width) / 2.0), y: layout.size.height - insets.bottom - proceedSize.height - inset), size: proceedSize)
|
||||
transition.updateFrame(node: self.proceedNode, frame: buttonFrame)
|
||||
} else if self.appleSignInAllowed, let signInWithAppleButton = self.signInWithAppleButton {
|
||||
additionalBottomInset = 80.0
|
||||
@@ -759,11 +772,11 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
signInWithAppleButton.isHidden = false
|
||||
self.proceedNode.isHidden = true
|
||||
|
||||
let buttonSize = CGSize(width: layout.size.width - inset * 2.0, height: 50.0)
|
||||
transition.updateFrame(view: signInWithAppleButton, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - buttonSize.width) / 2.0), y: layout.size.height - insets.bottom - buttonSize.height - inset), size: buttonSize))
|
||||
let buttonSize = CGSize(width: bottomBandWidth - inset * 2.0, height: 50.0)
|
||||
transition.updateFrame(view: signInWithAppleButton, frame: CGRect(origin: CGPoint(x: bottomBandMinX + floorToScreenPixels((bottomBandWidth - buttonSize.width) / 2.0), y: layout.size.height - insets.bottom - buttonSize.height - inset), size: buttonSize))
|
||||
|
||||
let dividerSize = self.dividerNode.updateLayout(width: layout.size.width)
|
||||
transition.updateFrame(node: self.dividerNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - dividerSize.width) / 2.0), y: layout.size.height - insets.bottom - buttonSize.height - inset - dividerSize.height), size: dividerSize))
|
||||
let dividerSize = self.dividerNode.updateLayout(width: bottomBandWidth)
|
||||
transition.updateFrame(node: self.dividerNode, frame: CGRect(origin: CGPoint(x: bottomBandMinX + floorToScreenPixels((bottomBandWidth - dividerSize.width) / 2.0), y: layout.size.height - insets.bottom - buttonSize.height - inset - dividerSize.height), size: dividerSize))
|
||||
} else {
|
||||
self.signInWithAppleButton?.isHidden = true
|
||||
self.dividerNode.isHidden = true
|
||||
@@ -780,7 +793,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
self.proceedNode.isHidden = true
|
||||
}
|
||||
|
||||
let buttonFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - proceedSize.width) / 2.0), y: layout.size.height - insets.bottom - proceedSize.height - inset), size: proceedSize)
|
||||
let buttonFrame = CGRect(origin: CGPoint(x: bottomBandMinX + floorToScreenPixels((bottomBandWidth - proceedSize.width) / 2.0), y: layout.size.height - insets.bottom - proceedSize.height - inset), size: proceedSize)
|
||||
transition.updateFrame(node: self.proceedNode, frame: buttonFrame)
|
||||
case .email:
|
||||
self.nextOptionButtonNode.isHidden = true
|
||||
@@ -802,7 +815,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
items.append(AuthorizationLayoutItem(node: self.nextOptionButtonNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||
}
|
||||
|
||||
let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: layout.size.height - insets.top - insets.bottom - additionalBottomInset)), items: items, transition: transition, failIfDoesNotFit: false)
|
||||
let _ = layoutAuthorizationItems(bounds: CGRect(origin: CGPoint(x: bandMinX, y: insets.top), size: CGSize(width: bandWidth, height: layout.size.height - insets.top - insets.bottom - additionalBottomInset)), items: items, transition: transition, failIfDoesNotFit: false)
|
||||
|
||||
if let codeType = self.codeType {
|
||||
let yOffset: CGFloat = layout.size.width > 320.0 ? 18.0 : 5.0
|
||||
@@ -829,8 +842,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
originY = self.textField.frame.maxY
|
||||
}
|
||||
|
||||
let hintTextSize = self.hintTextNode.updateLayout(CGSize(width: layout.size.width - 48.0, height: .greatestFiniteMagnitude))
|
||||
transition.updateFrame(node: self.hintButtonNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - hintTextSize.width) / 2.0), y: originY + yOffset), size: hintTextSize))
|
||||
let hintTextSize = self.hintTextNode.updateLayout(CGSize(width: bandWidth - 48.0, height: .greatestFiniteMagnitude))
|
||||
transition.updateFrame(node: self.hintButtonNode, frame: CGRect(origin: CGPoint(x: bandMinX + floorToScreenPixels((bandWidth - hintTextSize.width) / 2.0), y: originY + yOffset), size: hintTextSize))
|
||||
self.hintTextNode.frame = CGRect(origin: .zero, size: hintTextSize)
|
||||
|
||||
if let icon = self.hintArrowNode.image {
|
||||
@@ -845,15 +858,16 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
|
||||
self.hintTextNode.attributedText = NSAttributedString(string: self.strings.Login_EnterPhraseHint, font: Font.regular(13.0), textColor: self.theme.list.itemSecondaryTextColor, paragraphAlignment: .center)
|
||||
|
||||
let hintTextSize = self.hintTextNode.updateLayout(CGSize(width: layout.size.width - 48.0, height: .greatestFiniteMagnitude))
|
||||
transition.updateFrame(node: self.hintButtonNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - hintTextSize.width) / 2.0), y: self.textField.frame.maxY + yOffset), size: hintTextSize))
|
||||
let hintTextSize = self.hintTextNode.updateLayout(CGSize(width: bandWidth - 48.0, height: .greatestFiniteMagnitude))
|
||||
transition.updateFrame(node: self.hintButtonNode, frame: CGRect(origin: CGPoint(x: bandMinX + floorToScreenPixels((bandWidth - hintTextSize.width) / 2.0), y: self.textField.frame.maxY + yOffset), size: hintTextSize))
|
||||
self.hintTextNode.frame = CGRect(origin: .zero, size: hintTextSize)
|
||||
|
||||
let pasteSize = self.pasteButton.measure(layout.size)
|
||||
let pasteButtonSize = CGSize(width: pasteSize.width + 16.0, height: 24.0)
|
||||
let pasteOriginX: CGFloat
|
||||
if case .compact = layout.metrics.widthClass {
|
||||
pasteOriginX = layout.size.width - 40.0 - pasteButtonSize.width
|
||||
// iPhone Duo: clear of the side strip, like the field it sits on.
|
||||
pasteOriginX = bandMinX + bandWidth - 40.0 - pasteButtonSize.width
|
||||
} else {
|
||||
pasteOriginX = self.textField.frame.maxX + 32.0
|
||||
}
|
||||
@@ -866,7 +880,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
|
||||
let pasteSize = self.pasteButton.measure(layout.size)
|
||||
let pasteButtonSize = CGSize(width: pasteSize.width + 16.0, height: 24.0)
|
||||
transition.updateFrame(node: self.pasteButton, frame: CGRect(origin: CGPoint(x: layout.size.width - 40.0 - pasteButtonSize.width, y: self.textField.frame.midY - pasteButtonSize.height / 2.0), size: pasteButtonSize))
|
||||
// iPhone Duo: clear of the side strip, like the field it sits on.
|
||||
transition.updateFrame(node: self.pasteButton, frame: CGRect(origin: CGPoint(x: bandMinX + bandWidth - 40.0 - pasteButtonSize.width, y: self.textField.frame.midY - pasteButtonSize.height / 2.0), size: pasteButtonSize))
|
||||
} else {
|
||||
self.hintButtonNode.alpha = 0.0
|
||||
self.hintButtonNode.isUserInteractionEnabled = false
|
||||
@@ -943,9 +958,14 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
self.errorTextNode.attributedText = NSAttributedString(string: text, font: Font.regular(13.0), textColor: self.theme.list.itemDestructiveColor, paragraphAlignment: .center)
|
||||
|
||||
if let (layout, _) = self.layoutArguments {
|
||||
let errorTextSize = self.errorTextNode.updateLayout(CGSize(width: layout.size.width - 48.0, height: .greatestFiniteMagnitude))
|
||||
// iPhone Duo: centered under the field in the band between the side insets, as containerLayoutUpdated lays it out.
|
||||
let insetsDiffer = layout.safeInsets.left != layout.safeInsets.right
|
||||
let bandMinX: CGFloat = insetsDiffer ? layout.safeInsets.left : 0.0
|
||||
let bandWidth: CGFloat = insetsDiffer ? layout.size.width - layout.safeInsets.left - layout.safeInsets.right : layout.size.width
|
||||
|
||||
let errorTextSize = self.errorTextNode.updateLayout(CGSize(width: bandWidth - 48.0, height: .greatestFiniteMagnitude))
|
||||
let yOffset: CGFloat = layout.size.width > 320.0 ? errorOriginOffset + 13.0 : errorOriginOffset
|
||||
self.errorTextNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - errorTextSize.width) / 2.0), y: errorOriginY + yOffset), size: errorTextSize)
|
||||
self.errorTextNode.frame = CGRect(origin: CGPoint(x: bandMinX + floorToScreenPixels((bandWidth - errorTextSize.width) / 2.0), y: errorOriginY + yOffset), size: errorTextSize)
|
||||
}
|
||||
self.errorTextNode.alpha = 1.0
|
||||
self.errorTextNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15)
|
||||
|
||||
Reference in new issue
Block a user