Skip to content

Commit

Permalink
fix the crash reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinrue committed May 24, 2012
1 parent fe21aef commit bd0450a
Show file tree
Hide file tree
Showing 5 changed files with 557 additions and 468 deletions.
6 changes: 6 additions & 0 deletions ControlPlane.xcodeproj/project.pbxproj
Expand Up @@ -83,6 +83,7 @@
DA16392613D4B14A00E3F421 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = DA16392513D4B14A00E3F421 /* dsa_pub.pem */; }; DA16392613D4B14A00E3F421 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = DA16392513D4B14A00E3F421 /* dsa_pub.pem */; };
DA2B4381152161C800E94A1D /* ToggleTFTPAction.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2B4380152161C800E94A1D /* ToggleTFTPAction.m */; }; DA2B4381152161C800E94A1D /* ToggleTFTPAction.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2B4380152161C800E94A1D /* ToggleTFTPAction.m */; };
DA2B4385152161D900E94A1D /* ToggleFTPAction.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2B4384152161D900E94A1D /* ToggleFTPAction.m */; }; DA2B4385152161D900E94A1D /* ToggleFTPAction.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2B4384152161D900E94A1D /* ToggleFTPAction.m */; };
DA312CA3156DD42E009C1389 /* BWQuincyUI.m in Sources */ = {isa = PBXBuildFile; fileRef = DA312CA2156DD42E009C1389 /* BWQuincyUI.m */; };
DA41954D151C17F000FF7BA0 /* ActionSubmenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = DA41954C151C17F000FF7BA0 /* ActionSubmenuItem.m */; }; DA41954D151C17F000FF7BA0 /* ActionSubmenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = DA41954C151C17F000FF7BA0 /* ActionSubmenuItem.m */; };
DA4411A514EE03C9005E7B3B /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA4411A414EE03C9005E7B3B /* MapKit.framework */; }; DA4411A514EE03C9005E7B3B /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA4411A414EE03C9005E7B3B /* MapKit.framework */; };
DA461C0C14C33E3C0019594A /* NSString+ShellScriptHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DA461C0B14C33E3B0019594A /* NSString+ShellScriptHelper.m */; }; DA461C0C14C33E3C0019594A /* NSString+ShellScriptHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DA461C0B14C33E3B0019594A /* NSString+ShellScriptHelper.m */; };
Expand Down Expand Up @@ -373,6 +374,8 @@
DA2B4380152161C800E94A1D /* ToggleTFTPAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToggleTFTPAction.m; path = Source/ToggleTFTPAction.m; sourceTree = "<group>"; }; DA2B4380152161C800E94A1D /* ToggleTFTPAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToggleTFTPAction.m; path = Source/ToggleTFTPAction.m; sourceTree = "<group>"; };
DA2B4383152161D900E94A1D /* ToggleFTPAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToggleFTPAction.h; path = Source/ToggleFTPAction.h; sourceTree = "<group>"; }; DA2B4383152161D900E94A1D /* ToggleFTPAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToggleFTPAction.h; path = Source/ToggleFTPAction.h; sourceTree = "<group>"; };
DA2B4384152161D900E94A1D /* ToggleFTPAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToggleFTPAction.m; path = Source/ToggleFTPAction.m; sourceTree = "<group>"; }; DA2B4384152161D900E94A1D /* ToggleFTPAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ToggleFTPAction.m; path = Source/ToggleFTPAction.m; sourceTree = "<group>"; };
DA312CA1156DD42E009C1389 /* BWQuincyUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWQuincyUI.h; sourceTree = "<group>"; };
DA312CA2156DD42E009C1389 /* BWQuincyUI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWQuincyUI.m; sourceTree = "<group>"; };
DA41954B151C17EF00FF7BA0 /* ActionSubmenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActionSubmenuItem.h; path = Source/ActionSubmenuItem.h; sourceTree = "<group>"; }; DA41954B151C17EF00FF7BA0 /* ActionSubmenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActionSubmenuItem.h; path = Source/ActionSubmenuItem.h; sourceTree = "<group>"; };
DA41954C151C17F000FF7BA0 /* ActionSubmenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ActionSubmenuItem.m; path = Source/ActionSubmenuItem.m; sourceTree = "<group>"; }; DA41954C151C17F000FF7BA0 /* ActionSubmenuItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ActionSubmenuItem.m; path = Source/ActionSubmenuItem.m; sourceTree = "<group>"; };
DA4411A414EE03C9005E7B3B /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Frameworks/MapKit.framework; sourceTree = "<group>"; }; DA4411A414EE03C9005E7B3B /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Frameworks/MapKit.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -826,6 +829,8 @@
DAF2F81B150EE5960040DDC7 /* BWQuincyMain.nib */, DAF2F81B150EE5960040DDC7 /* BWQuincyMain.nib */,
DAF2F81C150EE5960040DDC7 /* BWQuincyManager.h */, DAF2F81C150EE5960040DDC7 /* BWQuincyManager.h */,
DAF2F81D150EE5960040DDC7 /* BWQuincyManager.m */, DAF2F81D150EE5960040DDC7 /* BWQuincyManager.m */,
DA312CA1156DD42E009C1389 /* BWQuincyUI.h */,
DA312CA2156DD42E009C1389 /* BWQuincyUI.m */,
DAF2F81E150EE5960040DDC7 /* Quincy-Info.plist */, DAF2F81E150EE5960040DDC7 /* Quincy-Info.plist */,
DAF2F81F150EE5960040DDC7 /* Quincy-Prefix.pch */, DAF2F81F150EE5960040DDC7 /* Quincy-Prefix.pch */,
); );
Expand Down Expand Up @@ -1274,6 +1279,7 @@
DA2B4385152161D900E94A1D /* ToggleFTPAction.m in Sources */, DA2B4385152161D900E94A1D /* ToggleFTPAction.m in Sources */,
DAC672FE152235E800F1C7A1 /* ToggleWebSharingAction.m in Sources */, DAC672FE152235E800F1C7A1 /* ToggleWebSharingAction.m in Sources */,
DA8E283F156BCAD50040FC35 /* ToggleRemoteLoginAction.m in Sources */, DA8E283F156BCAD50040FC35 /* ToggleRemoteLoginAction.m in Sources */,
DA312CA3156DD42E009C1389 /* BWQuincyUI.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
Expand Down
172 changes: 61 additions & 111 deletions External Source/Quincy/BWQuincyManager.h
Expand Up @@ -29,72 +29,69 @@


#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>


#define CRASHREPORTSENDER_MAX_CONSOLE_SIZE 50000

typedef enum CrashAlertType { typedef enum CrashAlertType {
CrashAlertTypeSend = 0, CrashAlertTypeSend = 0,
CrashAlertTypeFeedback = 1, CrashAlertTypeFeedback = 1,
} CrashAlertType; } CrashAlertType;


typedef enum CrashReportStatus { typedef enum CrashReportStatus {
// This app version is set to discontinued, no new crash reports accepted by the server // This app version is set to discontinued, no new crash reports accepted by the server
CrashReportStatusFailureVersionDiscontinued = -30, CrashReportStatusFailureVersionDiscontinued = -30,


// XML: Sender ersion string contains not allowed characters, only alphanumberical including space and . are allowed // XML: Sender ersion string contains not allowed characters, only alphanumberical including space and . are allowed
CrashReportStatusFailureXMLSenderVersionNotAllowed = -21, CrashReportStatusFailureXMLSenderVersionNotAllowed = -21,


// XML: Version string contains not allowed characters, only alphanumberical including space and . are allowed // XML: Version string contains not allowed characters, only alphanumberical including space and . are allowed
CrashReportStatusFailureXMLVersionNotAllowed = -20, CrashReportStatusFailureXMLVersionNotAllowed = -20,


// SQL for adding a symoblicate todo entry in the database failed // SQL for adding a symoblicate todo entry in the database failed
CrashReportStatusFailureSQLAddSymbolicateTodo = -18, CrashReportStatusFailureSQLAddSymbolicateTodo = -18,


// SQL for adding crash log in the database failed // SQL for adding crash log in the database failed
CrashReportStatusFailureSQLAddCrashlog = -17, CrashReportStatusFailureSQLAddCrashlog = -17,


// SQL for adding a new version in the database failed // SQL for adding a new version in the database failed
CrashReportStatusFailureSQLAddVersion = -16, CrashReportStatusFailureSQLAddVersion = -16,
// SQL for checking if the version is already added in the database failed // SQL for checking if the version is already added in the database failed
CrashReportStatusFailureSQLCheckVersionExists = -15, CrashReportStatusFailureSQLCheckVersionExists = -15,
// SQL for creating a new pattern for this bug and set amount of occurrances to 1 in the database failed // SQL for creating a new pattern for this bug and set amount of occurrances to 1 in the database failed
CrashReportStatusFailureSQLAddPattern = -14, CrashReportStatusFailureSQLAddPattern = -14,
// SQL for checking the status of the bugfix version in the database failed // SQL for checking the status of the bugfix version in the database failed
CrashReportStatusFailureSQLCheckBugfixStatus = -13, CrashReportStatusFailureSQLCheckBugfixStatus = -13,
// SQL for updating the occurances of this pattern in the database failed // SQL for updating the occurances of this pattern in the database failed
CrashReportStatusFailureSQLUpdatePatternOccurances = -12, CrashReportStatusFailureSQLUpdatePatternOccurances = -12,
// SQL for getting all the known bug patterns for the current app version in the database failed // SQL for getting all the known bug patterns for the current app version in the database failed
CrashReportStatusFailureSQLFindKnownPatterns = -11, CrashReportStatusFailureSQLFindKnownPatterns = -11,
// SQL for finding the bundle identifier in the database failed // SQL for finding the bundle identifier in the database failed
CrashReportStatusFailureSQLSearchAppName = -10, CrashReportStatusFailureSQLSearchAppName = -10,
// the post request didn't contain valid data // the post request didn't contain valid data
CrashReportStatusFailureInvalidPostData = -3, CrashReportStatusFailureInvalidPostData = -3,
// incoming data may not be added, because e.g. bundle identifier wasn't found // incoming data may not be added, because e.g. bundle identifier wasn't found
CrashReportStatusFailureInvalidIncomingData = -2, CrashReportStatusFailureInvalidIncomingData = -2,
// database cannot be accessed, check hostname, username, password and database name settings in config.php // database cannot be accessed, check hostname, username, password and database name settings in config.php
CrashReportStatusFailureDatabaseNotAvailable = -1, CrashReportStatusFailureDatabaseNotAvailable = -1,
CrashReportStatusUnknown = 0, CrashReportStatusUnknown = 0,
CrashReportStatusAssigned = 1, CrashReportStatusAssigned = 1,
CrashReportStatusSubmitted = 2, CrashReportStatusSubmitted = 2,
CrashReportStatusAvailable = 3, CrashReportStatusAvailable = 3,
} CrashReportStatus; } CrashReportStatus;




@class BWQuincyUI; @class BWQuincyUI;


// This protocol is used to send the image updates
@protocol BWQuincyManagerDelegate <NSObject> @protocol BWQuincyManagerDelegate <NSObject>


@required @required
Expand All @@ -107,36 +104,34 @@ typedef enum CrashReportStatus {
// Return the description the crashreport should contain, empty by default. The string will automatically be wrapped into <[DATA[ ]]>, so make sure you don't do that in your string. // Return the description the crashreport should contain, empty by default. The string will automatically be wrapped into <[DATA[ ]]>, so make sure you don't do that in your string.
-(NSString *) crashReportDescription; -(NSString *) crashReportDescription;


@optional

// Return the userid the crashreport should contain, empty by default // Return the userid the crashreport should contain, empty by default
-(NSString *) crashReportUserID; -(NSString *) crashReportUserID;


// Return the contact value (e.g. email) the crashreport should contain, empty by default // Return the contact value (e.g. email) the crashreport should contain, empty by default
-(NSString *) crashReportContact; -(NSString *) crashReportContact;
@end @end



@interface BWQuincyManager : NSObject @interface BWQuincyManager : NSObject
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
<NSXMLParserDelegate> <NSXMLParserDelegate>
#endif #endif
{ {
CrashReportStatus _serverResult; CrashReportStatus _serverResult;

NSInteger _statusCode;
NSInteger _statusCode;


NSMutableString *_contentOfProperty; NSMutableString *_contentOfProperty;


id _delegate; id<BWQuincyManagerDelegate> _delegate;


NSString *_submissionURL; NSString *_submissionURL;
NSString *_companyName; NSString *_companyName;
NSString *_appIdentifier; NSString *_appIdentifier;
BOOL _autoSubmitCrashReport; BOOL _autoSubmitCrashReport;


NSString *_crashFile; NSString *_crashFile;
BWQuincyUI *_quincyUI; BWQuincyUI *_quincyUI;
} }


- (NSString*) modelVersion; - (NSString*) modelVersion;
Expand Down Expand Up @@ -172,48 +167,3 @@ typedef enum CrashReportStatus {
- (NSString *) applicationVersion; - (NSString *) applicationVersion;


@end @end


@interface BWQuincyUI : NSWindowController {
IBOutlet NSTextField *descriptionTextField;
IBOutlet NSTextView *crashLogTextView;

IBOutlet NSTextField *noteText;

IBOutlet NSButton *showButton;
IBOutlet NSButton *hideButton;
IBOutlet NSButton *cancelButton;
IBOutlet NSButton *submitButton;

BWQuincyManager *_delegate;

NSString *_xml;

NSString *_crashFile;
NSString *_companyName;
NSString *_applicationName;

NSMutableString *_consoleContent;
NSString *_crashLogContent;

BOOL showComments;
BOOL showDetails;
}

- (id)init:(id)delegate crashFile:(NSString *)crashFile companyName:(NSString *)companyName applicationName:(NSString *)applicationName;

- (void) askCrashReportDetails;

- (IBAction) cancelReport:(id)sender;
- (IBAction) submitReport:(id)sender;
- (IBAction) showDetails:(id)sender;
- (IBAction) hideDetails:(id)sender;
- (IBAction) showComments:(id)sender;

- (BOOL)showComments;
- (void)setShowComments:(BOOL)value;

- (BOOL)showDetails;
- (void)setShowDetails:(BOOL)value;

@end

0 comments on commit bd0450a

Please sign in to comment.