1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#if HEARTBEAT_CHECK_PIRACY
+ (BOOL)isCracked {
#if TARGET_IPHONE_SIMULATOR
	return NO;
#else
	static BOOL isCracked = NO;
	static BOOL didCheck = NO;
	if(didCheck) return isCracked;
	
#if HEARTBEAT_PIRACY_THRESHOLD >= 1
	if([[[NSBundle mainBundle] infoDictionary] objectForKey:@"SignerIdentity"] != nil) {
		#if HEARTBEAT_PIRACY_THRESHOLD >= 2
		NSString* infoPath = [[NSBundle mainBundle] pathForResource:@"Info" ofType:@"plist"];
		if([[NSString stringWithContentsOfFile:infoPath encoding:NSUTF8StringEncoding error:NULL] rangeOfString:@"</plist>"].location != NSNotFound) {
			#if HEARTBEAT_PIRACY_THRESHOLD >= 3
			NSDate* infoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:infoPath traverseLink:YES] fileModificationDate];
			NSDate* pkgInfoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"PkgInfo"] traverseLink:YES] fileModificationDate];
			if([infoModifiedDate timeIntervalSinceReferenceDate] > [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) {		
			#endif
		#endif
				isCracked = YES;
		#if HEARTBEAT_PIRACY_THRESHOLD >= 2
			#if HEARTBEAT_PIRACY_THRESHOLD >= 3
			}
			#endif
		}
		#endif
	}	
#endif
	
	didCheck = YES;
	
	return isCracked;
#endif
}
#endif