diff --git a/Riot/API/RageShakeManager.m b/Riot/API/RageShakeManager.m index 3afee35b4..ea94c5909 100644 --- a/Riot/API/RageShakeManager.m +++ b/Riot/API/RageShakeManager.m @@ -79,8 +79,9 @@ static RageShakeManager* sharedInstance = nil; typeof(self) self = weakSelf; self->confirmationAlert = nil; - // TODO - //[self sendEmail:viewController withSnapshot:NO]; + BugReportViewController *bugReportViewController = [BugReportViewController bugReportViewController]; + bugReportViewController.reportCrash = YES; + [bugReportViewController showInViewController:viewController]; }]; [confirmationAlert showInViewController:viewController]; diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 3d3db99df..a4b82a2b9 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -458,6 +458,8 @@ // Bug report "bug_report_title" = "Bug Report"; "bug_report_description" = "Please describe the bug. What did you do? What did you expect to happen? What actually happened?"; +"bug_crash_report_title" = "Crash Report"; +"bug_crash_report_description" = "Please describe what you did before the crash:"; "bug_report_logs_description" = "In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:"; "bug_report_send_logs" = "Send logs"; "bug_report_send_screenshot" = "Send screenshot"; diff --git a/Riot/ViewController/BugReportViewController.h b/Riot/ViewController/BugReportViewController.h index fa74378a1..34cea1291 100644 --- a/Riot/ViewController/BugReportViewController.h +++ b/Riot/ViewController/BugReportViewController.h @@ -54,4 +54,10 @@ */ @property (nonatomic) UIImage *screenshot; +/** + Option to report a crash. + The crash log will sent in the report. + */ +@property (nonatomic) BOOL reportCrash; + @end diff --git a/Riot/ViewController/BugReportViewController.m b/Riot/ViewController/BugReportViewController.m index 4ccdefbe5..e1c429331 100644 --- a/Riot/ViewController/BugReportViewController.m +++ b/Riot/ViewController/BugReportViewController.m @@ -63,8 +63,6 @@ NSLog(@"%@", _screenshot); - _titleLabel.text = NSLocalizedStringFromTable(@"bug_report_title", @"Vector", nil); - _descriptionLabel.text = NSLocalizedStringFromTable(@"bug_report_description", @"Vector", nil); _logsDescriptionLabel.text = NSLocalizedStringFromTable(@"bug_report_logs_description", @"Vector", nil); _sendLogsLabel.text = NSLocalizedStringFromTable(@"bug_report_send_logs", @"Vector", nil); _sendScreenshotLabel.text = NSLocalizedStringFromTable(@"bug_report_send_screenshot", @"Vector", nil); @@ -76,7 +74,19 @@ _bugReportDescriptionTextView.text = nil; _bugReportDescriptionTextView.delegate = self; - _sendButton.enabled = NO; + if (_reportCrash) + { + _titleLabel.text = NSLocalizedStringFromTable(@"bug_crash_report_title", @"Vector", nil); + _descriptionLabel.text = NSLocalizedStringFromTable(@"bug_crash_report_description", @"Vector", nil); + } + else + { + _titleLabel.text = NSLocalizedStringFromTable(@"bug_report_title", @"Vector", nil); + _descriptionLabel.text = NSLocalizedStringFromTable(@"bug_report_description", @"Vector", nil); + + // Allow to send empty description for crash report but not for bug report + _sendButton.enabled = NO; + } _sendingContainer.hidden = YES; @@ -145,7 +155,9 @@ // Setup data to send //bugReportRestClient = [[MXBugReportRestClient alloc] initWithBugReportEndpoint:@"http://192.168.2.9:9110"]; - bugReportRestClient = [[MXBugReportRestClient alloc] initWithBugReportEndpoint:@"http://192.168.0.4:9110"]; + //bugReportRestClient = [[MXBugReportRestClient alloc] initWithBugReportEndpoint:@"http://192.168.0.4:9110"]; + bugReportRestClient = [[MXBugReportRestClient alloc] initWithBugReportEndpoint:@"http://172.20.10.2:9110"]; + // App info bugReportRestClient.appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]; // NO ? @@ -157,7 +169,7 @@ bugReportRestClient.deviceOS = [NSString stringWithFormat:@"%@ %@", [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]]; // Submit - [bugReportRestClient sendBugReport:_bugReportDescriptionTextView.text sendLogs:_sendLogs progress:^(MXBugReportState state, NSProgress *progress) { + [bugReportRestClient sendBugReport:_bugReportDescriptionTextView.text sendLogs:_sendLogs sendCrashLog:_reportCrash progress:^(MXBugReportState state, NSProgress *progress) { switch (state) { @@ -178,6 +190,13 @@ } success:^{ bugReportRestClient = nil; + + if (_reportCrash) + { + // Erase the crash log + [MXLogger deleteCrashLog]; + } + [self dismissViewControllerAnimated:YES completion:nil]; } failure:^(NSError *error) { @@ -205,6 +224,12 @@ } else { + if (_reportCrash) + { + // Erase the crash log + [MXLogger deleteCrashLog]; + } + // Else, lease the bug report screen [self dismissViewControllerAnimated:YES completion:nil]; }