mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-17 14:11:35 +00:00
feat: updated menu button handling
- on tapping menu once (or chording with LB/RB), behave as start/select/special - on doube-tapping menu, quit the stream
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
ControllerSupport *_controllerSupport;
|
ControllerSupport *_controllerSupport;
|
||||||
StreamManager *_streamMan;
|
StreamManager *_streamMan;
|
||||||
NSTimer *_inactivityTimer;
|
NSTimer *_inactivityTimer;
|
||||||
|
UITapGestureRecognizer *_menuGestureRecognizer;
|
||||||
|
UITapGestureRecognizer *_menuDoubleTapGestureRecognizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
@@ -31,6 +33,15 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TARGET_OS_TV
|
||||||
|
- (void)controllerPauseButtonPressed:(id)sender { }
|
||||||
|
- (void)controllerPauseButtonDoublePressed:(id)sender {
|
||||||
|
Log(LOG_I, @"Menu double-pressed -- backing out of stream");
|
||||||
|
[self returnToMainFrame];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
@@ -46,6 +57,21 @@
|
|||||||
|
|
||||||
_controllerSupport = [[ControllerSupport alloc] initWithConfig:self.streamConfig];
|
_controllerSupport = [[ControllerSupport alloc] initWithConfig:self.streamConfig];
|
||||||
_inactivityTimer = nil;
|
_inactivityTimer = nil;
|
||||||
|
#if TARGET_OS_TV
|
||||||
|
if (!_menuGestureRecognizer || !_menuDoubleTapGestureRecognizer) {
|
||||||
|
_menuGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(controllerPauseButtonPressed:)];
|
||||||
|
_menuGestureRecognizer.allowedPressTypes = @[@(UIPressTypeMenu)];
|
||||||
|
|
||||||
|
_menuDoubleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(controllerPauseButtonDoublePressed:)];
|
||||||
|
_menuDoubleTapGestureRecognizer.numberOfTapsRequired = 2;
|
||||||
|
[_menuGestureRecognizer requireGestureRecognizerToFail:_menuDoubleTapGestureRecognizer];
|
||||||
|
_menuDoubleTapGestureRecognizer.allowedPressTypes = @[@(UIPressTypeMenu)];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self.view addGestureRecognizer:_menuGestureRecognizer];
|
||||||
|
[self.view addGestureRecognizer:_menuDoubleTapGestureRecognizer];
|
||||||
|
#endif
|
||||||
|
|
||||||
_streamMan = [[StreamManager alloc] initWithConfig:self.streamConfig
|
_streamMan = [[StreamManager alloc] initWithConfig:self.streamConfig
|
||||||
renderView:self.view
|
renderView:self.view
|
||||||
connectionCallbacks:self];
|
connectionCallbacks:self];
|
||||||
|
|||||||
Reference in New Issue
Block a user