(...args: any[])
| 213 | } |
| 214 | |
| 215 | export function login(...args: any[]): Promise<LoginResult> { |
| 216 | const options: LoginOptions = parseLoginOptions(args); |
| 217 | |
| 218 | return new Promise<LoginResult>((resolve, reject) => { |
| 219 | try { |
| 220 | const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert); |
| 221 | |
| 222 | const textFieldColor = getTextFieldColor(); |
| 223 | |
| 224 | alertController.addTextFieldWithConfigurationHandler((arg: UITextField) => { |
| 225 | arg.placeholder = 'Login'; |
| 226 | arg.placeholder = options.userNameHint ? options.userNameHint : ''; |
| 227 | arg.text = isString(options.userName) ? options.userName : ''; |
| 228 | |
| 229 | if (textFieldColor) { |
| 230 | arg.textColor = arg.tintColor = textFieldColor.ios; |
| 231 | } |
| 232 | }); |
| 233 | |
| 234 | alertController.addTextFieldWithConfigurationHandler((arg: UITextField) => { |
| 235 | arg.placeholder = 'Password'; |
| 236 | arg.secureTextEntry = true; |
| 237 | arg.placeholder = options.passwordHint ? options.passwordHint : ''; |
| 238 | arg.text = isString(options.password) ? options.password : ''; |
| 239 | |
| 240 | if (textFieldColor) { |
| 241 | arg.textColor = arg.tintColor = textFieldColor.ios; |
| 242 | } |
| 243 | }); |
| 244 | const userNameTextField: UITextField = alertController.textFields.firstObject; |
| 245 | const passwordTextField: UITextField = alertController.textFields.lastObject; |
| 246 | |
| 247 | addButtonsToAlertController(alertController, options, (r) => { |
| 248 | resolve({ |
| 249 | result: r, |
| 250 | userName: userNameTextField.text, |
| 251 | password: passwordTextField.text, |
| 252 | }); |
| 253 | }); |
| 254 | |
| 255 | showUIAlertController(alertController); |
| 256 | } catch (ex) { |
| 257 | reject(ex); |
| 258 | } |
| 259 | }); |
| 260 | } |
| 261 | |
| 262 | export function action(...args): Promise<string> { |
| 263 | let options: ActionOptions; |
nothing calls this directly
no test coverage detected