| 84 | } |
| 85 | |
| 86 | export function alert(arg: any): Promise<void> { |
| 87 | return new Promise<void>((resolve, reject) => { |
| 88 | try { |
| 89 | const options = !isDialogOptions(arg) |
| 90 | ? { |
| 91 | title: DialogStrings.ALERT, |
| 92 | okButtonText: DialogStrings.OK, |
| 93 | message: arg + '', |
| 94 | } |
| 95 | : arg; |
| 96 | const alertController = UIAlertController.alertControllerWithTitleMessagePreferredStyle(options.title, options.message, UIAlertControllerStyle.Alert); |
| 97 | |
| 98 | addButtonsToAlertController(alertController, options, () => { |
| 99 | resolve(); |
| 100 | }); |
| 101 | |
| 102 | showUIAlertController(alertController); |
| 103 | } catch (ex) { |
| 104 | reject(ex); |
| 105 | } |
| 106 | }); |
| 107 | } |
| 108 | |
| 109 | export function confirm(arg: any): Promise<boolean> { |
| 110 | return new Promise<boolean>((resolve, reject) => { |