No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

39 líneas
2.3KB

  1. #import <UIKit/UIKit.h>
  2. @interface MPUNowPlayingMetadata
  3. @property (nonatomic,readonly) NSString * title;
  4. @property (nonatomic,readonly) NSString * artist;
  5. @end
  6. @interface MPUNowPlayingController
  7. @property bool isPlaying;
  8. @property (nonatomic,readonly) NSString * nowPlayingAppDisplayID;
  9. @property (nonatomic,readonly) MPUNowPlayingMetadata * currentNowPlayingMetadata;
  10. @end
  11. @interface JBBulletinManager : NSObject
  12. +(id)sharedInstance;
  13. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID;
  14. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundPath:(NSString *)soundPath;
  15. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundID:(int)inSoundID;
  16. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage;
  17. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage soundPath:(NSString *)soundPath;
  18. -(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overridBundleImage:(UIImage *)overridBundleImage soundID:(int)inSoundID;
  19. -(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;
  20. @end
  21. %hook MPUNowPlayingController
  22. static NSString *cachedTitle;
  23. -(void)_updateCurrentNowPlaying{
  24. %orig;
  25. double delayInSeconds = 0.5;
  26. dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
  27. dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
  28. if(self.isPlaying && ([self.nowPlayingAppDisplayID isEqualToString:@"com.apple.Music"] || [self.nowPlayingAppDisplayID isEqualToString:@"com.spotify.client"]) && ![cachedTitle isEqualToString:self.currentNowPlayingMetadata.title]){
  29. cachedTitle = [self.currentNowPlayingMetadata.title copy];
  30. [[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:self.currentNowPlayingMetadata.title message:self.currentNowPlayingMetadata.artist bundleID:self.nowPlayingAppDisplayID];
  31. }
  32. });
  33. }
  34. %end