diff --git a/ios/Runner/en.lproj/Localizable.strings b/ios/Runner/en.lproj/Localizable.strings index c782079a1..540d1e678 100644 --- a/ios/Runner/en.lproj/Localizable.strings +++ b/ios/Runner/en.lproj/Localizable.strings @@ -1 +1,2 @@ -"newMessageInTwakeMail" = "You have new emails"; \ No newline at end of file +"newMessageInTwakeMail" = "You have new emails"; +"newNotificationInTwakeMail" = "You have a new notification"; \ No newline at end of file diff --git a/ios/Runner/fr.lproj/Localizable.strings b/ios/Runner/fr.lproj/Localizable.strings index dbbcb0209..7ca7ad830 100644 --- a/ios/Runner/fr.lproj/Localizable.strings +++ b/ios/Runner/fr.lproj/Localizable.strings @@ -1 +1,2 @@ -"newMessageInTwakeMail" = "Vous avez de nouveaux e-mails"; \ No newline at end of file +"newMessageInTwakeMail" = "Vous avez de nouveaux e-mails"; +"newNotificationInTwakeMail" = "Vous avez une nouvelle notification"; \ No newline at end of file diff --git a/ios/Runner/ru.lproj/Localizable.strings b/ios/Runner/ru.lproj/Localizable.strings index 58e8e9a21..d62564b2c 100644 --- a/ios/Runner/ru.lproj/Localizable.strings +++ b/ios/Runner/ru.lproj/Localizable.strings @@ -1 +1,2 @@ -"newMessageInTwakeMail" = "У вас есть новые электронные письма"; \ No newline at end of file +"newMessageInTwakeMail" = "У вас есть новые электронные письма"; +"newNotificationInTwakeMail" = "У вас новое объявление"; \ No newline at end of file diff --git a/ios/Runner/vi.lproj/Localizable.strings b/ios/Runner/vi.lproj/Localizable.strings index 3404052eb..69c8c5338 100644 --- a/ios/Runner/vi.lproj/Localizable.strings +++ b/ios/Runner/vi.lproj/Localizable.strings @@ -1 +1,2 @@ -"newMessageInTwakeMail" = "Bạn có email mới"; \ No newline at end of file +"newMessageInTwakeMail" = "Bạn có email mới"; +"newNotificationInTwakeMail" = "Bạn có thông báo mới"; \ No newline at end of file diff --git a/ios/TwakeMailNSE/NotificationService.swift b/ios/TwakeMailNSE/NotificationService.swift index 576bb0dd3..07a492cb0 100644 --- a/ios/TwakeMailNSE/NotificationService.swift +++ b/ios/TwakeMailNSE/NotificationService.swift @@ -4,6 +4,7 @@ import SwiftUI class NotificationService: UNNotificationServiceExtension { private let newEmailDefaultMessageKey: String = "newMessageInTwakeMail" + private let newNotificationDefaultMessageKey: String = "newNotificationInTwakeMail" private var handler: ((UNNotificationContent) -> Void)? private var modifiedContent: UNMutableNotificationContent? @@ -16,11 +17,11 @@ class NotificationService: UNNotificationServiceExtension { modifiedContent = (request.content.mutableCopy() as? UNMutableNotificationContent) self.modifiedContent?.title = InfoPlistReader(bundle: .app).bundleDisplayName - self.modifiedContent?.body = NSLocalizedString(newEmailDefaultMessageKey, comment: "Localizable") self.modifiedContent?.badge = NSNumber(value: 1) guard let payloadData = request.content.userInfo as? [String: Any], !keychainController.retrieveSharingSessions().isEmpty else { + self.modifiedContent?.body = NSLocalizedString(newEmailDefaultMessageKey, comment: "Localizable") return self.notify() } @@ -29,6 +30,7 @@ class NotificationService: UNNotificationServiceExtension { await handleGetNewEmails(payloadData: payloadData) } } else { + self.modifiedContent?.body = NSLocalizedString(newEmailDefaultMessageKey, comment: "Localizable") return self.notify() } } @@ -44,6 +46,7 @@ class NotificationService: UNNotificationServiceExtension { let mapStateChanges: [String: [TypeName: String]] = PayloadParser.shared.parsingPayloadNotification(payloadData: payloadData) if (mapStateChanges.isEmpty) { + self.modifiedContent?.body = NSLocalizedString(newEmailDefaultMessageKey, comment: "Localizable") return self.notify() } else { guard let currentAccountId = mapStateChanges.keys.first, @@ -53,6 +56,7 @@ class NotificationService: UNNotificationServiceExtension { let oldEmailState = keychainSharingSession.emailState, newEmailState != oldEmailState, keychainSharingSession.tokenOIDC != nil || keychainSharingSession.basicAuth != nil else { + self.modifiedContent?.body = NSLocalizedString(newNotificationDefaultMessageKey, comment: "Localizable") return self.notify() } @@ -67,6 +71,7 @@ class NotificationService: UNNotificationServiceExtension { oidcScopes: keychainSharingSession.oidcScopes, onComplete: { (emails, errors) in if emails.isEmpty { + self.modifiedContent?.body = NSLocalizedString(self.newNotificationDefaultMessageKey, comment: "Localizable") return self.notify() } else { self.keychainController.updateEmailStateToKeychain(accountId: keychainSharingSession.accountId, newState: newEmailState)