(...args: any[])
| 254 | } |
| 255 | |
| 256 | export function login(...args: any[]): Promise<LoginResult> { |
| 257 | const options: LoginOptions = parseLoginOptions(args); |
| 258 | |
| 259 | return new Promise<LoginResult>((resolve, reject) => { |
| 260 | try { |
| 261 | const alert = createAlertDialog(options); |
| 262 | |
| 263 | const userNameInput = new android.widget.EditText(getNativeApp<android.app.Application>().getApplicationContext()); |
| 264 | |
| 265 | userNameInput.setHint(options.userNameHint ? options.userNameHint : ''); |
| 266 | userNameInput.setText(options.userName ? options.userName : ''); |
| 267 | |
| 268 | const passwordInput = new android.widget.EditText(getNativeApp<android.app.Application>().getApplicationContext()); |
| 269 | passwordInput.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD); |
| 270 | passwordInput.setTypeface(android.graphics.Typeface.DEFAULT); |
| 271 | |
| 272 | passwordInput.setHint(options.passwordHint ? options.passwordHint : ''); |
| 273 | passwordInput.setText(options.password ? options.password : ''); |
| 274 | |
| 275 | const layout = new android.widget.LinearLayout(getNativeApp<android.app.Application>().getApplicationContext()); |
| 276 | layout.setOrientation(1); |
| 277 | layout.addView(userNameInput); |
| 278 | layout.addView(passwordInput); |
| 279 | |
| 280 | alert.setView(layout); |
| 281 | |
| 282 | addButtonsToAlertDialog(alert, options, function (r) { |
| 283 | resolve({ |
| 284 | result: r, |
| 285 | userName: userNameInput.getText().toString(), |
| 286 | password: passwordInput.getText().toString(), |
| 287 | }); |
| 288 | }); |
| 289 | |
| 290 | showDialog(alert); |
| 291 | } catch (ex) { |
| 292 | reject(ex); |
| 293 | } |
| 294 | }); |
| 295 | } |
| 296 | |
| 297 | export function action(...args): Promise<string> { |
| 298 | let options: ActionOptions; |
nothing calls this directly
no test coverage detected