Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-07-09 02:21:24 +03:00
parent f80b2641c3
commit 3ac8fddce5
6 changed files with 3299 additions and 3269 deletions

View File

@ -6527,6 +6527,7 @@ Sorry for the inconvenience.";
"Conversation.InputMenu" = "Menu";
"Conversation.MessageDoesntExist" = "Message doesn't exist";
"Settings.CheckPasswordTitle" = "Your Password";
"Settings.CheckPasswordText" = "Your account is protected by 2-Step Verification. Do you still remember your password?";
"Settings.KeepPassword" = "Yes, definitely";
"Settings.TryEnterPassword" = "Not sure, let me try";

View File

@ -99,6 +99,14 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
}
}
}
self.keyboardNode.backspace = { [weak self] in
if let strongSelf = self {
strongSelf.inputFieldNode.delete()
if let gradientNode = strongSelf.backgroundCustomNode as? GradientBackgroundNode {
gradientNode.animateEvent(transition: .animated(duration: 0.55, curve: .spring), backwards: true)
}
}
}
self.inputFieldNode.complete = { [weak self] passcode in
guard let strongSelf = self else {
return

View File

@ -113,6 +113,7 @@ final class PasscodeEntryButtonNode: HighlightTrackingButtonNode {
private let backgroundNode: ASImageNode
var action: (() -> Void)?
var cancelAction: (() -> Void)?
init(presentationData: PresentationData, background: PasscodeBackground, title: String, subtitle: String) {
self.presentationData = presentationData
@ -146,11 +147,16 @@ final class PasscodeEntryButtonNode: HighlightTrackingButtonNode {
}
self.addTarget(self, action: #selector(self.nop), forControlEvents: .touchUpInside)
self.addTarget(self, action: #selector(self.cancel), forControlEvents: .touchUpOutside)
}
@objc private func nop() {
}
@objc private func cancel() {
self.cancelAction?()
}
override var frame: CGRect {
get {
return super.frame
@ -223,6 +229,7 @@ final class PasscodeEntryKeyboardNode: ASDisplayNode {
private var background: PasscodeBackground?
var charactedEntered: ((String) -> Void)?
var backspace: (() -> Void)?
private func updateButtons() {
guard let presentationData = self.presentationData, let background = self.background else {
@ -239,6 +246,9 @@ final class PasscodeEntryKeyboardNode: ASDisplayNode {
buttonNode.action = { [weak self] in
self?.charactedEntered?(title)
}
buttonNode.cancelAction = { [weak self] in
self?.backspace?()
}
self.addSubnode(buttonNode)
}
}

View File

@ -529,6 +529,7 @@ private enum PeerInfoSettingsSection {
case username
case addAccount
case logout
case rememberPassword
}
private final class PeerInfoInteraction {
@ -708,7 +709,14 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
interaction.openSettings(.phoneNumber)
}))
} else if settings.suggestPasswordConfirmation {
items[.phone]!.append(PeerInfoScreenInfoItem(id: 0, title: presentationData.strings.Settings_CheckPasswordTitle, text: .markdown(presentationData.strings.Settings_CheckPasswordText), linkAction: { _ in
}))
items[.phone]!.append(PeerInfoScreenActionItem(id: 1, text: presentationData.strings.Settings_KeepPassword, action: {
let _ = dismissServerProvidedSuggestion(account: context.account, suggestion: .validatePassword).start()
}))
items[.phone]!.append(PeerInfoScreenActionItem(id: 2, text: presentationData.strings.Settings_TryEnterPassword, action: {
interaction.openSettings(.phoneNumber)
}))
}
if !settings.accountsAndPeers.isEmpty {
@ -5445,6 +5453,8 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
self.controller?.push(logoutOptionsController(context: self.context, navigationController: navigationController, canAddAccounts: accounts.count + 1 < maximumNumberOfAccounts, phoneNumber: phoneNumber))
}
}
case .rememberPassword:
break
}
}