Changed code formatting. Added #ifdef for JMC legacy code.

This commit is contained in:
Thomas Dohmke 2011-12-19 07:58:27 +01:00
parent 52fbff9682
commit 71aab1cc1e

View File

@ -61,15 +61,18 @@
} }
#endif #endif
+(id)jmcInstance { + (id)jmcInstance {
id jmcClass = NSClassFromString(@"JMC");
id jmcClass = NSClassFromString(@"JMC"); if ((jmcClass) && ([jmcClass respondsToSelector:@selector(sharedInstance)])) {
if (jmcClass && [jmcClass respondsToSelector:@selector(sharedInstance)]) { return [jmcClass performSelector:@selector(sharedInstance)];
return [jmcClass performSelector:@selector(sharedInstance)]; }
} else if (jmcClass && [jmcClass respondsToSelector:@selector(instance)]) { #ifdef JMC_LEGACY
return [jmcClass performSelector:@selector(instance)]; // legacy pre (JMC 1.0.11) support else if ((jmcClass) && ([jmcClass respondsToSelector:@selector(instance)])) {
} return [jmcClass performSelector:@selector(instance)]; // legacy pre (JMC 1.0.11) support
return nil; }
#endif
return nil;
} }
+ (BOOL)isJMCActive { + (BOOL)isJMCActive {
@ -78,14 +81,12 @@
} }
+ (BOOL)isJMCPresent { + (BOOL)isJMCPresent {
return [self jmcInstance] != nil;
return [self jmcInstance] != nil;
} }
#pragma mark - Private Class Methods #pragma mark - Private Class Methods
+ (void)disableJMCCrashReporter { + (void)disableJMCCrashReporter {
id jmcInstance = [self jmcInstance]; id jmcInstance = [self jmcInstance];
id jmcOptions = [jmcInstance performSelector:@selector(options)]; id jmcOptions = [jmcInstance performSelector:@selector(options)];
SEL crashReporterSelector = @selector(setCrashReportingEnabled:); SEL crashReporterSelector = @selector(setCrashReportingEnabled:);
@ -101,7 +102,6 @@
} }
+ (BOOL)checkJMCConfiguration:(NSDictionary *)configuration { + (BOOL)checkJMCConfiguration:(NSDictionary *)configuration {
return (([[configuration valueForKey:@"enabled"] boolValue]) && return (([[configuration valueForKey:@"enabled"] boolValue]) &&
([[configuration valueForKey:@"url"] length] > 0) && ([[configuration valueForKey:@"url"] length] > 0) &&
([[configuration valueForKey:@"key"] length] > 0) && ([[configuration valueForKey:@"key"] length] > 0) &&
@ -109,7 +109,6 @@
} }
+ (void)applyJMCConfiguration:(NSDictionary *)configuration { + (void)applyJMCConfiguration:(NSDictionary *)configuration {
id jmcInstance = [self jmcInstance]; id jmcInstance = [self jmcInstance];
SEL configureSelector = @selector(configureJiraConnect:projectKey:apiKey:); SEL configureSelector = @selector(configureJiraConnect:projectKey:apiKey:);