From 4aee9f81b547046164bad62ad5a96de35d2e1270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Spie=C3=9F?= Date: Thu, 24 Apr 2014 15:38:31 +0200 Subject: [PATCH] Small optimizations --- Classes/BITCrashManager.h | 2 +- Classes/BITCrashManager.m | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Classes/BITCrashManager.h b/Classes/BITCrashManager.h index 0b7c2a7582..76dd986676 100644 --- a/Classes/BITCrashManager.h +++ b/Classes/BITCrashManager.h @@ -265,7 +265,7 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) { @return BOOl if the input is a valid option @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 diff --git a/Classes/BITCrashManager.m b/Classes/BITCrashManager.m index e4561fac59..8fa17d2214 100644 --- a/Classes/BITCrashManager.m +++ b/Classes/BITCrashManager.m @@ -496,7 +496,7 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus"; } -- (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput withCrashMetaDescription:(NSString *)metaDescription{ +- (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput crashMetaDescription:(NSString *)metaDescription{ switch (userInput) { case BITCrashManagerUserInputDontSend: if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashManagerWillCancelSendingCrashReport:)]) { @@ -522,6 +522,11 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus"; [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]; return YES; @@ -985,13 +990,13 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus"; - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0: - [self handleUserInput:BITCrashManagerUserInputDontSend withCrashMetaDescription:nil]; + [self handleUserInput:BITCrashManagerUserInputDontSend crashMetaDescription:nil]; break; case 1: - [self handleUserInput:BITCrashManagerUserInputSend withCrashMetaDescription:nil]; + [self handleUserInput:BITCrashManagerUserInputSend crashMetaDescription:nil]; break; case 2: - [self handleUserInput:BITCrashManagerUserInputAlwaysSend withCrashMetaDescription:nil]; + [self handleUserInput:BITCrashManagerUserInputAlwaysSend crashMetaDescription:nil]; break; } }