mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: circular deps part 13
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import { Trace } from '../../trace';
|
||||
import { ConfirmOptions, PromptOptions, PromptResult, LoginOptions, LoginResult, ActionOptions, getCurrentPage, getLabelColor, getButtonColors, getTextFieldColor, isDialogOptions, inputType, capitalizationType, DialogStrings, parseLoginOptions } from './dialogs-common';
|
||||
import { isString, isDefined, isFunction } from '../../utils/types';
|
||||
import { Application } from '../../application';
|
||||
import { getiOSWindow } from '../../application/helpers-common';
|
||||
|
||||
export * from './dialogs-common';
|
||||
|
||||
@@ -17,7 +17,7 @@ function addButtonsToAlertController(alertController: UIAlertController, options
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.cancelButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, false);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ function addButtonsToAlertController(alertController: UIAlertController, options
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.neutralButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, undefined);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function addButtonsToAlertController(alertController: UIAlertController, options
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.okButtonText, UIAlertActionStyle.Default, () => {
|
||||
raiseCallback(callback, true);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ function raiseCallback(callback, result) {
|
||||
}
|
||||
|
||||
function showUIAlertController(alertController: UIAlertController) {
|
||||
let viewController = Application.ios.rootController;
|
||||
let viewController = getiOSWindow()?.rootViewController;
|
||||
|
||||
while (viewController && viewController.presentedViewController && !viewController.presentedViewController.beingDismissed) {
|
||||
viewController = viewController.presentedViewController;
|
||||
@@ -91,7 +91,7 @@ export function alert(arg: any): Promise<void> {
|
||||
title: DialogStrings.ALERT,
|
||||
okButtonText: DialogStrings.OK,
|
||||
message: arg + '',
|
||||
}
|
||||
}
|
||||
: arg;
|
||||
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert);
|
||||
|
||||
@@ -115,7 +115,7 @@ export function confirm(arg: any): Promise<boolean> {
|
||||
okButtonText: DialogStrings.OK,
|
||||
cancelButtonText: DialogStrings.CANCEL,
|
||||
message: arg + '',
|
||||
}
|
||||
}
|
||||
: arg;
|
||||
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert);
|
||||
|
||||
@@ -301,7 +301,7 @@ export function action(...args): Promise<string> {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(action, dialogType, (arg: UIAlertAction) => {
|
||||
resolve(arg.title);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ export function action(...args): Promise<string> {
|
||||
alertController.addAction(
|
||||
UIAlertAction.actionWithTitleStyleHandler(options.cancelButtonText, UIAlertActionStyle.Cancel, (arg: UIAlertAction) => {
|
||||
resolve(arg.title);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user