mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-30 15:10:56 +00:00
Move calculation of time interval between startup and crash further up in the code
This allows the delegate, e.g. applicationLog, to know about the interval and e.g. include it in the log file
This commit is contained in:
parent
70e7c9114e
commit
c754c9f68e
@ -316,6 +316,15 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
|
||||
if (crashData == nil) {
|
||||
BITHockeyLog(@"ERROR: Could not load crash report: %@", error);
|
||||
} else {
|
||||
// get the startup timestamp from the crash report, and the file timestamp to calculate the timeinterval when the crash happened after startup
|
||||
PLCrashReport *report = [[PLCrashReport alloc] initWithData:crashData error:&error];
|
||||
|
||||
if ([report.applicationInfo respondsToSelector:@selector(applicationStartupTimestamp)]) {
|
||||
if (report.systemInfo.timestamp && report.applicationInfo.applicationStartupTimestamp) {
|
||||
_timeintervalCrashInLastSessionOccured = [report.systemInfo.timestamp timeIntervalSinceDate:report.applicationInfo.applicationStartupTimestamp];
|
||||
}
|
||||
}
|
||||
|
||||
[crashData writeToFile:[_crashesDir stringByAppendingPathComponent: cacheFilename] atomically:YES];
|
||||
|
||||
// write the meta file
|
||||
@ -340,15 +349,6 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
|
||||
} else {
|
||||
BITHockeyLog(@"ERROR: Writing crash meta data failed. %@", error);
|
||||
}
|
||||
|
||||
// get the startup timestamp from the crash report, and the file timestamp to calculate the timeinterval when the crash happened after startup
|
||||
PLCrashReport *report = [[PLCrashReport alloc] initWithData:crashData error:&error];
|
||||
|
||||
if ([report.applicationInfo respondsToSelector:@selector(applicationStartupTimestamp)]) {
|
||||
if (report.systemInfo.timestamp && report.applicationInfo.applicationStartupTimestamp) {
|
||||
_timeintervalCrashInLastSessionOccured = [report.systemInfo.timestamp timeIntervalSinceDate:report.applicationInfo.applicationStartupTimestamp];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user