2 * Author: Andreas Linde <mail@andreaslinde.de>
5 * Copyright (c) 2011 Andreas Linde & Kent Sutherland.
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use,
12 * copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
30 #import <Cocoa/Cocoa.h>
32 typedef enum CrashAlertType {
33 CrashAlertTypeSend = 0,
34 CrashAlertTypeFeedback = 1,
37 typedef enum CrashReportStatus {
38 // This app version is set to discontinued, no new crash reports accepted by the server
39 CrashReportStatusFailureVersionDiscontinued = -30,
41 // XML: Sender ersion string contains not allowed characters, only alphanumberical including space and . are allowed
42 CrashReportStatusFailureXMLSenderVersionNotAllowed = -21,
44 // XML: Version string contains not allowed characters, only alphanumberical including space and . are allowed
45 CrashReportStatusFailureXMLVersionNotAllowed = -20,
47 // SQL for adding a symoblicate todo entry in the database failed
48 CrashReportStatusFailureSQLAddSymbolicateTodo = -18,
50 // SQL for adding crash log in the database failed
51 CrashReportStatusFailureSQLAddCrashlog = -17,
53 // SQL for adding a new version in the database failed
54 CrashReportStatusFailureSQLAddVersion = -16,
56 // SQL for checking if the version is already added in the database failed
57 CrashReportStatusFailureSQLCheckVersionExists = -15,
59 // SQL for creating a new pattern for this bug and set amount of occurrances to 1 in the database failed
60 CrashReportStatusFailureSQLAddPattern = -14,
62 // SQL for checking the status of the bugfix version in the database failed
63 CrashReportStatusFailureSQLCheckBugfixStatus = -13,
65 // SQL for updating the occurances of this pattern in the database failed
66 CrashReportStatusFailureSQLUpdatePatternOccurances = -12,
68 // SQL for getting all the known bug patterns for the current app version in the database failed
69 CrashReportStatusFailureSQLFindKnownPatterns = -11,
71 // SQL for finding the bundle identifier in the database failed
72 CrashReportStatusFailureSQLSearchAppName = -10,
74 // the post request didn't contain valid data
75 CrashReportStatusFailureInvalidPostData = -3,
77 // incoming data may not be added, because e.g. bundle identifier wasn't found
78 CrashReportStatusFailureInvalidIncomingData = -2,
80 // database cannot be accessed, check hostname, username, password and database name settings in config.php
81 CrashReportStatusFailureDatabaseNotAvailable = -1,
83 CrashReportStatusUnknown = 0,
85 CrashReportStatusAssigned = 1,
87 CrashReportStatusSubmitted = 2,
89 CrashReportStatusAvailable = 3,
95 @protocol BWQuincyManagerDelegate <NSObject>
99 // Invoked once the modal sheets are gone
100 - (void) showMainApplicationWindow;
102 // 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.
103 -(NSString *) crashReportDescription;
105 // Return the userid the crashreport should contain, empty by default
106 -(NSString *) crashReportUserID;
108 // Return the contact value (e.g. email) the crashreport should contain, empty by default
109 -(NSString *) crashReportContact;
113 @interface BWQuincyManager : NSObject
114 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
115 <NSXMLParserDelegate>
118 CrashReportStatus _serverResult;
119 NSInteger _statusCode;
121 NSMutableString *_contentOfProperty;
123 id<BWQuincyManagerDelegate> _delegate;
125 NSString *_submissionURL;
126 NSString *_companyName;
127 NSString *_appIdentifier;
128 BOOL _autoSubmitCrashReport;
130 NSString *_crashFile;
132 BWQuincyUI *_quincyUI;
135 - (NSString*) modelVersion;
137 + (BWQuincyManager *)sharedQuincyManager;
139 // submission URL defines where to send the crash reports to (required)
140 @property (nonatomic, retain) NSString *submissionURL;
142 // defines the company name to be shown in the crash reporting dialog
143 @property (nonatomic, retain) NSString *companyName;
145 // delegate is required
146 @property (nonatomic, assign) id <BWQuincyManagerDelegate> delegate;
148 // if YES, the crash report will be submitted without asking the user
149 // if NO, the user will be asked if the crash report can be submitted (default)
150 @property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport;
152 ///////////////////////////////////////////////////////////////////////////////////////////////////
155 // If you want to use HockeyApp instead of your own server, this is required
156 @property (nonatomic, retain) NSString *appIdentifier;
159 - (void) cancelReport;
160 - (void) sendReportCrash:(NSString*)crashContent
161 description:(NSString*)description;
163 - (NSString *) applicationName;
164 - (NSString *) applicationVersionString;
165 - (void)setApplicationVersion:(NSString *)appVersion;
166 - (NSString *) applicationVersion;