mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 12:57:42 +08:00
login dialog for android minor refactoring
This commit is contained in:
@ -145,9 +145,9 @@ export function login(message: string, userName?: string, password?: string,
|
|||||||
var getUserName = function () { return userNameInput.getText().toString(); };
|
var getUserName = function () { return userNameInput.getText().toString(); };
|
||||||
var getPassword = function () { return passwordInput.getText().toString(); };
|
var getPassword = function () { return passwordInput.getText().toString(); };
|
||||||
|
|
||||||
addButtonsToAlertDialog(alert, options, function () { d.resolve({ result: true, userName: getUserName(), password: getPassword() }); },
|
addButtonsToAlertDialog(alert, options, function () { d.resolve(getLoginResult(true, getUserName, getPassword)); },
|
||||||
function () { d.resolve({ result: false, userName: getUserName(), password: getPassword() }); },
|
function () { d.resolve(getLoginResult(false, getUserName, getPassword)); },
|
||||||
function () { d.resolve({ result: undefined, userName: getUserName(), password: getPassword() }); });
|
function () { d.resolve(getLoginResult(undefined, getUserName, getPassword)); });
|
||||||
|
|
||||||
alert.show();
|
alert.show();
|
||||||
|
|
||||||
@ -158,6 +158,10 @@ export function login(message: string, userName?: string, password?: string,
|
|||||||
return d.promise();
|
return d.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLoginResult(r: boolean, getUserName: Function, getPassword: Function): dialogs.LoginResult {
|
||||||
|
return { result: r, userName: getUserName(), password: getPassword() };
|
||||||
|
}
|
||||||
|
|
||||||
export class Dialog {
|
export class Dialog {
|
||||||
private _dialog: android.app.AlertDialog;
|
private _dialog: android.app.AlertDialog;
|
||||||
private _android: android.app.AlertDialog.Builder;
|
private _android: android.app.AlertDialog.Builder;
|
||||||
|
Reference in New Issue
Block a user