Fix issues with OTP notification (#517)

* Use "Beta" since this is what Apple uses too
* Actually copy the OTP if the option is set
* Shorten notification text to make it fit to smaller screens
* Set notification center delegate before app launches
* Fix SwiftFormat issue fixed with version 0.48.12
This commit is contained in:
Danny Mösch 2021-10-04 02:20:22 +02:00 committed by GitHub
parent 32b7c9b635
commit 3eea063d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 10 deletions

View file

@ -28,10 +28,11 @@ public class NotificationCenterDispatcher: NSObject, UNUserNotificationCenterDel
return
}
let content = UNMutableNotificationContent()
content.title = "OTPForPassword".localize(password.name)
if Defaults.autoCopyOTP {
content.title = "OTPForPasswordCopied".localize(password.name)
content.body = "OTPHasBeenCopied".localize()
UIPasteboard.general.string = otp
} else {
content.title = "OTPForPassword".localize(password.name)
content.body = otp
content.categoryIdentifier = Globals.otpNotificationCategory
content.userInfo = [

View file

@ -17,7 +17,7 @@ class Parser {
init(plainText: String) {
let splittedPlainText = plainText.splitByNewline()
firstLine = splittedPlainText.first!
self.firstLine = splittedPlainText.first!
self.additionsSection = splittedPlainText[1...].joined(separator: "\n")
self.purgedAdditionalLines = splittedPlainText[1...].filter { !$0.isEmpty }
}