forked from gilshahar7/NotifyMusic
		
	removed debugging lines and fixed spacing
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -5,7 +5,7 @@ include theos/makefiles/common.mk
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TWEAK_NAME = NotifyMusic
 | 
					TWEAK_NAME = NotifyMusic
 | 
				
			||||||
NotifyMusic_FILES = Tweak.xm
 | 
					NotifyMusic_FILES = Tweak.xm
 | 
				
			||||||
NotifyMusic_FRAMEWORKS = CoreTelephony AudioToolbox UIKit
 | 
					NotifyMusic_FRAMEWORKS = UIKit
 | 
				
			||||||
NotifyMusic_LIBRARIES = bulletin
 | 
					NotifyMusic_LIBRARIES = bulletin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include $(THEOS_MAKE_PATH)/tweak.mk
 | 
					include $(THEOS_MAKE_PATH)/tweak.mk
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										52
									
								
								Tweak.xm
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								Tweak.xm
									
									
									
									
									
								
							@ -1,52 +1,50 @@
 | 
				
			|||||||
#import <AudioToolbox/AudioToolbox.h>
 | 
					 | 
				
			||||||
#import <AudioToolbox/AudioServices.h>
 | 
					 | 
				
			||||||
#import <UIKit/UIKit.h>
 | 
					#import <UIKit/UIKit.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@interface MPUNowPlayingMetadata
 | 
					@interface MPUNowPlayingMetadata
 | 
				
			||||||
@property (nonatomic,readonly) NSString * title; 
 | 
						@property (nonatomic,readonly) NSString * title; 
 | 
				
			||||||
@property (nonatomic,readonly) NSString * artist;
 | 
						@property (nonatomic,readonly) NSString * artist;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@interface MPUNowPlayingController
 | 
					@interface MPUNowPlayingController
 | 
				
			||||||
@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;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@interface JBBulletinManager : NSObject
 | 
					@interface JBBulletinManager : NSObject
 | 
				
			||||||
+(id)sharedInstance;
 | 
						+(id)sharedInstance;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundPath:(NSString *)soundPath;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundPath:(NSString *)soundPath;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundID:(int)inSoundID;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message bundleID:(NSString *)bundleID soundID:(int)inSoundID;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage soundPath:(NSString *)soundPath;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overrideBundleImage:(UIImage *)overridBundleImage soundPath:(NSString *)soundPath;
 | 
				
			||||||
-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overridBundleImage:(UIImage *)overridBundleImage soundID:(int)inSoundID;
 | 
						-(id)showBulletinWithTitle:(NSString *)title message:(NSString *)message overridBundleImage:(UIImage *)overridBundleImage soundID:(int)inSoundID;
 | 
				
			||||||
-(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;
 | 
						-(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;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%hook MPUNowPlayingController
 | 
					%hook MPUNowPlayingController
 | 
				
			||||||
static NSString *cachedTitle;
 | 
						static NSString *cachedTitle;
 | 
				
			||||||
-(void)_updateCurrentNowPlaying{
 | 
						-(void)_updateCurrentNowPlaying{
 | 
				
			||||||
%orig;
 | 
							%orig;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
double delayInSeconds = 0.5;
 | 
							double delayInSeconds = 0.5;
 | 
				
			||||||
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
 | 
							dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
 | 
				
			||||||
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];
 | 
									[[objc_getClass("JBBulletinManager") sharedInstance] showBulletinWithTitle:self.currentNowPlayingMetadata.title message:self.currentNowPlayingMetadata.artist bundleID:self.nowPlayingAppDisplayID];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
							});
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
%end
 | 
					%end
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user