diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift index 2b4a3ff..d7ff466 100644 --- a/pass/AppDelegate.swift +++ b/pass/AppDelegate.swift @@ -34,6 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4) } } + UNUserNotificationCenter.current().delegate = NotificationCenterDispatcher.shared return true } diff --git a/pass/Controllers/PasswordNavigationViewController.swift b/pass/Controllers/PasswordNavigationViewController.swift index 231821a..ccd197c 100644 --- a/pass/Controllers/PasswordNavigationViewController.swift +++ b/pass/Controllers/PasswordNavigationViewController.swift @@ -99,7 +99,6 @@ class PasswordNavigationViewController: UIViewController { options: [] ) notificationCenter.setNotificationCategories([otpCategory]) - notificationCenter.delegate = NotificationCenterDispatcher.shared } override func viewWillAppear(_ animated: Bool) { diff --git a/pass/Controllers/SettingsTableViewController.swift b/pass/Controllers/SettingsTableViewController.swift index 8322d8f..e7ec8dd 100644 --- a/pass/Controllers/SettingsTableViewController.swift +++ b/pass/Controllers/SettingsTableViewController.swift @@ -225,7 +225,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele @objc func alertTextFieldDidChange(_ sender: UITextField) { // check whether we should enable the Save button in setPasscodeLockAlert - if let setPasscodeLockAlert = self.setPasscodeLockAlert, + if let setPasscodeLockAlert = setPasscodeLockAlert, let setPasscodeLockAlertTextFields0 = setPasscodeLockAlert.textFields?[0], let setPasscodeLockAlertTextFields1 = setPasscodeLockAlert.textFields?[1] { if sender == setPasscodeLockAlertTextFields0 || sender == setPasscodeLockAlertTextFields1 { diff --git a/pass/de.lproj/Localizable.strings b/pass/de.lproj/Localizable.strings index 9cd5cc3..4fa86eb 100644 --- a/pass/de.lproj/Localizable.strings +++ b/pass/de.lproj/Localizable.strings @@ -23,10 +23,10 @@ "None" = "Kein valides Token"; "ExpiresIn" = "(läuft in %ds ab)"; "OTPForPassword" = "Einmalpasswort für %@"; -"OTPForPasswordCopied" = "Einmalpasswort für %@ kopiert"; +"OTPHasBeenCopied" = "... wurde in die Zwischenablage kopiert"; "CopyToPasteboard" = "In Zwischenablage kopieren"; "AutoCopyOTP" = "OTPs automatisch kopieren"; -"AutoCopyOTPExplanation." = "Nachdem Login und Passwort automatisch in die vorgesehenen Felder gefüllt wurden, wird eine Benachrichtigung mit dem aktuellen Einmalpasswort angezeigt. Dieses kann in die Zwischenablage kopiert werden. Ist diese Option aktiviert, geschieht das Kopieren automatisch."; +"AutoCopyOTPExplanation." = "Nachdem Login und Passwort automatisch in die vorgesehenen Felder eingefügt wurden, wird eine Benachrichtigung mit dem aktuellen Einmalpasswort angezeigt. Dieses kann in die Zwischenablage kopiert werden. Ist diese Option aktiviert, geschieht das Kopieren automatisch."; // General (error) messages "Error" = "Fehler"; @@ -46,7 +46,7 @@ "PasswordGeneratorFlavor" = "Art"; "RememberPgpKeyPassphrase" = "GPG-Schlüssel-Passwort merken"; "RememberGitCredentialPassphrase" = "Git-Server-Passwort merken"; -"EnableGPGID" = "Berücksichtige .gpg-id Dateien (experimentell)"; +"EnableGPGID" = "Berücksichtige .gpg-id Dateien (Beta)"; "ShowFolders" = "Ordner anzeigen"; "HidePasswordImages" = "Favicons verstecken"; "HidePasswordImagesExplanation." = "Favicons werden basierend auf der assoziierten URL geladen und in Passworteinträgen angezeigt. Aktiviere diese Option, um das Laden dieser Bilder zu unterbinden und sie nicht anzuzeigen."; diff --git a/pass/en.lproj/Localizable.strings b/pass/en.lproj/Localizable.strings index 40f3d27..ae4ca8d 100644 --- a/pass/en.lproj/Localizable.strings +++ b/pass/en.lproj/Localizable.strings @@ -23,7 +23,7 @@ "None" = "None"; "ExpiresIn" = "(expires in %ds)"; "OTPForPassword" = "One-time password for %@"; -"OTPForPasswordCopied" = "One-time password for %@ copied"; +"OTPHasBeenCopied" = "... has been copied to the pasteboard"; "CopyToPasteboard" = "Copy to pasteboard"; "AutoCopyOTP" = "Automatically Copy OTPs"; "AutoCopyOTPExplanation." = "After username and password have been auto-filled into a form by Pass, a notification is shown with the current one-time password which can be copied to the pasteboard. Enabling this option automatically copies the current one-time password."; @@ -46,7 +46,7 @@ "PasswordGeneratorFlavor" = "Style"; "RememberPgpKeyPassphrase" = "Remember PGP Key Passphrase"; "RememberGitCredentialPassphrase" = "Remember Git Credential Passphrase"; -"EnableGPGID" = "Enable .gpg-id (Experiment)"; +"EnableGPGID" = "Enable .gpg-id (Beta)"; "ShowFolders" = "Show Folders"; "HidePasswordImages" = "Hide Password Images"; "HidePasswordImagesExplanation." = "Associated favicon images are loaded and shown based upon the URL associated with an entry. Enable this option to hide these images and prevent them from being loaded."; diff --git a/passKit/Helpers/NotificationCenterDispatcher.swift b/passKit/Helpers/NotificationCenterDispatcher.swift index 2c411e4..b729ea9 100644 --- a/passKit/Helpers/NotificationCenterDispatcher.swift +++ b/passKit/Helpers/NotificationCenterDispatcher.swift @@ -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 = [ diff --git a/passKit/Parser/Parser.swift b/passKit/Parser/Parser.swift index 933bf13..1dab852 100644 --- a/passKit/Parser/Parser.swift +++ b/passKit/Parser/Parser.swift @@ -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 } }