mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
iPad trackpad and key shortcuts improvements
This commit is contained in:
@@ -71,7 +71,7 @@ public final class AlertControllerTheme: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
open class AlertController: ViewController, StandalonePresentableController {
|
||||
open class AlertController: ViewController, StandalonePresentableController, KeyShortcutResponder {
|
||||
private var controllerNode: AlertControllerNode {
|
||||
return self.displayNode as! AlertControllerNode
|
||||
}
|
||||
@@ -155,4 +155,44 @@ open class AlertController: ViewController, StandalonePresentableController {
|
||||
self?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
public var keyShortcuts: [KeyShortcut] {
|
||||
return [
|
||||
KeyShortcut(
|
||||
input: UIKeyCommand.inputEscape,
|
||||
modifiers: [],
|
||||
action: { [weak self] in
|
||||
self?.dismissAnimated()
|
||||
}
|
||||
),
|
||||
KeyShortcut(
|
||||
input: "W",
|
||||
modifiers: [.command],
|
||||
action: { [weak self] in
|
||||
self?.dismissAnimated()
|
||||
}
|
||||
),
|
||||
KeyShortcut(
|
||||
input: "\r",
|
||||
modifiers: [],
|
||||
action: { [weak self] in
|
||||
self?.controllerNode.performHighlightedAction()
|
||||
}
|
||||
),
|
||||
KeyShortcut(
|
||||
input: UIKeyCommand.inputUpArrow,
|
||||
modifiers: [],
|
||||
action: { [weak self] in
|
||||
self?.controllerNode.decreaseHighlightedIndex()
|
||||
}
|
||||
),
|
||||
KeyShortcut(
|
||||
input: UIKeyCommand.inputDownArrow,
|
||||
modifiers: [],
|
||||
action: { [weak self] in
|
||||
self?.controllerNode.increaseHighlightedIndex()
|
||||
}
|
||||
)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user