diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 890a13395..be9a3d338 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -231,6 +231,21 @@ static NSTimeInterval launchStartedAt; if (![OWSPrimaryStorage isDatabasePasswordAccessible]) { DDLogInfo( @"%@ exiting because we are in the background and the database password is not accessible.", self.logTag); + + UILocalNotification *notification = [UILocalNotification new]; + NSString *messageFormat = NSLocalizedString(@"NOTIFICATION_BODY_PHONE_LOCKED_FORMAT", + @"Lock screen notification text presented after user powers on their device without unlocking. Embeds " + @"{{device model}} (either 'iPad' or 'iPhone')"); + notification.alertBody = [NSString stringWithFormat:messageFormat, UIDevice.currentDevice.localizedModel]; + + // Make sure we clear any existing notifications so that they don't start stacking up + // if the user receives multiple pushes. + [UIApplication.sharedApplication cancelAllLocalNotifications]; + [UIApplication.sharedApplication setApplicationIconBadgeNumber:0]; + + [[UIApplication sharedApplication] scheduleLocalNotification:notification]; + [UIApplication.sharedApplication setApplicationIconBadgeNumber:1]; + [DDLog flushLog]; exit(0); } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index bae7012ed..86061cd13 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1345,6 +1345,9 @@ /* Label for a button that lets users search for contacts by phone number */ "NO_CONTACTS_SEARCH_BY_PHONE_NUMBER" = "Find Contacts by Phone Number"; +/* Lock screen notification text presented after user powers on their device without unlocking. Embeds {{device model}} (either 'iPad' or 'iPhone') */ +"NOTIFICATION_BODY_PHONE_LOCKED_FORMAT" = "You must unlock your %@ once after restarting to receive Signal messages."; + /* No comment provided by engineer. */ "NOTIFICATION_SEND_FAILED" = "Your message failed to send to %@.";