diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index cffeedd7a..21da763e2 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -52,6 +52,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; - (void)applicationDidEnterBackground:(UIApplication *)application { DDLogWarn(@"%@ applicationDidEnterBackground.", self.tag); + + [DDLog flushLog]; } - (void)applicationWillEnterForeground:(UIApplication *)application { @@ -68,6 +70,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; - (void)applicationWillTerminate:(UIApplication *)application { DDLogWarn(@"%@ applicationWillTerminate.", self.tag); + + [DDLog flushLog]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -312,6 +316,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; [application endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }); + + [DDLog flushLog]; } - (void)application:(UIApplication *)application @@ -543,6 +549,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; if (![TSStorageManager isDatabasePasswordAccessible]) { DDLogInfo(@"%@ exiting because we are in the background and the database password is not accessible.", self.tag); + [DDLog flushLog]; exit(0); } } diff --git a/Signal/src/contact/OWSContactsManager.m b/Signal/src/contact/OWSContactsManager.m index 9a950168d..2b2a35a96 100644 --- a/Signal/src/contact/OWSContactsManager.m +++ b/Signal/src/contact/OWSContactsManager.m @@ -159,7 +159,8 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"ADDRESSBOOK_RESTRICTED_ALERT_BUTTON", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - exit(0); + [DDLog flushLog]; + exit(0); }]]; [[UIApplication sharedApplication] diff --git a/Signal/src/environment/Environment.m b/Signal/src/environment/Environment.m index ff58d082b..c0154979a 100644 --- a/Signal/src/environment/Environment.m +++ b/Signal/src/environment/Environment.m @@ -312,10 +312,26 @@ static Environment *environment = nil; } + (void)resetAppData { + // This _should_ be wiped out below. + DDLogError(@"%@ %s", self.tag, __PRETTY_FUNCTION__); + [DDLog flushLog]; + [[TSStorageManager sharedManager] resetSignalStorage]; [Environment.preferences clear]; [DebugLogger.sharedLogger wipeLogs]; exit(0); } +#pragma mark - Logging + ++ (NSString *)tag +{ + return [NSString stringWithFormat:@"[%@]", self.class]; +} + +- (NSString *)tag +{ + return self.class.tag; +} + @end diff --git a/Signal/src/environment/VersionMigrations.m b/Signal/src/environment/VersionMigrations.m index 543d712de..49e9cb3c8 100644 --- a/Signal/src/environment/VersionMigrations.m +++ b/Signal/src/environment/VersionMigrations.m @@ -59,6 +59,7 @@ UIAlertAction *quitAction = [UIAlertAction actionWithTitle:@"Quit" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { + [DDLog flushLog]; exit(0); }]; [alertController addAction:quitAction];