aboutsummaryrefslogtreecommitdiff
path: root/src/client/ios/Breakpad.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/ios/Breakpad.mm')
-rw-r--r--src/client/ios/Breakpad.mm38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm
index c2a4202a..d7dc78c6 100644
--- a/src/client/ios/Breakpad.mm
+++ b/src/client/ios/Breakpad.mm
@@ -161,6 +161,7 @@ class Breakpad {
NSArray *CrashReportsToUpload();
NSString *NextCrashReportToUpload();
NSDictionary *NextCrashReportConfiguration();
+ NSDate *DateOfMostRecentCrashReport();
void UploadNextReport(NSDictionary *server_parameters);
void UploadReportWithConfiguration(NSDictionary *configuration,
NSDictionary *server_parameters);
@@ -468,6 +469,30 @@ NSDictionary *Breakpad::NextCrashReportConfiguration() {
}
//=============================================================================
+NSDate *Breakpad::DateOfMostRecentCrashReport() {
+ NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY);
+ if (!directory) {
+ return nil;
+ }
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSArray *dirContents = [fileManager contentsOfDirectoryAtPath:directory error:nil];
+ NSArray *dumps = [dirContents filteredArrayUsingPredicate:[NSPredicate
+ predicateWithFormat:@"self ENDSWITH '.dmp'"]];
+ NSDate *mostRecentCrashReportDate = nil;
+ for (NSString *dump in dumps) {
+ NSString *filePath = [directory stringByAppendingPathComponent:dump];
+ NSDate *crashReportDate =
+ [[fileManager attributesOfItemAtPath:filePath error:nil] fileCreationDate];
+ if (!mostRecentCrashReportDate) {
+ mostRecentCrashReportDate = crashReportDate;
+ } else if (crashReportDate) {
+ mostRecentCrashReportDate = [mostRecentCrashReportDate laterDate:crashReportDate];
+ }
+ }
+ return mostRecentCrashReportDate;
+}
+
+//=============================================================================
void Breakpad::HandleNetworkResponse(NSDictionary *configuration,
NSData *data,
NSError *error) {
@@ -841,6 +866,19 @@ NSDictionary *BreakpadGetNextReportConfiguration(BreakpadRef ref) {
}
//=============================================================================
+NSDate *BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref) {
+ try {
+ Breakpad *breakpad = (Breakpad *)ref;
+ if (breakpad) {
+ return breakpad->DateOfMostRecentCrashReport();
+ }
+ } catch (...) { // don't let exceptions leave this C API
+ fprintf(stderr, "BreakpadGetDateOfMostRecentCrashReport() : error\n");
+ }
+ return nil;
+}
+
+//=============================================================================
void BreakpadUploadReportWithParametersAndConfiguration(
BreakpadRef ref,
NSDictionary *server_parameters,