Merge commit 'f440eccbf6a19570283a4933f4523000b2ab1768'

This commit is contained in:
Ali 2021-07-09 19:00:06 +04:00
commit f1a7ce6341
12 changed files with 3306 additions and 3294 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

@ -12,4 +12,6 @@ public protocol StatusBarHost {
func setStatusBarStyle(_ style: UIStatusBarStyle, animated: Bool)
func setStatusBarHidden(_ value: Bool, animated: Bool)
var shouldChangeStatusBarStyle: ((UIStatusBarStyle) -> Bool)? { get set }
}

View File

@ -776,12 +776,11 @@ public class Window1 {
self?.inCallNavigate?()
}
}
self.hostView.containerView.insertSubview(rootController.view, at: 0)
if !self.windowLayout.size.width.isZero && !self.windowLayout.size.height.isZero {
rootController.displayNode.frame = CGRect(origin: CGPoint(), size: self.windowLayout.size)
rootController.containerLayoutUpdated(containedLayoutForWindowLayout(self.windowLayout, deviceMetrics: self.deviceMetrics), transition: .immediate)
}
self.hostView.containerView.insertSubview(rootController.view, at: 0)
}
self.hostView.eventView.setNeedsLayout()

View File

@ -264,13 +264,13 @@ public final class GradientBackgroundNode: ASDisplayNode {
var steps: [[CGPoint]] = []
if backwards {
let phaseCount = extendAnimation ? 4 : 1
let phaseCount = extendAnimation ? 6 : 1
self.phase = (self.phase + phaseCount) % 8
self.validPhase = self.phase
var stepPhase = self.phase - phaseCount
if stepPhase < 0 {
stepPhase = 7
stepPhase = 8 + stepPhase
}
for _ in 0 ... phaseCount {
steps.append(gatherPositions(shiftArray(array: GradientBackgroundNode.basePositions, offset: stepPhase)))

View File

@ -58,7 +58,7 @@ public final class PasscodeEntryController: ViewController {
private var inBackground: Bool = false
private var inBackgroundDisposable: Disposable?
private let statusBarHost: StatusBarHost?
private var statusBarHost: StatusBarHost?
private var previousStatusBarStyle: UIStatusBarStyle?
public init(applicationBindings: TelegramApplicationBindings, accountManager: AccountManager, appLockContext: AppLockContext, presentationData: PresentationData, presentationDataSignal: Signal<PresentationData, NoError>, statusBarHost: StatusBarHost?, challengeData: PostboxAccessChallengeData, biometrics: PasscodeEntryControllerBiometricsMode, arguments: PasscodeEntryControllerPresentationArguments) {
@ -76,7 +76,14 @@ public final class PasscodeEntryController: ViewController {
super.init(navigationBarPresentationData: nil)
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
statusBarHost?.setStatusBarStyle(.lightContent, animated: true)
self.statusBarHost?.setStatusBarStyle(.lightContent, animated: true)
self.statusBarHost?.shouldChangeStatusBarStyle = { [weak self] style in
if let strongSelf = self {
strongSelf.previousStatusBarStyle = style
return false
}
return true
}
self.presentationDataDisposable = (presentationDataSignal
|> deliverOnMainQueue).start(next: { [weak self] presentationData in
@ -276,6 +283,7 @@ public final class PasscodeEntryController: ViewController {
}
public override func dismiss(completion: (() -> Void)? = nil) {
self.statusBarHost?.shouldChangeStatusBarStyle = nil
if let statusBarHost = self.statusBarHost, let previousStatusBarStyle = self.previousStatusBarStyle {
statusBarHost.setStatusBarStyle(previousStatusBarStyle, animated: true)
}

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

@ -99,8 +99,12 @@ private class ApplicationStatusBarHost: StatusBarHost {
}
func setStatusBarStyle(_ style: UIStatusBarStyle, animated: Bool) {
if self.shouldChangeStatusBarStyle?(style) ?? true {
self.application.setStatusBarStyle(style, animated: animated)
}
}
var shouldChangeStatusBarStyle: ((UIStatusBarStyle) -> Bool)?
func setStatusBarHidden(_ value: Bool, animated: Bool) {
self.application.setStatusBarHidden(value, with: animated ? .fade : .none)

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
}
}

View File

@ -601,44 +601,13 @@ public final class OngoingGroupCallContext {
mainView?.setOnIsMirroredUpdated { value in
f?(value)
}
}, setIsPaused: { [weak mainView] paused in
mainView?.setIsPaused(paused)
}, renderToSize: { [weak mainView] size, animated in
mainView?.render(to: size, animated: animated)
}
)
var cloneVideoView: OngoingCallContextPresentationCallVideoView?
if let cloneView = cloneView {
cloneVideoView = OngoingCallContextPresentationCallVideoView(
view: cloneView,
setOnFirstFrameReceived: { [weak cloneView] f in
cloneView?.setOnFirstFrameReceived(f)
},
getOrientation: { [weak cloneView] in
if let cloneView = cloneView {
return OngoingCallVideoOrientation(cloneView.orientation)
} else {
return .rotation0
}
},
getAspect: { [weak cloneView] in
if let cloneView = cloneView {
return cloneView.aspect
} else {
return 0.0
}
},
setOnOrientationUpdated: { [weak cloneView] f in
cloneView?.setOnOrientationUpdated { value, aspect in
f?(OngoingCallVideoOrientation(value), aspect)
}
}, setVideoContentMode: { [weak cloneView] mode in
cloneView?.setVideoContentMode(mode)
},
setOnIsMirroredUpdated: { [weak cloneView] f in
cloneView?.setOnIsMirroredUpdated { value in
f?(value)
}
}
)
}
completion(mainVideoView, cloneVideoView)
completion(mainVideoView, nil)
#endif
} else {
completion(nil, nil)