mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-10 14:35:42 +00:00
Merge branch 'beta'
# Conflicts: # Telegram/Telegram-iOS/en.lproj/Localizable.strings
This commit is contained in:
commit
edf86a93c6
@ -1 +1 @@
|
|||||||
da31f706ff299a64eb70ef55d5ac985b
|
689ecb2a0d0d76ad50bc8eec22be2951
|
||||||
|
@ -488,9 +488,6 @@ private struct NotificationContent: CustomStringConvertible {
|
|||||||
func generate() -> UNNotificationContent {
|
func generate() -> UNNotificationContent {
|
||||||
var content = UNMutableNotificationContent()
|
var content = UNMutableNotificationContent()
|
||||||
|
|
||||||
if let isLockedMessage = self.isLockedMessage {
|
|
||||||
content.body = isLockedMessage
|
|
||||||
} else {
|
|
||||||
if let title = self.title {
|
if let title = self.title {
|
||||||
content.title = title
|
content.title = title
|
||||||
}
|
}
|
||||||
@ -500,7 +497,13 @@ private struct NotificationContent: CustomStringConvertible {
|
|||||||
if let body = self.body {
|
if let body = self.body {
|
||||||
content.body = body
|
content.body = body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !content.title.isEmpty || !content.subtitle.isEmpty || !content.body.isEmpty {
|
||||||
|
if let isLockedMessage = self.isLockedMessage {
|
||||||
|
content.body = isLockedMessage
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let threadId = self.threadId {
|
if let threadId = self.threadId {
|
||||||
content.threadIdentifier = threadId
|
content.threadIdentifier = threadId
|
||||||
}
|
}
|
||||||
@ -688,7 +691,7 @@ private final class NotificationServiceHandler {
|
|||||||
guard let strongSelf = self, let recordId = recordId else {
|
guard let strongSelf = self, let recordId = recordId else {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Couldn't find a matching decryption key")
|
Logger.shared.log("NotificationService \(episode)", "Couldn't find a matching decryption key")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
|
|
||||||
@ -710,7 +713,7 @@ private final class NotificationServiceHandler {
|
|||||||
guard let stateManager = stateManager else {
|
guard let stateManager = stateManager else {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Didn't receive stateManager")
|
Logger.shared.log("NotificationService \(episode)", "Didn't receive stateManager")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
return
|
return
|
||||||
@ -720,7 +723,7 @@ private final class NotificationServiceHandler {
|
|||||||
strongSelf.notificationKeyDisposable.set((existingMasterNotificationsKey(postbox: stateManager.postbox)
|
strongSelf.notificationKeyDisposable.set((existingMasterNotificationsKey(postbox: stateManager.postbox)
|
||||||
|> deliverOn(strongSelf.queue)).start(next: { notificationsKey in
|
|> deliverOn(strongSelf.queue)).start(next: { notificationsKey in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
|
|
||||||
@ -729,7 +732,7 @@ private final class NotificationServiceHandler {
|
|||||||
guard let notificationsKey = notificationsKey else {
|
guard let notificationsKey = notificationsKey else {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Didn't receive decryption key")
|
Logger.shared.log("NotificationService \(episode)", "Didn't receive decryption key")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
|
|
||||||
@ -738,7 +741,7 @@ private final class NotificationServiceHandler {
|
|||||||
guard let decryptedPayload = decryptedNotificationPayload(key: notificationsKey, data: payloadData) else {
|
guard let decryptedPayload = decryptedNotificationPayload(key: notificationsKey, data: payloadData) else {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Couldn't decrypt payload")
|
Logger.shared.log("NotificationService \(episode)", "Couldn't decrypt payload")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
|
|
||||||
@ -747,7 +750,7 @@ private final class NotificationServiceHandler {
|
|||||||
guard let payloadJson = try? JSONSerialization.jsonObject(with: decryptedPayload, options: []) as? [String: Any] else {
|
guard let payloadJson = try? JSONSerialization.jsonObject(with: decryptedPayload, options: []) as? [String: Any] else {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Couldn't process payload as JSON")
|
Logger.shared.log("NotificationService \(episode)", "Couldn't process payload as JSON")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
|
|
||||||
@ -840,7 +843,7 @@ private final class NotificationServiceHandler {
|
|||||||
action = .logout
|
action = .logout
|
||||||
case "MESSAGE_MUTED":
|
case "MESSAGE_MUTED":
|
||||||
if let peerId = peerId {
|
if let peerId = peerId {
|
||||||
action = .poll(peerId: peerId, content: NotificationContent(isLockedMessage: isLockedMessage))
|
action = .poll(peerId: peerId, content: NotificationContent(isLockedMessage: nil))
|
||||||
}
|
}
|
||||||
case "MESSAGE_DELETED":
|
case "MESSAGE_DELETED":
|
||||||
if let peerId = peerId {
|
if let peerId = peerId {
|
||||||
@ -970,7 +973,7 @@ private final class NotificationServiceHandler {
|
|||||||
|
|
||||||
if #available(iOS 14.5, *), voiceCallSettings.enableSystemIntegration {
|
if #available(iOS 14.5, *), voiceCallSettings.enableSystemIntegration {
|
||||||
Logger.shared.log("NotificationService \(episode)", "Will report voip notification")
|
Logger.shared.log("NotificationService \(episode)", "Will report voip notification")
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
|
|
||||||
CXProvider.reportNewIncomingVoIPPushPayload(voipPayload, completion: { error in
|
CXProvider.reportNewIncomingVoIPPushPayload(voipPayload, completion: { error in
|
||||||
@ -993,7 +996,7 @@ private final class NotificationServiceHandler {
|
|||||||
case .logout:
|
case .logout:
|
||||||
Logger.shared.log("NotificationService \(episode)", "Will logout")
|
Logger.shared.log("NotificationService \(episode)", "Will logout")
|
||||||
|
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
completed()
|
completed()
|
||||||
case let .poll(peerId, initialContent):
|
case let .poll(peerId, initialContent):
|
||||||
@ -1249,7 +1252,7 @@ private final class NotificationServiceHandler {
|
|||||||
postbox: stateManager.postbox
|
postbox: stateManager.postbox
|
||||||
)
|
)
|
||||||
|> deliverOn(strongSelf.queue)).start(next: { value in
|
|> deliverOn(strongSelf.queue)).start(next: { value in
|
||||||
var content = NotificationContent(isLockedMessage: isLockedMessage)
|
var content = NotificationContent(isLockedMessage: nil)
|
||||||
if isCurrentAccount {
|
if isCurrentAccount {
|
||||||
content.badge = Int(value.0)
|
content.badge = Int(value.0)
|
||||||
}
|
}
|
||||||
@ -1298,7 +1301,7 @@ private final class NotificationServiceHandler {
|
|||||||
postbox: stateManager.postbox
|
postbox: stateManager.postbox
|
||||||
)
|
)
|
||||||
|> deliverOn(strongSelf.queue)).start(next: { value in
|
|> deliverOn(strongSelf.queue)).start(next: { value in
|
||||||
var content = NotificationContent(isLockedMessage: isLockedMessage)
|
var content = NotificationContent(isLockedMessage: nil)
|
||||||
if isCurrentAccount {
|
if isCurrentAccount {
|
||||||
content.badge = Int(value.0)
|
content.badge = Int(value.0)
|
||||||
}
|
}
|
||||||
@ -1325,7 +1328,7 @@ private final class NotificationServiceHandler {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let content = NotificationContent(isLockedMessage: isLockedMessage)
|
let content = NotificationContent(isLockedMessage: nil)
|
||||||
updateCurrentContent(content)
|
updateCurrentContent(content)
|
||||||
|
|
||||||
completed()
|
completed()
|
||||||
|
@ -364,7 +364,7 @@
|
|||||||
"Login.HaveNotReceivedCodeInternal" = "Haven't received the code?";
|
"Login.HaveNotReceivedCodeInternal" = "Haven't received the code?";
|
||||||
"Login.CodeSentSms" = "We have sent you an SMS with the code";
|
"Login.CodeSentSms" = "We have sent you an SMS with the code";
|
||||||
"Login.Code" = "Code";
|
"Login.Code" = "Code";
|
||||||
"Login.WillCallYou" = "Telegram will call you in %@";
|
"Login.WillCallYou" = "You can request a voice call in %@";
|
||||||
"Login.CallRequestState2" = "Requesting a call from Telegram...";
|
"Login.CallRequestState2" = "Requesting a call from Telegram...";
|
||||||
"Login.CallRequestState3" = "Telegram dialed your number\n[Didn't get the code?]";
|
"Login.CallRequestState3" = "Telegram dialed your number\n[Didn't get the code?]";
|
||||||
"Login.EmailNotConfiguredError" = "Please set up an email account.";
|
"Login.EmailNotConfiguredError" = "Please set up an email account.";
|
||||||
@ -2073,7 +2073,7 @@
|
|||||||
|
|
||||||
"Login.CodeSentCall" = "We are calling your phone to dictate a code.";
|
"Login.CodeSentCall" = "We are calling your phone to dictate a code.";
|
||||||
|
|
||||||
"Login.WillSendSms" = "Telegram will send you an SMS in %@";
|
"Login.WillSendSms" = "You can request an SMS in %@";
|
||||||
"Login.SmsRequestState2" = "Requesting an SMS from Telegram...";
|
"Login.SmsRequestState2" = "Requesting an SMS from Telegram...";
|
||||||
"Login.SmsRequestState3" = "Telegram sent you an SMS\n[Didn't get the code?]";
|
"Login.SmsRequestState3" = "Telegram sent you an SMS\n[Didn't get the code?]";
|
||||||
|
|
||||||
@ -3764,8 +3764,9 @@ Unused sets are archived when you add more.";
|
|||||||
|
|
||||||
"AuthCode.Alert" = "Your login code is %@. Enter it in the Telegram app where you are trying to log in.\n\nDo not give this code to anyone.";
|
"AuthCode.Alert" = "Your login code is %@. Enter it in the Telegram app where you are trying to log in.\n\nDo not give this code to anyone.";
|
||||||
"Login.CheckOtherSessionMessages" = "Check your Telegram messages";
|
"Login.CheckOtherSessionMessages" = "Check your Telegram messages";
|
||||||
"Login.SendCodeViaSms" = "Send the code as an SMS";
|
"Login.SendCodeViaSms" = "Get the code via SMS";
|
||||||
"Login.SendCodeViaCall" = "Get code on my phone";
|
"Login.SendCodeViaCall" = "Call me to dictate the code";
|
||||||
|
"Login.SendCodeViaFlashCall" = "Get the code via phone call";
|
||||||
"Login.CancelPhoneVerification" = "Do you want to stop the phone number verification process?";
|
"Login.CancelPhoneVerification" = "Do you want to stop the phone number verification process?";
|
||||||
"Login.CancelPhoneVerificationStop" = "Stop";
|
"Login.CancelPhoneVerificationStop" = "Stop";
|
||||||
"Login.CancelPhoneVerificationContinue" = "Continue";
|
"Login.CancelPhoneVerificationContinue" = "Continue";
|
||||||
@ -7121,6 +7122,7 @@ Sorry for the inconvenience.";
|
|||||||
"ForcedPasswordSetup.Intro.DismissActionCancel" = "No, let me set a password";
|
"ForcedPasswordSetup.Intro.DismissActionCancel" = "No, let me set a password";
|
||||||
"ForcedPasswordSetup.Intro.DismissActionOK" = "Yes, I’m sure";
|
"ForcedPasswordSetup.Intro.DismissActionOK" = "Yes, I’m sure";
|
||||||
|
|
||||||
|
"Login.ShortCallTitle" = "Within a few seconds you should\nreceive a short call from:";
|
||||||
"Login.CodePhonePatternInfoText" = "Please enter the last digits\nof the missed call number.";
|
"Login.CodePhonePatternInfoText" = "Please enter the last digits\nof the missed call number.";
|
||||||
"Login.EnterMissingDigits" = "Enter the missing digits";
|
"Login.EnterMissingDigits" = "Enter the missing digits";
|
||||||
|
|
||||||
@ -7141,3 +7143,5 @@ Sorry for the inconvenience.";
|
|||||||
"PeerInfo.QRCode.Title" = "QR Code";
|
"PeerInfo.QRCode.Title" = "QR Code";
|
||||||
|
|
||||||
"ChatList.Archive" = "Archive";
|
"ChatList.Archive" = "Archive";
|
||||||
|
|
||||||
|
"ChatList.Archive" = "Archive";
|
||||||
|
@ -11,6 +11,7 @@ import TelegramUIPreferences
|
|||||||
import ImageBlur
|
import ImageBlur
|
||||||
import FastBlur
|
import FastBlur
|
||||||
import AppLockState
|
import AppLockState
|
||||||
|
import PassKit
|
||||||
|
|
||||||
private func isLocked(passcodeSettings: PresentationPasscodeSettings, state: LockState, isApplicationActive: Bool) -> Bool {
|
private func isLocked(passcodeSettings: PresentationPasscodeSettings, state: LockState, isApplicationActive: Bool) -> Bool {
|
||||||
if state.isManuallyLocked {
|
if state.isManuallyLocked {
|
||||||
@ -204,6 +205,7 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
strongSelf.passcodeController = passcodeController
|
strongSelf.passcodeController = passcodeController
|
||||||
if let rootViewController = strongSelf.rootController {
|
if let rootViewController = strongSelf.rootController {
|
||||||
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
||||||
|
} else if let _ = rootViewController.presentedViewController as? PKPaymentAuthorizationViewController {
|
||||||
} else {
|
} else {
|
||||||
rootViewController.dismiss(animated: false, completion: nil)
|
rootViewController.dismiss(animated: false, completion: nil)
|
||||||
}
|
}
|
||||||
@ -228,6 +230,7 @@ public final class AppLockContextImpl: AppLockContext {
|
|||||||
|
|
||||||
if let rootViewController = strongSelf.rootController {
|
if let rootViewController = strongSelf.rootController {
|
||||||
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
if let _ = rootViewController.presentedViewController as? UIActivityViewController {
|
||||||
|
} else if let _ = rootViewController.presentedViewController as? PKPaymentAuthorizationViewController {
|
||||||
} else {
|
} else {
|
||||||
rootViewController.dismiss(animated: false, completion: nil)
|
rootViewController.dismiss(animated: false, completion: nil)
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@ public func authorizationCurrentOptionText(_ type: SentAuthorizationCodeType, st
|
|||||||
case .missedCall:
|
case .missedCall:
|
||||||
let body = MarkdownAttributeSet(font: Font.regular(16.0), textColor: primaryColor)
|
let body = MarkdownAttributeSet(font: Font.regular(16.0), textColor: primaryColor)
|
||||||
let bold = MarkdownAttributeSet(font: Font.semibold(16.0), textColor: primaryColor)
|
let bold = MarkdownAttributeSet(font: Font.semibold(16.0), textColor: primaryColor)
|
||||||
return parseMarkdownIntoAttributedString("Within a few seconds you should\nreceive a short call from:", attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil }), textAlignment: .center)
|
return parseMarkdownIntoAttributedString(strings.Login_ShortCallTitle, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil }), textAlignment: .center)
|
||||||
case .call, .flashCall:
|
case .call, .flashCall:
|
||||||
return NSAttributedString(string: strings.ChangePhoneNumberCode_Called, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
|
return NSAttributedString(string: strings.ChangePhoneNumberCode_Called, font: Font.regular(16.0), textColor: primaryColor, paragraphAlignment: .center)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func authorizationNextOptionText(currentType: SentAuthorizationCodeType, nextType: AuthorizationCodeNextType?, timeout: Int32?, strings: PresentationStrings, primaryColor: UIColor, accentColor: UIColor) -> (NSAttributedString, Bool) {
|
public func authorizationNextOptionText(currentType: SentAuthorizationCodeType, nextType: AuthorizationCodeNextType?, timeout: Int32?, strings: PresentationStrings, primaryColor: UIColor, accentColor: UIColor) -> (NSAttributedString, Bool) {
|
||||||
if let nextType = nextType, let timeout = timeout {
|
if let nextType = nextType, let timeout = timeout, timeout > 0 {
|
||||||
let minutes = timeout / 60
|
let minutes = timeout / 60
|
||||||
let seconds = timeout % 60
|
let seconds = timeout % 60
|
||||||
switch nextType {
|
switch nextType {
|
||||||
@ -48,13 +48,24 @@ public func authorizationNextOptionText(currentType: SentAuthorizationCodeType,
|
|||||||
switch nextType {
|
switch nextType {
|
||||||
case .sms:
|
case .sms:
|
||||||
return (NSAttributedString(string: strings.Login_SendCodeViaSms, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
return (NSAttributedString(string: strings.Login_SendCodeViaSms, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
case .call, .flashCall, .missedCall:
|
case .call:
|
||||||
return (NSAttributedString(string: strings.Login_SendCodeViaCall, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
return (NSAttributedString(string: strings.Login_SendCodeViaCall, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
|
case .flashCall, .missedCall:
|
||||||
|
return (NSAttributedString(string: strings.Login_SendCodeViaFlashCall, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
case .none:
|
case .none:
|
||||||
return (NSAttributedString(string: strings.Login_HaveNotReceivedCodeInternal, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
return (NSAttributedString(string: strings.Login_HaveNotReceivedCodeInternal, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
switch nextType {
|
||||||
|
case .sms:
|
||||||
|
return (NSAttributedString(string: strings.Login_SendCodeViaSms, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
|
case .call:
|
||||||
|
return (NSAttributedString(string: strings.Login_SendCodeViaCall, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
|
case .flashCall, .missedCall:
|
||||||
|
return (NSAttributedString(string: strings.Login_SendCodeViaFlashCall, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
|
case .none:
|
||||||
return (NSAttributedString(string: strings.Login_HaveNotReceivedCodeInternal, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
return (NSAttributedString(string: strings.Login_HaveNotReceivedCodeInternal, font: Font.regular(16.0), textColor: accentColor, paragraphAlignment: .center), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,9 @@ public final class CodeInputView: ASDisplayNode, UITextFieldDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.textNode.attributedText = NSAttributedString(string: text, font: Font.monospace(21.0), textColor: UIColor(argb: textColor))
|
let fontSize: CGFloat = floor(21.0 * size.height / 28.0)
|
||||||
|
|
||||||
|
self.textNode.attributedText = NSAttributedString(string: text, font: Font.monospace(fontSize), textColor: UIColor(argb: textColor))
|
||||||
let textSize = self.textNode.updateLayout(size)
|
let textSize = self.textNode.updateLayout(size)
|
||||||
self.textNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: floorToScreenPixels((size.height - textSize.height) / 2.0)), size: textSize)
|
self.textNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: floorToScreenPixels((size.height - textSize.height) / 2.0)), size: textSize)
|
||||||
|
|
||||||
@ -224,12 +226,18 @@ public final class CodeInputView: ASDisplayNode, UITextFieldDelegate {
|
|||||||
self.textField.keyboardAppearance = .light
|
self.textField.keyboardAppearance = .light
|
||||||
}
|
}
|
||||||
|
|
||||||
let height: CGFloat = 28.0
|
let height: CGFloat
|
||||||
|
if prefix.isEmpty {
|
||||||
|
height = 40.0
|
||||||
|
} else {
|
||||||
|
height = 28.0
|
||||||
|
}
|
||||||
|
|
||||||
self.prefixLabel.attributedText = NSAttributedString(string: prefix, font: Font.monospace(21.0), textColor: UIColor(argb: theme.foreground))
|
self.prefixLabel.attributedText = NSAttributedString(string: prefix, font: Font.monospace(21.0), textColor: UIColor(argb: theme.foreground))
|
||||||
let prefixSize = self.prefixLabel.updateLayout(CGSize(width: width, height: 100.0))
|
let prefixSize = self.prefixLabel.updateLayout(CGSize(width: width, height: 100.0))
|
||||||
let prefixSpacing: CGFloat = prefix.isEmpty ? 0.0 : 8.0
|
let prefixSpacing: CGFloat = prefix.isEmpty ? 0.0 : 8.0
|
||||||
|
|
||||||
let itemSize = CGSize(width: 25.0, height: height)
|
let itemSize = CGSize(width: floor(25.0 * height / 28.0), height: height)
|
||||||
let itemSpacing: CGFloat = 5.0
|
let itemSpacing: CGFloat = 5.0
|
||||||
let itemsWidth: CGFloat = itemSize.width * CGFloat(count) + itemSpacing * CGFloat(count - 1)
|
let itemsWidth: CGFloat = itemSize.width * CGFloat(count) + itemSpacing * CGFloat(count - 1)
|
||||||
|
|
||||||
|
@ -18,11 +18,10 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
private let titleIconNode: ASImageNode
|
private let titleIconNode: ASImageNode
|
||||||
private let currentOptionNode: ASTextNode
|
private let currentOptionNode: ASTextNode
|
||||||
private let currentOptionInfoNode: ASTextNode
|
private let currentOptionInfoNode: ASTextNode
|
||||||
private let nextOptionNode: HighlightableButtonNode
|
private let nextOptionTitleNode: ImmediateTextNode
|
||||||
|
private let nextOptionButtonNode: HighlightableButtonNode
|
||||||
|
|
||||||
private let codeInputView: CodeInputView
|
private let codeInputView: CodeInputView
|
||||||
//private let codeField: TextFieldNode
|
|
||||||
//private let codeSeparatorNode: ASDisplayNode
|
|
||||||
|
|
||||||
private var codeType: SentAuthorizationCodeType?
|
private var codeType: SentAuthorizationCodeType?
|
||||||
|
|
||||||
@ -81,11 +80,14 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
self.currentOptionInfoNode.isUserInteractionEnabled = false
|
self.currentOptionInfoNode.isUserInteractionEnabled = false
|
||||||
self.currentOptionInfoNode.displaysAsynchronously = false
|
self.currentOptionInfoNode.displaysAsynchronously = false
|
||||||
|
|
||||||
self.nextOptionNode = HighlightableButtonNode()
|
self.nextOptionTitleNode = ImmediateTextNode()
|
||||||
self.nextOptionNode.displaysAsynchronously = false
|
|
||||||
|
self.nextOptionButtonNode = HighlightableButtonNode()
|
||||||
|
self.nextOptionButtonNode.displaysAsynchronously = false
|
||||||
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: .sms(length: 5), nextType: .call, timeout: 60, strings: self.strings, primaryColor: self.theme.list.itemPrimaryTextColor, accentColor: self.theme.list.itemAccentColor)
|
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: .sms(length: 5), nextType: .call, timeout: 60, strings: self.strings, primaryColor: self.theme.list.itemPrimaryTextColor, accentColor: self.theme.list.itemAccentColor)
|
||||||
self.nextOptionNode.setAttributedTitle(nextOptionText, for: [])
|
self.nextOptionTitleNode.attributedText = nextOptionText
|
||||||
self.nextOptionNode.isUserInteractionEnabled = nextOptionActive
|
self.nextOptionButtonNode.isUserInteractionEnabled = nextOptionActive
|
||||||
|
self.nextOptionButtonNode.addSubnode(self.nextOptionTitleNode)
|
||||||
|
|
||||||
/*self.codeSeparatorNode = ASDisplayNode()
|
/*self.codeSeparatorNode = ASDisplayNode()
|
||||||
self.codeSeparatorNode.isLayerBacked = true
|
self.codeSeparatorNode.isLayerBacked = true
|
||||||
@ -125,7 +127,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
self.addSubnode(self.titleIconNode)
|
self.addSubnode(self.titleIconNode)
|
||||||
self.addSubnode(self.currentOptionNode)
|
self.addSubnode(self.currentOptionNode)
|
||||||
self.addSubnode(self.currentOptionInfoNode)
|
self.addSubnode(self.currentOptionInfoNode)
|
||||||
self.addSubnode(self.nextOptionNode)
|
self.addSubnode(self.nextOptionButtonNode)
|
||||||
|
|
||||||
self.codeInputView.updated = { [weak self] in
|
self.codeInputView.updated = { [weak self] in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
@ -139,7 +141,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
|
|
||||||
//self.codeField.textField.attributedPlaceholder = NSAttributedString(string: strings.Login_Code, font: Font.regular(24.0), textColor: self.theme.list.itemPlaceholderTextColor)
|
//self.codeField.textField.attributedPlaceholder = NSAttributedString(string: strings.Login_Code, font: Font.regular(24.0), textColor: self.theme.list.itemPlaceholderTextColor)
|
||||||
|
|
||||||
self.nextOptionNode.addTarget(self, action: #selector(self.nextOptionNodePressed), forControlEvents: .touchUpInside)
|
self.nextOptionButtonNode.addTarget(self, action: #selector(self.nextOptionNodePressed), forControlEvents: .touchUpInside)
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
@ -182,21 +184,24 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
self.currentOptionInfoNode.attributedText = NSAttributedString(string: "", font: Font.regular(15.0), textColor: self.theme.list.itemPrimaryTextColor)
|
self.currentOptionInfoNode.attributedText = NSAttributedString(string: "", font: Font.regular(15.0), textColor: self.theme.list.itemPrimaryTextColor)
|
||||||
}
|
}
|
||||||
if let timeout = timeout {
|
if let timeout = timeout {
|
||||||
|
#if DEBUG
|
||||||
|
let timeout = min(timeout, 5)
|
||||||
|
#endif
|
||||||
self.currentTimeoutTime = timeout
|
self.currentTimeoutTime = timeout
|
||||||
let disposable = ((Signal<Int, NoError>.single(1) |> delay(1.0, queue: Queue.mainQueue())) |> restart).start(next: { [weak self] _ in
|
let disposable = ((Signal<Int, NoError>.single(1) |> delay(1.0, queue: Queue.mainQueue())) |> restart).start(next: { [weak self] _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let currentTimeoutTime = strongSelf.currentTimeoutTime, currentTimeoutTime > 0 {
|
if let currentTimeoutTime = strongSelf.currentTimeoutTime, currentTimeoutTime > 0 {
|
||||||
strongSelf.currentTimeoutTime = currentTimeoutTime - 1
|
strongSelf.currentTimeoutTime = currentTimeoutTime - 1
|
||||||
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: codeType, nextType: nextType, timeout:strongSelf.currentTimeoutTime, strings: strongSelf.strings, primaryColor: strongSelf.theme.list.itemPrimaryTextColor, accentColor: strongSelf.theme.list.itemAccentColor)
|
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: codeType, nextType: nextType, timeout: strongSelf.currentTimeoutTime, strings: strongSelf.strings, primaryColor: strongSelf.theme.list.itemPrimaryTextColor, accentColor: strongSelf.theme.list.itemAccentColor)
|
||||||
strongSelf.nextOptionNode.setAttributedTitle(nextOptionText, for: [])
|
strongSelf.nextOptionTitleNode.attributedText = nextOptionText
|
||||||
strongSelf.nextOptionNode.isUserInteractionEnabled = nextOptionActive
|
strongSelf.nextOptionButtonNode.isUserInteractionEnabled = nextOptionActive
|
||||||
|
|
||||||
if let layoutArguments = strongSelf.layoutArguments {
|
if let layoutArguments = strongSelf.layoutArguments {
|
||||||
strongSelf.containerLayoutUpdated(layoutArguments.0, navigationBarHeight: layoutArguments.1, transition: .immediate)
|
strongSelf.containerLayoutUpdated(layoutArguments.0, navigationBarHeight: layoutArguments.1, transition: .immediate)
|
||||||
}
|
}
|
||||||
if currentTimeoutTime == 1 {
|
/*if currentTimeoutTime == 1 {
|
||||||
strongSelf.requestNextOption?()
|
strongSelf.requestNextOption?()
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -206,8 +211,12 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
self.countdownDisposable.set(nil)
|
self.countdownDisposable.set(nil)
|
||||||
}
|
}
|
||||||
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: codeType, nextType: nextType, timeout: self.currentTimeoutTime, strings: self.strings, primaryColor: self.theme.list.itemPrimaryTextColor, accentColor: self.theme.list.itemAccentColor)
|
let (nextOptionText, nextOptionActive) = authorizationNextOptionText(currentType: codeType, nextType: nextType, timeout: self.currentTimeoutTime, strings: self.strings, primaryColor: self.theme.list.itemPrimaryTextColor, accentColor: self.theme.list.itemAccentColor)
|
||||||
self.nextOptionNode.setAttributedTitle(nextOptionText, for: [])
|
self.nextOptionTitleNode.attributedText = nextOptionText
|
||||||
self.nextOptionNode.isUserInteractionEnabled = nextOptionActive
|
self.nextOptionButtonNode.isUserInteractionEnabled = nextOptionActive
|
||||||
|
|
||||||
|
if let layoutArguments = self.layoutArguments {
|
||||||
|
self.containerLayoutUpdated(layoutArguments.0, navigationBarHeight: layoutArguments.1, transition: .immediate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
@ -264,7 +273,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
|
|
||||||
let currentOptionSize = self.currentOptionNode.measure(CGSize(width: layout.size.width - 28.0, height: CGFloat.greatestFiniteMagnitude))
|
let currentOptionSize = self.currentOptionNode.measure(CGSize(width: layout.size.width - 28.0, height: CGFloat.greatestFiniteMagnitude))
|
||||||
let currentOptionInfoSize = self.currentOptionInfoNode.measure(CGSize(width: layout.size.width - 28.0, height: CGFloat.greatestFiniteMagnitude))
|
let currentOptionInfoSize = self.currentOptionInfoNode.measure(CGSize(width: layout.size.width - 28.0, height: CGFloat.greatestFiniteMagnitude))
|
||||||
let nextOptionSize = self.nextOptionNode.measure(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
|
let nextOptionSize = self.nextOptionTitleNode.updateLayout(CGSize(width: layout.size.width, height: CGFloat.greatestFiniteMagnitude))
|
||||||
|
|
||||||
let codeLength: Int
|
let codeLength: Int
|
||||||
var codePrefix: String = ""
|
var codePrefix: String = ""
|
||||||
@ -341,7 +350,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
//items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
//items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
//items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
//items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
|
|
||||||
items.append(AuthorizationLayoutItem(node: self.nextOptionNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
items.append(AuthorizationLayoutItem(node: self.nextOptionButtonNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
case .missedCall:
|
case .missedCall:
|
||||||
self.titleIconNode.isHidden = false
|
self.titleIconNode.isHidden = false
|
||||||
|
|
||||||
@ -369,7 +378,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
|
|
||||||
items.append(AuthorizationLayoutItem(node: self.currentOptionInfoNode, size: currentOptionInfoSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 60.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
items.append(AuthorizationLayoutItem(node: self.currentOptionInfoNode, size: currentOptionInfoSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 60.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
|
|
||||||
items.append(AuthorizationLayoutItem(node: self.nextOptionNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
items.append(AuthorizationLayoutItem(node: self.nextOptionButtonNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
default:
|
default:
|
||||||
self.titleIconNode.isHidden = true
|
self.titleIconNode.isHidden = true
|
||||||
items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
items.append(AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
@ -379,7 +388,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
/*items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
/*items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))*/
|
items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))*/
|
||||||
|
|
||||||
items.append(AuthorizationLayoutItem(node: self.nextOptionNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
items.append(AuthorizationLayoutItem(node: self.nextOptionButtonNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.titleIconNode.isHidden = true
|
self.titleIconNode.isHidden = true
|
||||||
@ -390,10 +399,12 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
|||||||
/*items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
/*items.append(AuthorizationLayoutItem(node: self.codeField, size: CGSize(width: layout.size.width - 88.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 100.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
||||||
items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))*/
|
items.append(AuthorizationLayoutItem(node: self.codeSeparatorNode, size: CGSize(width: layout.size.width - 88.0, height: UIScreenPixel), spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))*/
|
||||||
|
|
||||||
items.append(AuthorizationLayoutItem(node: self.nextOptionNode, size: nextOptionSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 50.0, maxValue: 120.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)))
|
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 - 20.0)), items: items, transition: transition, failIfDoesNotFit: false)
|
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 - 20.0)), items: items, transition: transition, failIfDoesNotFit: false)
|
||||||
|
|
||||||
|
self.nextOptionTitleNode.frame = self.nextOptionButtonNode.bounds
|
||||||
}
|
}
|
||||||
|
|
||||||
func activateInput() {
|
func activateInput() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app": "8.3",
|
"app": "8.3.1",
|
||||||
"bazel": "4.0.0",
|
"bazel": "4.0.0",
|
||||||
"xcode": "13.1"
|
"xcode": "13.1"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user