mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
start refactoring AlertView delegate
This commit is contained in:
@@ -58,6 +58,16 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerStatus) {
|
||||
BITCrashManagerStatusAutoSend = 2
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
|
||||
|
||||
BITCrashManagerUserInputDontSend,
|
||||
|
||||
BITCrashManagerUserInputSend,
|
||||
|
||||
BITCrashManagerUserInputAlwaysSend
|
||||
|
||||
};
|
||||
|
||||
|
||||
@protocol BITCrashManagerDelegate;
|
||||
|
||||
@@ -163,6 +173,10 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerStatus) {
|
||||
* the debugger during runtime, this may cause issues the Mach exception handler is enabled!
|
||||
* @see isDebuggerAttached
|
||||
*/
|
||||
|
||||
@property (nonatomic, assign) BITCrashManagerUserInput crashManagerUserInput;
|
||||
|
||||
|
||||
@property (nonatomic, assign, getter=isMachExceptionHandlerEnabled) BOOL enableMachExceptionHandler;
|
||||
|
||||
|
||||
|
||||
@@ -930,8 +930,13 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
|
||||
#pragma mark - UIAlertView Delegate
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
|
||||
switch (buttonIndex) {
|
||||
case 0:
|
||||
_crashManagerUserInput = buttonIndex;
|
||||
[self handleUserInput];
|
||||
}
|
||||
|
||||
- (void)handleUserInput {
|
||||
switch (_crashManagerUserInput) {
|
||||
case BITCrashManagerUserInputDontSend:
|
||||
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashManagerWillCancelSendingCrashReport:)]) {
|
||||
[self.delegate crashManagerWillCancelSendingCrashReport:self];
|
||||
}
|
||||
@@ -939,10 +944,10 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
|
||||
_sendingInProgress = NO;
|
||||
[self cleanCrashReports];
|
||||
break;
|
||||
case 1:
|
||||
case BITCrashManagerUserInputSend:
|
||||
[self sendCrashReports];
|
||||
break;
|
||||
case 2: {
|
||||
case BITCrashManagerUserInputAlwaysSend:
|
||||
_crashManagerStatus = BITCrashManagerStatusAutoSend;
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:_crashManagerStatus forKey:kBITCrashManagerStatus];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
@@ -953,11 +958,7 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
|
||||
[self sendCrashReports];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
_sendingInProgress = NO;
|
||||
[self cleanCrashReports];
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user