From 06a0f676979fe60a60ce70a05e036442b51738dc Mon Sep 17 00:00:00 2001 From: Yannick Reifschneider Date: Mon, 28 Dec 2020 17:44:53 +0100 Subject: [PATCH] deletion capable view: allow delete only during editing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deletion capable view controller allowed deletion of a file without being toggled into editing mode once after app launch. Disabling the play/pause and cancel press recognizers during viewDidLoad fixes this behaviour. (closes #948) Signed-off-by: Felix Paul Kühne --- Apple-TV/VLCDeletionCapableViewController.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Apple-TV/VLCDeletionCapableViewController.m b/Apple-TV/VLCDeletionCapableViewController.m index ccf46029..296b4c2b 100644 --- a/Apple-TV/VLCDeletionCapableViewController.m +++ b/Apple-TV/VLCDeletionCapableViewController.m @@ -33,17 +33,23 @@ UITapGestureRecognizer *cancelRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(endEditMode)]; cancelRecognizer.allowedPressTypes = @[@(UIPressTypeSelect),@(UIPressTypeMenu)]; + cancelRecognizer.enabled = self.editing; self.cancelRecognizer = cancelRecognizer; [self.view addGestureRecognizer:cancelRecognizer]; UITapGestureRecognizer *playPauseRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handlePlayPausePress)]; playPauseRecognizer.allowedPressTypes = @[@(UIPressTypePlayPause)]; + playPauseRecognizer.enabled = self.editing; self.playPausePressRecognizer = playPauseRecognizer; [self.view addGestureRecognizer:playPauseRecognizer]; } - (void)handlePlayPausePress { + if (!self.editing) { + return; + } + NSString *fileToDelete = self.itemToDelete; if (fileToDelete == nil) return; -- GitLab