From 75b0f1bfb82e9b69de14d2553e5b8353e38755b5 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Tue, 22 Nov 2022 13:06:17 -0500 Subject: [PATCH] Allow pressing escape to close the media viewer --- .../Scene/MediaPreview/MediaPreviewViewController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift index dee6c00ea..7e7a84358 100644 --- a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift +++ b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift @@ -359,12 +359,12 @@ extension MediaPreviewViewController: MediaPreviewImageViewControllerDelegate { extension MediaPreviewViewController { - var closeKeyCommand: UIKeyCommand { + func closeKeyCommand(input: String) -> UIKeyCommand { UIKeyCommand( title: L10n.Scene.Preview.Keyboard.closePreview, image: nil, action: #selector(MediaPreviewViewController.closePreviewKeyCommandHandler(_:)), - input: "i", + input: input, modifierFlags: [], propertyList: nil, alternates: [], @@ -408,7 +408,8 @@ extension MediaPreviewViewController { override var keyCommands: [UIKeyCommand] { return [ - closeKeyCommand, + closeKeyCommand(input: UIKeyCommand.inputEscape), + closeKeyCommand(input: "i"), showNextKeyCommand, showPreviousKeyCommand, ]