MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / login

Function login

packages/core/ui/dialogs/index.android.ts:256–295  ·  view source on GitHub ↗
(...args: any[])

Source from the content-addressed store, hash-verified

254}
255
256export 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
297export function action(...args): Promise<string> {
298 let options: ActionOptions;

Callers

nothing calls this directly

Calls 9

parseLoginOptionsFunction · 0.90
getNativeAppFunction · 0.90
createAlertDialogFunction · 0.85
addButtonsToAlertDialogFunction · 0.85
showDialogFunction · 0.85
resolveFunction · 0.50
setOrientationMethod · 0.45
addViewMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected