mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Keep keyboard static during authorization sequence on iOS 16
This commit is contained in:
parent
e70d6867d9
commit
9f69dd9012
@ -2,6 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import ProgressNavigationButtonNode
|
||||
@ -120,6 +121,10 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
|
||||
override public func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
if let navigationController = self.navigationController as? NavigationController, let layout = self.validLayout {
|
||||
addTemporaryKeyboardSnapshotView(navigationController: navigationController, parentView: self.view, layout: layout)
|
||||
}
|
||||
|
||||
self.controllerNode.activateInput()
|
||||
}
|
||||
|
||||
@ -219,3 +224,25 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
|
||||
self.controllerNode.updateCode("\(code)")
|
||||
}
|
||||
}
|
||||
|
||||
func addTemporaryKeyboardSnapshotView(navigationController: NavigationController, parentView: UIView, layout: ContainerViewLayout) {
|
||||
if case .compact = layout.metrics.widthClass, let statusBarHost = navigationController.statusBarHost {
|
||||
if let keyboardView = statusBarHost.keyboardView {
|
||||
if let snapshotView = keyboardView.snapshotView(afterScreenUpdates: false) {
|
||||
keyboardView.layer.removeAllAnimations()
|
||||
UIView.performWithoutAnimation {
|
||||
snapshotView.frame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - snapshotView.frame.size.height), size: snapshotView.frame.size)
|
||||
if let keyboardWindow = statusBarHost.keyboardWindow {
|
||||
keyboardWindow.addSubview(snapshotView)
|
||||
}
|
||||
|
||||
Queue.mainQueue().after(0.45, {
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||
snapshotView?.removeFromSuperview()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
}
|
||||
}
|
||||
|
||||
private let appearanceTimestamp = CACurrentMediaTime()
|
||||
|
||||
init(strings: PresentationStrings, theme: PresentationTheme) {
|
||||
self.strings = strings
|
||||
self.theme = theme
|
||||
@ -270,8 +272,16 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
let previousInputHeight = self.layoutArguments?.0.inputHeight ?? 0.0
|
||||
let newInputHeight = layout.inputHeight ?? 0.0
|
||||
|
||||
self.layoutArguments = (layout, navigationBarHeight)
|
||||
|
||||
var layout = layout
|
||||
if CACurrentMediaTime() - self.appearanceTimestamp < 2.0, newInputHeight < previousInputHeight {
|
||||
layout = layout.withUpdatedInputHeight(previousInputHeight)
|
||||
}
|
||||
|
||||
let maximumWidth: CGFloat = min(430.0, layout.size.width)
|
||||
let inset: CGFloat = 24.0
|
||||
|
||||
|
@ -89,6 +89,10 @@ final class AuthorizationSequencePasswordEntryController: ViewController {
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
if let navigationController = self.navigationController as? NavigationController, let layout = self.validLayout {
|
||||
addTemporaryKeyboardSnapshotView(navigationController: navigationController, parentView: self.view, layout: layout)
|
||||
}
|
||||
|
||||
self.controllerNode.activateInput()
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,10 @@ final class AuthorizationSequenceSignUpController: ViewController {
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
if let navigationController = self.navigationController as? NavigationController, let layout = self.validLayout {
|
||||
addTemporaryKeyboardSnapshotView(navigationController: navigationController, parentView: self.view, layout: layout)
|
||||
}
|
||||
|
||||
self.controllerNode.activateInput()
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import TextFormat
|
||||
import Markdown
|
||||
@ -40,6 +41,8 @@ final class AuthorizationSequenceSignUpControllerNode: ASDisplayNode, UITextFiel
|
||||
|
||||
private var layoutArguments: (ContainerViewLayout, CGFloat)?
|
||||
|
||||
private let appearanceTimestamp = CACurrentMediaTime()
|
||||
|
||||
var currentName: (String, String) {
|
||||
return (self.firstNameField.textField.text ?? "", self.lastNameField.textField.text ?? "")
|
||||
}
|
||||
@ -209,8 +212,16 @@ final class AuthorizationSequenceSignUpControllerNode: ASDisplayNode, UITextFiel
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
let previousInputHeight = self.layoutArguments?.0.inputHeight ?? 0.0
|
||||
let newInputHeight = layout.inputHeight ?? 0.0
|
||||
|
||||
self.layoutArguments = (layout, navigationBarHeight)
|
||||
|
||||
var layout = layout
|
||||
if CACurrentMediaTime() - self.appearanceTimestamp < 2.0, newInputHeight < previousInputHeight {
|
||||
layout = layout.withUpdatedInputHeight(previousInputHeight)
|
||||
}
|
||||
|
||||
let maximumWidth: CGFloat = min(430.0, layout.size.width)
|
||||
|
||||
var insets = layout.insets(options: [.statusBar])
|
||||
|
@ -2297,7 +2297,7 @@ public final class ChatListNode: ListView {
|
||||
isEmpty = true
|
||||
loop1: for entry in transition.chatListView.filteredEntries {
|
||||
switch entry {
|
||||
case .GroupReferenceEntry, .HeaderEntry, .HoleEntry:
|
||||
case .HeaderEntry, .HoleEntry:
|
||||
break
|
||||
default:
|
||||
if case .ArchiveIntro = entry {
|
||||
|
@ -612,7 +612,7 @@ func chatListNodeEntriesForView(_ view: EngineChatList, state: ChatListNodeState
|
||||
autoremoveTimeout: item.item.autoremoveTimeout,
|
||||
forumTopicData: item.item.forumTopicData,
|
||||
topForumTopicItems: item.item.topForumTopicItems,
|
||||
revealed: threadId == 1 && (state.hiddenItemShouldBeTemporaryRevealed || state.editing)
|
||||
revealed: state.hiddenItemShouldBeTemporaryRevealed || state.editing
|
||||
)))
|
||||
if pinningIndex != 0 {
|
||||
pinningIndex -= 1
|
||||
@ -632,7 +632,7 @@ func chatListNodeEntriesForView(_ view: EngineChatList, state: ChatListNodeState
|
||||
message: groupReference.topMessage,
|
||||
editing: state.editing,
|
||||
unreadCount: groupReference.unreadCount,
|
||||
revealed: state.hiddenItemShouldBeTemporaryRevealed,
|
||||
revealed: state.hiddenItemShouldBeTemporaryRevealed || view.items.isEmpty,
|
||||
hiddenByDefault: hideArchivedFolderByDefault
|
||||
))
|
||||
if pinningIndex != 0 {
|
||||
|
@ -1151,7 +1151,7 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
|
||||
}
|
||||
|
||||
var canReport = true
|
||||
if channel.isVerified || channel.adminRights != nil || channel.flags.contains(.isCreator) {
|
||||
if channel.adminRights != nil || channel.flags.contains(.isCreator) {
|
||||
canReport = false
|
||||
}
|
||||
|
||||
|
@ -414,10 +414,6 @@ public final class WebSearchController: ViewController {
|
||||
}
|
||||
|
||||
private func updateSearchQuery(_ query: String) {
|
||||
if !query.isEmpty {
|
||||
let _ = addRecentWebSearchQuery(engine: self.context.engine, string: query).start()
|
||||
}
|
||||
|
||||
let scope: Signal<WebSearchScope?, NoError>
|
||||
switch self.mode {
|
||||
case .media:
|
||||
|
Loading…
x
Reference in New Issue
Block a user