mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: improved core barrel exports and Application class (#10286)
BREAKING CHANGES:
`Application.orientation` is no longer a function.
Migration: Remove `()` from the `Application.orientation()` call:
```diff
import { Application } from "@nativescript/core";
-console.log(Application.orientation());
+console.log(Application.orientation);
```
`Application.systemAppearance` is no longer a function.
Migration: Remove `()` from the `Application.systemAppearance()` call:
```diff
import { Application } from "@nativescript/core";
-console.log(Application.systemAppearance());
+console.log(Application.systemAppearance);
```
This commit is contained in:
committed by
Nathan Walker
parent
963d0243de
commit
f64355ba7a
@@ -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 { getRootView, ios } from '../../application';
|
||||
import { Application } from '../../application';
|
||||
|
||||
export * from './dialogs-common';
|
||||
|
||||
@@ -45,7 +45,7 @@ function raiseCallback(callback, result) {
|
||||
}
|
||||
|
||||
function showUIAlertController(alertController: UIAlertController) {
|
||||
let viewController = ios.rootController as UIViewController;
|
||||
let viewController = Application.ios.rootController;
|
||||
|
||||
while (viewController && viewController.presentedViewController && !viewController.presentedViewController.beingDismissed) {
|
||||
viewController = viewController.presentedViewController;
|
||||
@@ -86,7 +86,13 @@ function showUIAlertController(alertController: UIAlertController) {
|
||||
export function alert(arg: any): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
try {
|
||||
const options = !isDialogOptions(arg) ? { title: DialogStrings.ALERT, okButtonText: DialogStrings.OK, message: arg + '' } : arg;
|
||||
const options = !isDialogOptions(arg)
|
||||
? {
|
||||
title: DialogStrings.ALERT,
|
||||
okButtonText: DialogStrings.OK,
|
||||
message: arg + '',
|
||||
}
|
||||
: arg;
|
||||
const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert);
|
||||
|
||||
addButtonsToAlertController(alertController, options, () => {
|
||||
|
||||
Reference in New Issue
Block a user