mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user