mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: format
This commit is contained in:
@@ -3,62 +3,82 @@
|
||||
*/
|
||||
import { ios as iosView } from "../core/view";
|
||||
import { Trace } from "../../trace";
|
||||
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions, getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, capitalizationType, ALERT, OK, CONFIRM, CANCEL, PROMPT, parseLoginOptions } from "./dialogs-common";
|
||||
import {
|
||||
ConfirmOptions,
|
||||
PromptOptions,
|
||||
PromptResult,
|
||||
LoginOptions,
|
||||
LoginResult,
|
||||
ActionOptions,
|
||||
getCurrentPage,
|
||||
getLabelColor,
|
||||
getButtonColors,
|
||||
getTextFieldColor,
|
||||
isDialogOptions,
|
||||
inputType,
|
||||
capitalizationType,
|
||||
ALERT,
|
||||
OK,
|
||||
CONFIRM,
|
||||
CANCEL,
|
||||
PROMPT,
|
||||
parseLoginOptions,
|
||||
} from "./dialogs-common";
|
||||
import { isString, isDefined, isFunction } from "../../utils/types";
|
||||
import { getRootView, ios } from "../../application";
|
||||
|
||||
export * from "./dialogs-common";
|
||||
|
||||
function addButtonsToAlertController(
|
||||
alertController: UIAlertController,
|
||||
options: ConfirmOptions,
|
||||
callback?: Function
|
||||
alertController: UIAlertController,
|
||||
options: ConfirmOptions,
|
||||
callback?: Function
|
||||
): void {
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isString(options.cancelButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.cancelButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, false);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isString(options.cancelButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.cancelButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, false);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isString(options.neutralButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.neutralButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, undefined);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isString(options.neutralButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.neutralButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, undefined);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (isString(options.okButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.okButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, true);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isString(options.okButtonText)) {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(
|
||||
options.okButtonText,
|
||||
UIAlertActionStyle.Default,
|
||||
() => {
|
||||
raiseCallback(callback, true);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function raiseCallback(callback, result) {
|
||||
if (isFunction(callback)) {
|
||||
callback(result);
|
||||
}
|
||||
if (isFunction(callback)) {
|
||||
callback(result);
|
||||
}
|
||||
}
|
||||
export function alert(arg: any): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user