Small optimizations

This commit is contained in:
Lukas Spieß 2014-04-24 15:38:31 +02:00
parent 27cc84a84c
commit 4aee9f81b5
2 changed files with 10 additions and 5 deletions

View File

@ -265,7 +265,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
@return BOOl if the input is a valid option @return BOOl if the input is a valid option
@see BITCrashManagerUserInput @see BITCrashManagerUserInput
*/ */
- (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput withCrashMetaDescription:metaDescription; - (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput crashMetaDescription:metaDescription;
/** /**
Property that lets you set a custom block which handles showing a custom UI and asking the user Property that lets you set a custom block which handles showing a custom UI and asking the user

View File

@ -496,7 +496,7 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
} }
- (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput withCrashMetaDescription:(NSString *)metaDescription{ - (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput crashMetaDescription:(NSString *)metaDescription{
switch (userInput) { switch (userInput) {
case BITCrashManagerUserInputDontSend: case BITCrashManagerUserInputDontSend:
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashManagerWillCancelSendingCrashReport:)]) { if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashManagerWillCancelSendingCrashReport:)]) {
@ -522,6 +522,11 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
[self.delegate crashManagerWillSendCrashReportsAlways:self]; [self.delegate crashManagerWillSendCrashReportsAlways:self];
} }
if (metaDescription && [metaDescription length] > 0) {
NSError *error;
[metaDescription writeToFile:[NSString stringWithFormat:@"%@_description.meta", [_crashesDir stringByAppendingPathComponent: _lastCrashFilename]] atomically:YES encoding:NSUTF8StringEncoding error:&error];
}
[self sendCrashReports]; [self sendCrashReports];
return YES; return YES;
@ -985,13 +990,13 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
switch (buttonIndex) { switch (buttonIndex) {
case 0: case 0:
[self handleUserInput:BITCrashManagerUserInputDontSend withCrashMetaDescription:nil]; [self handleUserInput:BITCrashManagerUserInputDontSend crashMetaDescription:nil];
break; break;
case 1: case 1:
[self handleUserInput:BITCrashManagerUserInputSend withCrashMetaDescription:nil]; [self handleUserInput:BITCrashManagerUserInputSend crashMetaDescription:nil];
break; break;
case 2: case 2:
[self handleUserInput:BITCrashManagerUserInputAlwaysSend withCrashMetaDescription:nil]; [self handleUserInput:BITCrashManagerUserInputAlwaysSend crashMetaDescription:nil];
break; break;
} }
} }