Various improvements

This commit is contained in:
Ilya Laktyushin
2025-05-20 22:30:48 +02:00
parent 62f156440f
commit 81e11d6d36
102 changed files with 3073 additions and 558 deletions

View File

@@ -4,6 +4,9 @@ import Display
import SwiftSignalKit
import LegacyComponents
import TelegramPresentationData
import Camera
import DeviceModel
import TooltipUI
public enum LegacyControllerPresentation {
case custom
@@ -193,6 +196,11 @@ public final class LegacyControllerContext: NSObject, LegacyComponentsContext {
public func forceStatusBarAppearanceUpdate() {
}
public func cameraZoomLevels() -> [NSNumber]! {
let metrics = Camera.Metrics(model: DeviceModel.current)
return metrics.zoomLevels.map { NSNumber(value: $0) }
}
public func currentlyInSplitView() -> Bool {
if let controller = self.controller as? LegacyController, let validLayout = controller.validLayout {
return validLayout.isNonExclusive
@@ -258,6 +266,25 @@ public final class LegacyControllerContext: NSObject, LegacyComponentsContext {
}
public func presentTooltip(_ text: String!, icon: UIImage!, sourceRect: CGRect) {
guard let context = legacyContextGet() else {
return
}
let controller = TooltipScreen(
account: context.account,
sharedContext: context.sharedContext,
text: .plain(text: text),
style: .customBlur(UIColor(rgb: 0x18181a), 0.0),
icon: .image(icon),
location: .point(sourceRect, .bottom),
displayDuration: .custom(2.0),
shouldDismissOnTouch: { _, _ in
return .dismiss(consume: false)
})
context.sharedContext.presentGlobalController(controller, nil)
}
public func makeOverlayWindowManager() -> LegacyComponentsOverlayWindowManager! {
return LegacyComponentsOverlayWindowManagerImpl(parentController: self.controller, theme: self.theme)
}