Skip to content

Commit

Permalink
Merge pull request #227 from wutschel/fix_shake
Browse files Browse the repository at this point in the history
Bugfix: Make shake gesture work again (allows to clear playlist)
  • Loading branch information
kambala-decapitator authored Apr 5, 2021
2 parents 54c0617 + b3598c9 commit 1419e4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 0 additions & 6 deletions XBMC Remote/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4465,12 +4465,6 @@ - (void)applicationWillEnterForeground:(UIApplication *)application{
// [[NSNotificationCenter defaultCenter] postNotificationName: @"UIApplicationWillEnterForegroundNotification" object: nil];
}

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{
if(event.type == UIEventSubtypeMotionShake){
[[NSNotificationCenter defaultCenter] postNotificationName: @"UIApplicationShakeNotification" object: nil];
}
}

- (void)applicationDidBecomeActive:(UIApplication *)application{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

Expand Down
17 changes: 12 additions & 5 deletions XBMC Remote/NowPlaying.m
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,16 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceive
return YES;
}

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake) {
[self handleShakeNotification];
}
}

- (BOOL)canBecomeFirstResponder {
return YES;
}

#pragma mark - UISegmentControl

-(CGRect)currentScreenBoundsDependOnOrientation {
Expand Down Expand Up @@ -2778,11 +2788,7 @@ -(void)viewWillAppear:(BOOL)animated{
selector: @selector(handleXBMCPlaylistHasChanged:)
name: @"XBMCPlaylistHasChanged"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleShakeNotification)
name: @"UIApplicationShakeNotification"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(revealMenu:)
name: @"RevealMenu"
Expand Down Expand Up @@ -2831,6 +2837,7 @@ - (void)revealUnderRight:(id)sender{

-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self becomeFirstResponder];
[self handleXBMCPlaylistHasChanged:nil];
[self playbackInfo];
updateProgressBar = YES;
Expand Down

0 comments on commit 1419e4a

Please sign in to comment.