Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #612 from atopuzov/resume_playback
Browse files Browse the repository at this point in the history
Check whether to resume playback
  • Loading branch information
jacobwgillespie authored Sep 26, 2016
2 parents 011dca7 + 6482805 commit 9b1f202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions radiant-player-mac/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
@property (assign) NSTimeInterval currentDuration;
@property (assign) NSTimeInterval currentTimestamp;
@property (assign) NSInteger currentPlaybackMode;
@property (assign) NSInteger previousPlaybackMode;

- (void) initializeStatusBar;
- (NSMutableDictionary *) styles;
Expand Down
5 changes: 4 additions & 1 deletion radiant-player-mac/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ @implementation AppDelegate
@synthesize currentDuration;
@synthesize currentTimestamp;
@synthesize currentPlaybackMode;
@synthesize previousPlaybackMode;

/**
* Closing the application, hides the player window but keeps music playing in the background.
Expand All @@ -66,6 +67,7 @@ - (BOOL)windowShouldClose:(NSNotification *)notification

- (void)receiveSleepNotification:(NSNotification*)notification
{
previousPlaybackMode = currentPlaybackMode;
if (currentPlaybackMode == MUSIC_PLAYING)
[self playPause:self];
}
Expand All @@ -76,6 +78,7 @@ - (void)RadiantScreenLocked {

if ([defaults boolForKey:@"toggleMusicOnScreenLock"])
{
previousPlaybackMode = currentPlaybackMode;
if (currentPlaybackMode == MUSIC_PLAYING) {
[self playPause:self];
}
Expand All @@ -85,7 +88,7 @@ - (void)RadiantScreenLocked {
- (void)RadiantScreenUnlocked {
if ([defaults boolForKey:@"toggleMusicOnScreenLock"])
{
if (currentPlaybackMode == MUSIC_PAUSED) {
if (previousPlaybackMode == MUSIC_PLAYING && currentPlaybackMode == MUSIC_PAUSED) {
[self playPause:self];
}
}
Expand Down

0 comments on commit 9b1f202

Please sign in to comment.