diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift index 66ee47f..7b20e1a 100644 --- a/pass/AppDelegate.swift +++ b/pass/AppDelegate.swift @@ -29,7 +29,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { SVProgressHUD.setMinimumSize(CGSize(width: 150, height: 100)) passcodeLockPresenter.present() if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem { - if shortcutItem.type == "me.mssun.passforios.search" { + var searchType = Bundle.main.bundleIdentifier! + searchType.append("search") + if shortcutItem.type == searchType { self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4) } } @@ -42,7 +44,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) { - if shortcutItem.type == "me.mssun.passforios.search" { + var searchType = Bundle.main.bundleIdentifier! + searchType.append("search") + if shortcutItem.type == searchType { let tabBarController = self.window!.rootViewController as! UITabBarController tabBarController.selectedIndex = 0 let navigationController = tabBarController.selectedViewController as! UINavigationController diff --git a/pass/Helpers/Utils.swift b/pass/Helpers/Utils.swift index 4b749ff..8bd0be4 100644 --- a/pass/Helpers/Utils.swift +++ b/pass/Helpers/Utils.swift @@ -72,7 +72,7 @@ class Utils { } static func getPasswordFromKeychain(name: String) -> String? { - let keychain = Keychain(service: "me.mssun.passforios") + let keychain = Keychain(service: Bundle.main.bundleIdentifier!) do { return try keychain.getString(name) } catch { @@ -82,11 +82,11 @@ class Utils { } static func addPasswordToKeychain(name: String, password: String?) { - let keychain = Keychain(service: "me.mssun.passforios") + let keychain = Keychain(service: Bundle.main.bundleIdentifier!) keychain[name] = password } static func removeKeychain(name: String) { - let keychain = Keychain(service: "me.mssun.passforios") + let keychain = Keychain(service: Bundle.main.bundleIdentifier!) do { try keychain.remove(name) } catch { @@ -94,7 +94,7 @@ class Utils { } } static func removeAllKeychain() { - let keychain = Keychain(service: "me.mssun.passforios") + let keychain = Keychain(service: Bundle.main.bundleIdentifier!) do { try keychain.removeAll() } catch {