Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

74 rindas
4.8KB

  1. #import <UIKit/UIKit.h>
  2. @interface SBApplication
  3. @end
  4. @interface SpringBoard
  5. +(SpringBoard *)sharedApplication;
  6. -(SBApplication *)_accessibilityFrontMostApplication;
  7. @end
  8. @interface SBLockScreenManager
  9. +(SBLockScreenManager *)sharedInstance;
  10. -(BOOL)isUILocked;
  11. @end
  12. @interface MPUNowPlayingMetadata
  13. @property (nonatomic,readonly) NSString * title;
  14. @property (nonatomic,readonly) NSString * artist;
  15. @property (nonatomic,readonly) NSString * album;
  16. @end
  17. @interface MPUNowPlayingController
  18. @property bool isPlaying;
  19. @property (nonatomic,readonly) NSString * nowPlayingAppDisplayID;
  20. @property (nonatomic,readonly) MPUNowPlayingMetadata * currentNowPlayingMetadata;
  21. @property (nonatomic,readonly) UIImage * currentNowPlayingArtwork;
  22. @property (nonatomic,readonly) NSDictionary * currentNowPlayingInfo;
  23. @end
  24. @interface JBBulletinManager : NSObject
  25. +(id)sharedInstance;
  26. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID;
  27. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundPath:(NSString *)soundPath;
  28. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundID:(int)inSoundID;
  29. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage;
  30. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage soundPath:(NSString *)soundPath;
  31. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overridBundleImage:(UIImage *)overridBundleImage soundID:(int)inSoundID;
  32. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID hasSound:(BOOL)hasSound soundID:(int)soundID vibrateMode:(int)vibrate soundPath:(NSString *)soundPath attachmentImage:(UIImage *)attachmentImage overrideBundleImage:(UIImage *)overrideBundleImage;
  33. @end
  34. %hook MPUNowPlayingController
  35. static NSString *cachedTitle;
  36. static NSString *artist;
  37. static NSString *album;
  38. -(void)_updateCurrentNowPlaying{
  39. %orig;
  40. NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7.notifymusicprefs.plist";
  41. NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
  42. BOOL enablewhilelocked = [[prefs objectForKey:@"enablewhilelocked"] boolValue];
  43. BOOL showalbumname = [[prefs objectForKey:@"showalbumname"] boolValue];
  44. double delayInSeconds = 0.5;
  45. dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
  46. dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
  47. if(![cachedTitle isEqualToString:self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoTitle"]]){
  48. cachedTitle = [self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoTitle"] copy];
  49. if((enablewhilelocked || (![[%c(SBLockScreenManager) sharedInstance] isUILocked])) && self.isPlaying && ([self.nowPlayingAppDisplayID isEqualToString:@"com.aspiro.TIDAL"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.ondalabs.doppi"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.coppertino.VoxMobile"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.soundcloud.TouchApp"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.Saavn.Saavn"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.apple.Music"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.spotify.client"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.pandora"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.rhapsody.iphone.Rhapsody3"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.google.PlayMusic"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.deezer.Deezer"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.michaelclay.Cesium"])){
  50. artist = [NSString stringWithFormat: @"\n%@", self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoArtist"]];
  51. if([self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoAlbum"] length] > 1 && showalbumname){
  52. album = self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoAlbum"];
  53. }else{
  54. album = @"Now Playing";
  55. }
  56. if(self.currentNowPlayingArtwork != nil){
  57. [[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:album message:[NSString stringWithFormat: @"%@%@", self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoTitle"], artist] bundleID:self.nowPlayingAppDisplayID hasSound:false soundID:0 vibrateMode:0 soundPath:@"" attachmentImage:self.currentNowPlayingArtwork overrideBundleImage:nil];
  58. }else{
  59. [[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:album message:[NSString stringWithFormat: @"%@%@", self.currentNowPlayingInfo[@"kMRMediaRemoteNowPlayingInfoTitle"], artist] bundleID:self.nowPlayingAppDisplayID];
  60. }
  61. }
  62. }
  63. });
  64. }
  65. %end