Created
July 30, 2021 03:20
-
-
Save wf-adamhei/4b88ec80b7e00a4bc2d5ccc28ef040ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
private let WFAccessGroupKey: String = "WFAccessGroup" | |
private let WFCredentialHelperServiceKey: String = "WFCredentialHelperServiceName" | |
private let AccessPropertiesPlistName: String = "KeychainAccessGroupBridge-Dev" | |
private let TestAccountUsernameKey = "TestAccountUsernameKey" | |
private let TestAccountPasswordKey = "TestAccountUsernameKey" | |
private lazy var keychainWrapper: KeychainWrapper = { | |
guard let accessPropertiesUrl = Bundle.main.url(forResource: AccessPropertiesPlistName, withExtension: "plist"), | |
let keychainAccessProperties = NSDictionary(contentsOf: accessPropertiesUrl), | |
let keychainServiceName = keychainAccessProperties[WFCredentialHelperServiceKey] as? String, | |
let keychainAccessGroup = keychainAccessProperties[WFAccessGroupKey] as? String else { | |
fatalError("Unable to read contents of KeychainAccessGroupBridge-Dev.plist") | |
} | |
return KeychainWrapper(serviceName: keychainServiceName, | |
accessGroup: keychainAccessGroup) | |
}() | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
let args = CommandLine.arguments | |
let username = args[1] | |
let password = args[2] | |
keychainWrapper.set(username, forKey: TestAccountUsernameKey) | |
keychainWrapper.set(password, forKey: TestAccountPasswordKey) | |
exit(EXIT_SUCCESS) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment