mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Make phone code input field wider
This commit is contained in:
@@ -10,7 +10,7 @@ import PhoneInputNode
|
||||
import CountrySelectionUI
|
||||
|
||||
private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
|
||||
return generateImage(CGSize(width: 45.0, height: 44.0 + 6.0), rotatedContext: { size, context in
|
||||
return generateImage(CGSize(width: 59, height: 44.0 + 6.0), rotatedContext: { size, context in
|
||||
let arrowSize: CGFloat = 6.0
|
||||
let lineWidth = UIScreenPixel
|
||||
|
||||
@@ -37,11 +37,11 @@ private func generateCountryButtonBackground(color: UIColor, strokeColor: UIColo
|
||||
context.move(to: CGPoint(x: 0.0, y: lineWidth / 2.0))
|
||||
context.addLine(to: CGPoint(x: size.width, y: lineWidth / 2.0))
|
||||
context.strokePath()
|
||||
})?.stretchableImage(withLeftCapWidth: 46, topCapHeight: 1)
|
||||
})?.stretchableImage(withLeftCapWidth: 58, topCapHeight: 1)
|
||||
}
|
||||
|
||||
private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIImage? {
|
||||
return generateImage(CGSize(width: 45.0, height: 44.0 + 6.0), rotatedContext: { size, context in
|
||||
return generateImage(CGSize(width: 59.0, height: 44.0 + 6.0), rotatedContext: { size, context in
|
||||
let arrowSize: CGFloat = 6.0
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(color.cgColor)
|
||||
@@ -52,11 +52,11 @@ private func generateCountryButtonHighlightedBackground(color: UIColor) -> UIIma
|
||||
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize))
|
||||
context.closePath()
|
||||
context.fillPath()
|
||||
})?.stretchableImage(withLeftCapWidth: 46, topCapHeight: 2)
|
||||
})?.stretchableImage(withLeftCapWidth: 58, topCapHeight: 2)
|
||||
}
|
||||
|
||||
private func generatePhoneInputBackground(color: UIColor, strokeColor: UIColor) -> UIImage? {
|
||||
return generateImage(CGSize(width: 60.0, height: 44.0), rotatedContext: { size, context in
|
||||
return generateImage(CGSize(width: 82.0, height: 44.0), rotatedContext: { size, context in
|
||||
let lineWidth = UIScreenPixel
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(color.cgColor)
|
||||
@@ -69,7 +69,7 @@ private func generatePhoneInputBackground(color: UIColor, strokeColor: UIColor)
|
||||
context.move(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: size.height - lineWidth / 2.0))
|
||||
context.addLine(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: 0.0))
|
||||
context.strokePath()
|
||||
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 2)
|
||||
})?.stretchableImage(withLeftCapWidth: 81, topCapHeight: 2)
|
||||
}
|
||||
|
||||
final class ChangePhoneNumberControllerNode: ASDisplayNode {
|
||||
@@ -261,8 +261,8 @@ final class ChangePhoneNumberControllerNode: ASDisplayNode {
|
||||
transition.updateFrame(node: self.countryButton, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight), size: CGSize(width: layout.size.width, height: 44.0 + 6.0)))
|
||||
transition.updateFrame(node: self.phoneBackground, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight + 44.0), size: CGSize(width: layout.size.width, height: 44.0)))
|
||||
|
||||
let countryCodeFrame = CGRect(origin: CGPoint(x: 9.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 45.0, height: 44.0))
|
||||
let numberFrame = CGRect(origin: CGPoint(x: 70.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: layout.size.width - 70.0 - 8.0, height: 44.0))
|
||||
let countryCodeFrame = CGRect(origin: CGPoint(x: 9.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: 67.0, height: 44.0))
|
||||
let numberFrame = CGRect(origin: CGPoint(x: 92.0, y: navigationHeight + 44.0 + 1.0), size: CGSize(width: layout.size.width - 70.0 - 8.0, height: 44.0))
|
||||
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 8.0)
|
||||
|
||||
let phoneInputFrame = countryCodeFrame.union(numberFrame)
|
||||
|
||||
@@ -27,7 +27,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
|
||||
init(strings: PresentationStrings, theme: PresentationTheme) {
|
||||
self.strings = strings
|
||||
|
||||
let countryButtonBackground = generateImage(CGSize(width: 61.0, height: 67.0), rotatedContext: { size, context in
|
||||
let countryButtonBackground = generateImage(CGSize(width: 68.0, height: 67.0), rotatedContext: { size, context in
|
||||
let arrowSize: CGFloat = 10.0
|
||||
let lineWidth = UIScreenPixel
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
@@ -43,9 +43,9 @@ private final class PhoneAndCountryNode: ASDisplayNode {
|
||||
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize - lineWidth / 2.0))
|
||||
context.addLine(to: CGPoint(x: 15.0, y: size.height - arrowSize - lineWidth / 2.0))
|
||||
context.strokePath()
|
||||
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 1)
|
||||
})?.stretchableImage(withLeftCapWidth: 67, topCapHeight: 1)
|
||||
|
||||
let countryButtonHighlightedBackground = generateImage(CGSize(width: 60.0, height: 67.0), rotatedContext: { size, context in
|
||||
let countryButtonHighlightedBackground = generateImage(CGSize(width: 68.0, height: 67.0), rotatedContext: { size, context in
|
||||
let arrowSize: CGFloat = 10.0
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(theme.list.itemHighlightedBackgroundColor.cgColor)
|
||||
@@ -56,9 +56,9 @@ private final class PhoneAndCountryNode: ASDisplayNode {
|
||||
context.addLine(to: CGPoint(x: size.width - 1.0 - arrowSize - arrowSize, y: size.height - arrowSize))
|
||||
context.closePath()
|
||||
context.fillPath()
|
||||
})?.stretchableImage(withLeftCapWidth: 61, topCapHeight: 2)
|
||||
})?.stretchableImage(withLeftCapWidth: 67, topCapHeight: 2)
|
||||
|
||||
let phoneInputBackground = generateImage(CGSize(width: 85.0, height: 57.0), rotatedContext: { size, context in
|
||||
let phoneInputBackground = generateImage(CGSize(width: 96.0, height: 57.0), rotatedContext: { size, context in
|
||||
let lineWidth = UIScreenPixel
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setStrokeColor(theme.list.itemPlainSeparatorColor.cgColor)
|
||||
@@ -69,7 +69,7 @@ private final class PhoneAndCountryNode: ASDisplayNode {
|
||||
context.move(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: size.height - lineWidth / 2.0))
|
||||
context.addLine(to: CGPoint(x: size.width - 2.0 + lineWidth / 2.0, y: 0.0))
|
||||
context.strokePath()
|
||||
})?.stretchableImage(withLeftCapWidth: 84, topCapHeight: 2)
|
||||
})?.stretchableImage(withLeftCapWidth: 95, topCapHeight: 2)
|
||||
|
||||
self.countryButton = ASButtonNode()
|
||||
self.countryButton.displaysAsynchronously = false
|
||||
@@ -190,8 +190,8 @@ private final class PhoneAndCountryNode: ASDisplayNode {
|
||||
self.countryButton.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 67.0))
|
||||
self.phoneBackground.frame = CGRect(origin: CGPoint(x: 0.0, y: size.height - 57.0), size: CGSize(width: size.width, height: 57.0))
|
||||
|
||||
let countryCodeFrame = CGRect(origin: CGPoint(x: 18.0, y: size.height - 57.0), size: CGSize(width: 60.0, height: 57.0))
|
||||
let numberFrame = CGRect(origin: CGPoint(x: 96.0, y: size.height - 57.0), size: CGSize(width: size.width - 96.0 - 8.0, height: 57.0))
|
||||
let countryCodeFrame = CGRect(origin: CGPoint(x: 18.0, y: size.height - 57.0), size: CGSize(width: 71.0, height: 57.0))
|
||||
let numberFrame = CGRect(origin: CGPoint(x: 107.0, y: size.height - 57.0), size: CGSize(width: size.width - 96.0 - 8.0, height: 57.0))
|
||||
let placeholderFrame = numberFrame.offsetBy(dx: -1.0, dy: 16.0)
|
||||
|
||||
let phoneInputFrame = countryCodeFrame.union(numberFrame)
|
||||
|
||||
Reference in New Issue
Block a user