Skip to content

Commit

Permalink
- add like remote control option
Browse files Browse the repository at this point in the history
  • Loading branch information
polymonster committed Feb 13, 2024
1 parent 77118a6 commit 9a9d1b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/pen/include/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace pen
void (*pause)(bool) = nullptr;
void (*next)(bool) = nullptr;
void (*tick)(void) = nullptr;
void (*like)(void) = nullptr;
};

struct music_file
Expand Down
11 changes: 11 additions & 0 deletions core/pen/source/ios/os.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ -(MPRemoteCommandHandlerStatus)play;
-(MPRemoteCommandHandlerStatus)pause;
-(MPRemoteCommandHandlerStatus)prev;
-(MPRemoteCommandHandlerStatus)next;
-(MPRemoteCommandHandlerStatus)like;
@end

namespace
Expand Down Expand Up @@ -117,6 +118,7 @@ void enable_remote_control_internal()
[commandCenter.playCommand addTarget:s_context.app_delegate action:@selector(play)];
[commandCenter.nextTrackCommand addTarget:s_context.app_delegate action:@selector(next)];
[commandCenter.previousTrackCommand addTarget:s_context.app_delegate action:@selector(prev)];
[commandCenter.likeCommand addTarget:s_context.app_delegate action:@selector(like)];
}
}

Expand Down Expand Up @@ -205,6 +207,15 @@ -(MPRemoteCommandHandlerStatus)next {
}
return MPRemoteCommandHandlerStatusNoSuchContent;
}

-(MPRemoteCommandHandlerStatus)like {
if(s_context.music_remote.like)
{
s_context.music_remote.like();
return MPRemoteCommandHandlerStatusSuccess;
}
return MPRemoteCommandHandlerStatusNoSuchContent;
}
@end

@implementation pen_mtk_renderer
Expand Down

0 comments on commit 9a9d1b1

Please sign in to comment.