encryptWithPassword возвращён к SHA256+rawDeflate (iOS-only данные)
Добавлен encryptWithPasswordDesktopCompat (SHA1+zlibDeflate) для кросс-платформенных данных (aesChachaKey, аватар) 3 вызова в SessionManager переведены на desktop-compatible путь Добавлен Notification.Name.profileDidUpdate для мгновенного обновления имени в Settings Удалены debug-логи из CryptoManager и SessionManager
This commit is contained in:
@@ -11,7 +11,6 @@ final class KeyboardTrackingView: UIView {
|
||||
var onHeightChange: ((CGFloat) -> Void)?
|
||||
|
||||
private var observation: NSKeyValueObservation?
|
||||
private var superviewHeightObservation: NSKeyValueObservation?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: .init(x: 0, y: 0, width: frame.width, height: 0))
|
||||
@@ -29,30 +28,34 @@ final class KeyboardTrackingView: UIView {
|
||||
super.didMoveToSuperview()
|
||||
observation?.invalidate()
|
||||
observation = nil
|
||||
superviewHeightObservation?.invalidate()
|
||||
superviewHeightObservation = nil
|
||||
|
||||
guard let sv = superview else { return }
|
||||
|
||||
// Only observe .center — .bounds fires simultaneously for the same
|
||||
// position change, doubling KVO callbacks with no new information.
|
||||
observation = sv.observe(\.center, options: [.new]) { [weak self] view, _ in
|
||||
self?.reportHeight(from: view)
|
||||
}
|
||||
superviewHeightObservation = sv.observe(\.bounds, options: [.new]) { [weak self] view, _ in
|
||||
self?.reportHeight(from: view)
|
||||
}
|
||||
}
|
||||
|
||||
private var lastReportedHeight: CGFloat = -1
|
||||
|
||||
private func reportHeight(from hostView: UIView) {
|
||||
guard let window = hostView.window else { return }
|
||||
let screenHeight = window.screen.bounds.height
|
||||
let hostFrame = hostView.convert(hostView.bounds, to: nil)
|
||||
let keyboardHeight = max(0, screenHeight - hostFrame.origin.y)
|
||||
onHeightChange?(keyboardHeight)
|
||||
// Throttle: only fire callback when rounded height actually changes.
|
||||
// Sub-point changes are invisible but still trigger full SwiftUI layout.
|
||||
// This halves the number of body evaluations during interactive dismiss.
|
||||
let rounded = round(keyboardHeight)
|
||||
guard abs(rounded - lastReportedHeight) > 1 else { return }
|
||||
lastReportedHeight = rounded
|
||||
onHeightChange?(rounded)
|
||||
}
|
||||
|
||||
deinit {
|
||||
observation?.invalidate()
|
||||
superviewHeightObservation?.invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user