|
|
|
|
|
|
|
|
@property bool isPlaying; |
|
|
@property bool isPlaying; |
|
|
@property (nonatomic,readonly) NSString * nowPlayingAppDisplayID; |
|
|
@property (nonatomic,readonly) NSString * nowPlayingAppDisplayID; |
|
|
@property (nonatomic,readonly) MPUNowPlayingMetadata * currentNowPlayingMetadata; |
|
|
@property (nonatomic,readonly) MPUNowPlayingMetadata * currentNowPlayingMetadata; |
|
|
|
|
|
@property (nonatomic,readonly) UIImage * currentNowPlayingArtwork; |
|
|
@end |
|
|
@end |
|
|
|
|
|
|
|
|
@interface JBBulletinManager : NSObject |
|
|
@interface JBBulletinManager : NSObject |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%hook MPUNowPlayingController |
|
|
%hook MPUNowPlayingController |
|
|
static NSString *cachedTitle; |
|
|
static NSString *cachedTitle; |
|
|
|
|
|
static NSString *artist; |
|
|
-(void)_updateCurrentNowPlaying{ |
|
|
-(void)_updateCurrentNowPlaying{ |
|
|
%orig; |
|
|
%orig; |
|
|
double delayInSeconds = 0.5; |
|
|
double delayInSeconds = 0.5; |
|
|
|
|
|
|
|
|
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ |
|
|
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ |
|
|
if(self.isPlaying && ([self.nowPlayingAppDisplayID isEqualToString:@"com.apple.Music"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.spotify.client"]) && ![cachedTitle isEqualToString:self.currentNowPlayingMetadata.title]){ |
|
|
if(self.isPlaying && ([self.nowPlayingAppDisplayID isEqualToString:@"com.apple.Music"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.spotify.client"]) && ![cachedTitle isEqualToString:self.currentNowPlayingMetadata.title]){ |
|
|
cachedTitle = [self.currentNowPlayingMetadata.title copy]; |
|
|
cachedTitle = [self.currentNowPlayingMetadata.title copy]; |
|
|
[[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:self.currentNowPlayingMetadata.title message:self.currentNowPlayingMetadata.artist bundleID:self.nowPlayingAppDisplayID]; |
|
|
|
|
|
|
|
|
if([self.currentNowPlayingMetadata.artist length] > 1){ |
|
|
|
|
|
artist = [NSString stringWithFormat: @"\nBy: %@", self.currentNowPlayingMetadata.artist]; |
|
|
|
|
|
}else{ |
|
|
|
|
|
artist = @""; |
|
|
|
|
|
} |
|
|
|
|
|
if(self.currentNowPlayingArtwork != nil){ |
|
|
|
|
|
[[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:@"Now Playing" message:[NSString stringWithFormat: @"%@%@", self.currentNowPlayingMetadata.title, artist] bundleID:self.nowPlayingAppDisplayID hasSound:false soundID:0 vibrateMode:0 soundPath:@"" attachmentImage:self.currentNowPlayingArtwork overrideBundleImage:nil]; |
|
|
|
|
|
}else{ |
|
|
|
|
|
[[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:@"Now Playing" message:[NSString stringWithFormat: @"%@%@", self.currentNowPlayingMetadata.title, artist] bundleID:self.nowPlayingAppDisplayID]; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |