Show notification with OTP after providing password through extension (#509)
* Allow to do something with a password after providing it in the extension * Make fields non-nil * Show OTP in notification after providing a password through extension
This commit is contained in:
parent
5057528ad9
commit
763cddf540
9 changed files with 67 additions and 69 deletions
|
|
@ -9,6 +9,7 @@
|
|||
import passKit
|
||||
import SVProgressHUD
|
||||
import UIKit
|
||||
import UserNotifications
|
||||
|
||||
extension UIStoryboard {
|
||||
static var passwordNavigationViewController: PasswordNavigationViewController {
|
||||
|
|
@ -75,6 +76,12 @@ class PasswordNavigationViewController: UIViewController {
|
|||
configureTableView(in: parentPasswordEntity)
|
||||
configureNotification()
|
||||
configureSearchBar()
|
||||
requestNotificationPermission()
|
||||
}
|
||||
|
||||
private func requestNotificationPermission() {
|
||||
let permissionOptions = UNAuthorizationOptions(arrayLiteral: .alert)
|
||||
UNUserNotificationCenter.current().requestAuthorization(options: permissionOptions) { _, _ in }
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,13 @@ import SVProgressHUD
|
|||
import UIKit
|
||||
|
||||
class PasswordManager {
|
||||
weak var viewController: UIViewController?
|
||||
private let viewController: UIViewController
|
||||
|
||||
init(viewController: UIViewController) {
|
||||
self.viewController = viewController
|
||||
}
|
||||
|
||||
func providePasswordPasteboard(with passwordPath: String) {
|
||||
guard let viewController = viewController else {
|
||||
return
|
||||
}
|
||||
decryptPassword(in: viewController, with: passwordPath) { password in
|
||||
SecurePasteboard.shared.copy(textToCopy: password.password)
|
||||
SVProgressHUD.setDefaultMaskType(.black)
|
||||
|
|
@ -31,10 +28,6 @@ class PasswordManager {
|
|||
}
|
||||
|
||||
func addPassword(with password: Password) {
|
||||
guard let viewController = viewController else {
|
||||
return
|
||||
}
|
||||
|
||||
encryptPassword(in: viewController, with: password) {
|
||||
SVProgressHUD.setDefaultMaskType(.black)
|
||||
SVProgressHUD.setDefaultStyle(.light)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"HmacBased" = "HMAC-basiert";
|
||||
"None" = "Kein valides Token";
|
||||
"ExpiresIn" = "(läuft in %ds ab)";
|
||||
"OTPFor" = "Einmalpasswort für %@";
|
||||
|
||||
// General (error) messages
|
||||
"Error" = "Fehler";
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"HmacBased" = "HMAC-based";
|
||||
"None" = "None";
|
||||
"ExpiresIn" = "(expires in %ds)";
|
||||
"OTPFor" = "One-time Password for %@";
|
||||
|
||||
// General (error) messages
|
||||
"Error" = "Error";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue