diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 763d447ba..9383cfc81 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -55,7 +55,7 @@ CFBundleVersion - 2.16.1.2 + 2.16.1.3 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/Signal/src/AppDelegate.h b/Signal/src/AppDelegate.h index 07264aa0a..9ad08de12 100644 --- a/Signal/src/AppDelegate.h +++ b/Signal/src/AppDelegate.h @@ -10,5 +10,6 @@ extern NSString *const AppDelegateStoryboardMain; @interface AppDelegate : UIResponder +@property (atomic) BOOL isEnvironmentSetup; @end diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 1b029bb3b..82f632c69 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -490,6 +490,11 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; // Clean up any messages that expired since last launch immediately // and continue cleaning in the background. [[OWSDisappearingMessagesJob sharedJob] startIfNecessary]; + + // TODO remove this once we're sure our app boot process is coherent. + // Currently this happens *before* db registration is complete when + // launching the app directly, but *after* db registration is complete when + // the app is launched in the background, e.g. from a voip notification. [[OWSProfileManager sharedManager] ensureLocalProfileCached]; // Mark all "attempting out" messages as "unsent", i.e. any messages that were not successfully @@ -749,6 +754,11 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { + if (!self.isEnvironmentSetup) { + OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.tag, __PRETTY_FUNCTION__); + return; + } + [AppStoreRating preventPromptAtNextTest]; [[PushManager sharedManager] application:application didReceiveLocalNotification:notification]; } @@ -756,7 +766,13 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification - completionHandler:(void (^)())completionHandler { + completionHandler:(void (^)())completionHandler +{ + if (!self.isEnvironmentSetup) { + OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.tag, __PRETTY_FUNCTION__); + return; + } + [[PushManager sharedManager] application:application handleActionWithIdentifier:identifier forLocalNotification:notification @@ -767,7 +783,13 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo - completionHandler:(void (^)())completionHandler { + completionHandler:(void (^)())completionHandler +{ + if (!self.isEnvironmentSetup) { + OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.tag, __PRETTY_FUNCTION__); + return; + } + [[PushManager sharedManager] application:application handleActionWithIdentifier:identifier forLocalNotification:notification @@ -809,6 +831,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; [[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync]; [[OWSBatchMessageProcessor sharedInstance] handleAnyUnprocessedEnvelopesAsync]; + [[OWSProfileManager sharedManager] ensureLocalProfileCached]; + + self.isEnvironmentSetup = YES; + [OWSProfileManager.sharedManager fetchLocalUsersProfile]; // Make sure this manager is started. [OWSReadReceiptManager sharedManager]; diff --git a/Signal/translations/nl.lproj/Localizable.strings b/Signal/translations/nl.lproj/Localizable.strings index 77d5e5bf7..b9866243f 100644 --- a/Signal/translations/nl.lproj/Localizable.strings +++ b/Signal/translations/nl.lproj/Localizable.strings @@ -1109,7 +1109,7 @@ "PROFILE_VIEW_PROFILE_AVATAR_FIELD" = "Avatar"; /* Description of the user profile. */ -"PROFILE_VIEW_PROFILE_DESCRIPTION" = "Je Signal-profiel zal zichtbaar zijn voor je ocntacten, wanneer je nieuwe gesprekken begint, en wanneer je het deelt met andere gebruikers en groepen."; +"PROFILE_VIEW_PROFILE_DESCRIPTION" = "Je Signal-profiel zal zichtbaar zijn voor je contacten, wanneer je nieuwe gesprekken begint, en wanneer je het deelt met andere gebruikers en groepen."; /* Link to more information about the user profile. */ "PROFILE_VIEW_PROFILE_DESCRIPTION_LINK" = "Tik hier voor meer info.";