Skip to content
This repository has been archived by the owner on Jun 21, 2020. It is now read-only.

Commit

Permalink
[provider] meh, dump the typestatus plus integration idea
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Jul 7, 2017
1 parent 44564db commit ae45457
Show file tree
Hide file tree
Showing 11 changed files with 3 additions and 83 deletions.
37 changes: 3 additions & 34 deletions HBCZNowPlayingController.x
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// listen for the now playing change notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_mediaInfoDidChange:) name:(__bridge NSString *)kMRMediaRemoteNowPlayingInfoDidChangeNotification object:nil];

// grab the fallback placeholder artwork image
NSBundle *mpuiBundle = [NSBundle bundleWithIdentifier:@"com.apple.MediaPlayerUI"];
UIImage *placeholderImage = [UIImage imageNamed:@"placeholder-artwork" inBundle:mpuiBundle];
_placeholderArtData = UIImagePNGRepresentation(placeholderImage);
Expand Down Expand Up @@ -89,43 +90,11 @@
// store the identifier
_lastSongIdentifier = identifier;

// get the frontmost app
SBApplication *frontmostApp = ((SpringBoard *)[UIApplication sharedApplication])._accessibilityFrontMostApplication;

// if the now playing provider is enabled, and typestatus plus is present
if (_preferences.nowPlayingProvider && %c(HBTSPlusProviderController)) {
// as long as this isn’t coming from the frontmost app
if (![frontmostApp.bundleIdentifier isEqualToString:nowPlayingApp.bundleIdentifier]) {
// post it as a provider notification
[self _postProviderNotificationForApp:nowPlayingApp title:title artist:artist];
}
} else {
// else, post a bulletin
[_bulletinProvider postBulletinForApp:nowPlayingApp title:title artist:artist album:album art:art];
}
// post the bulletin
[_bulletinProvider postBulletinForApp:nowPlayingApp title:title artist:artist album:album art:art];
}
});
});
}

#pragma mark - TypeStatus Provider

- (void)_postProviderNotificationForApp:(SBApplication *)app title:(NSString *)title artist:(NSString *)artist {
// if typestatus plus provider api isn’t available, don’t do anything
if (!%c(HBTSPlusProviderController)) {
return;
}

// construct a notification
HBTSNotification *notification = [[%c(HBTSNotification) alloc] init];
notification.content = artist ? [NSString stringWithFormat:@"%@ – %@", title, artist] : title;
notification.boldRange = NSMakeRange(0, title.length);
notification.statusBarIconName = @"TypeStatusPlusMusic";
notification.sourceBundleID = app.bundleIdentifier;

// grab our provider and show it
HBTSPlusProvider *provider = [[%c(HBTSPlusProviderController) sharedInstance] providerWithAppIdentifier:kHBCZAppIdentifier];
[provider showNotification:notification];
}

@end
5 changes: 0 additions & 5 deletions provider/HBCZMusicProvider.h

This file was deleted.

19 changes: 0 additions & 19 deletions provider/HBCZMusicProvider.m

This file was deleted.

13 changes: 0 additions & 13 deletions provider/Makefile

This file was deleted.

Binary file removed provider/Resources/Black_TypeStatusPlusMusic.png
Binary file not shown.
Binary file removed provider/Resources/[email protected]
Binary file not shown.
Binary file removed provider/Resources/[email protected]
Binary file not shown.
12 changes: 0 additions & 12 deletions provider/Resources/Info.plist

This file was deleted.

Binary file removed provider/Resources/LockScreen_TypeStatusPlusMusic.png
Binary file not shown.
Binary file removed provider/Resources/[email protected]
Binary file not shown.
Binary file removed provider/Resources/[email protected]
Binary file not shown.

0 comments on commit ae45457

Please sign in to comment.