mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Flush logs before exiting the app.
// FREEBIE
This commit is contained in:
parent
8da1e1399c
commit
49ba0ff942
|
@ -52,6 +52,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||||
DDLogWarn(@"%@ applicationDidEnterBackground.", self.tag);
|
DDLogWarn(@"%@ applicationDidEnterBackground.", self.tag);
|
||||||
|
|
||||||
|
[DDLog flushLog];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||||
|
@ -68,6 +70,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application
|
- (void)applicationWillTerminate:(UIApplication *)application
|
||||||
{
|
{
|
||||||
DDLogWarn(@"%@ applicationWillTerminate.", self.tag);
|
DDLogWarn(@"%@ applicationWillTerminate.", self.tag);
|
||||||
|
|
||||||
|
[DDLog flushLog];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
|
@ -312,6 +316,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||||
[application endBackgroundTask:bgTask];
|
[application endBackgroundTask:bgTask];
|
||||||
bgTask = UIBackgroundTaskInvalid;
|
bgTask = UIBackgroundTaskInvalid;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[DDLog flushLog];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application
|
- (void)application:(UIApplication *)application
|
||||||
|
@ -543,6 +549,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||||
|
|
||||||
if (![TSStorageManager isDatabasePasswordAccessible]) {
|
if (![TSStorageManager isDatabasePasswordAccessible]) {
|
||||||
DDLogInfo(@"%@ exiting because we are in the background and the database password is not accessible.", self.tag);
|
DDLogInfo(@"%@ exiting because we are in the background and the database password is not accessible.", self.tag);
|
||||||
|
[DDLog flushLog];
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,8 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
|
||||||
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ADDRESSBOOK_RESTRICTED_ALERT_BUTTON", nil)
|
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ADDRESSBOOK_RESTRICTED_ALERT_BUTTON", nil)
|
||||||
style:UIAlertActionStyleDefault
|
style:UIAlertActionStyleDefault
|
||||||
handler:^(UIAlertAction *action) {
|
handler:^(UIAlertAction *action) {
|
||||||
exit(0);
|
[DDLog flushLog];
|
||||||
|
exit(0);
|
||||||
}]];
|
}]];
|
||||||
|
|
||||||
[[UIApplication sharedApplication]
|
[[UIApplication sharedApplication]
|
||||||
|
|
|
@ -312,10 +312,26 @@ static Environment *environment = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)resetAppData {
|
+ (void)resetAppData {
|
||||||
|
// This _should_ be wiped out below.
|
||||||
|
DDLogError(@"%@ %s", self.tag, __PRETTY_FUNCTION__);
|
||||||
|
[DDLog flushLog];
|
||||||
|
|
||||||
[[TSStorageManager sharedManager] resetSignalStorage];
|
[[TSStorageManager sharedManager] resetSignalStorage];
|
||||||
[Environment.preferences clear];
|
[Environment.preferences clear];
|
||||||
[DebugLogger.sharedLogger wipeLogs];
|
[DebugLogger.sharedLogger wipeLogs];
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Logging
|
||||||
|
|
||||||
|
+ (NSString *)tag
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)tag
|
||||||
|
{
|
||||||
|
return self.class.tag;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
UIAlertAction *quitAction = [UIAlertAction actionWithTitle:@"Quit"
|
UIAlertAction *quitAction = [UIAlertAction actionWithTitle:@"Quit"
|
||||||
style:UIAlertActionStyleDefault
|
style:UIAlertActionStyleDefault
|
||||||
handler:^(UIAlertAction *_Nonnull action) {
|
handler:^(UIAlertAction *_Nonnull action) {
|
||||||
|
[DDLog flushLog];
|
||||||
exit(0);
|
exit(0);
|
||||||
}];
|
}];
|
||||||
[alertController addAction:quitAction];
|
[alertController addAction:quitAction];
|
||||||
|
|
Loading…
Reference in a new issue