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