@@ -168,57 +168,6 @@ function createAlertController(options: DialogOptions & MDCAlertControlerOptions
168
168
// if (options.buttonFont) {
169
169
// alertController.buttonFont = options.buttonFont.getUIFont(alertController.buttonFont);
170
170
// }
171
- if ( options . messageFont ) {
172
- alertController . messageFont = options . messageFont . getUIFont ( alertController . messageFont ) ;
173
- }
174
- if ( options . titleFont ) {
175
- alertController . titleFont = options . titleFont . getUIFont ( alertController . titleFont ) ;
176
- }
177
- if ( options . buttonInkColor ) {
178
- alertController . buttonInkColor = options . buttonInkColor . ios ;
179
- }
180
- if ( options . buttonTitleColor ) {
181
- alertController . buttonTitleColor = options . buttonTitleColor . ios ;
182
- }
183
- if ( options . scrimColor ) {
184
- alertController . scrimColor = options . scrimColor . ios ;
185
- }
186
- if ( options . titleColor ) {
187
- alertController . titleColor = options . titleColor . ios ;
188
- // } else if (lblColor) {
189
- // alertController.titleColor = lblColor.ios;
190
- }
191
- if ( options . titleIconTintColor ) {
192
- alertController . titleIconTintColor = options . titleIconTintColor . ios ;
193
- }
194
- if ( options . messageColor ) {
195
- alertController . messageColor = options . messageColor . ios ;
196
- }
197
- if ( options . elevation !== undefined ) {
198
- alertController . elevation = options . elevation ;
199
- }
200
- if ( options . cornerRadius !== undefined ) {
201
- alertController . cornerRadius = options . cornerRadius ;
202
- // } else {
203
- // alertController.cornerRadius = 2;
204
- }
205
- if ( options . titleIcon ) {
206
- alertController . titleIcon = options . titleIcon . ios ;
207
- }
208
- if ( options . titleAlignment ) {
209
- switch ( options . titleAlignment ) {
210
- case 'initial' :
211
- case 'left' :
212
- alertController . titleAlignment = NSTextAlignment . Left ;
213
- break ;
214
- case 'center' :
215
- alertController . titleAlignment = NSTextAlignment . Center ;
216
- break ;
217
- case 'right' :
218
- alertController . titleAlignment = NSTextAlignment . Right ;
219
- break ;
220
- }
221
- }
222
171
223
172
if ( options . view ) {
224
173
const view =
@@ -286,7 +235,7 @@ export function alert(arg: any): Promise<any> {
286
235
resolve ( result ) ;
287
236
} ) ;
288
237
289
- showUIAlertController ( alertController ) ;
238
+ showUIAlertController ( alertController , options ) ;
290
239
} catch ( ex ) {
291
240
reject ( ex ) ;
292
241
}
@@ -300,7 +249,7 @@ export class AlertDialog {
300
249
show ( resolve ?) {
301
250
if ( ! this . alertController ) {
302
251
this . alertController = createAlertController ( this . options , resolve ) ;
303
- this . presentingController = showUIAlertController ( this . alertController ) ;
252
+ this . presentingController = showUIAlertController ( this . alertController , this . options ) ;
304
253
}
305
254
}
306
255
hide ( ) {
@@ -331,7 +280,7 @@ export function confirm(arg: any): Promise<boolean> {
331
280
resolve ( r ) ;
332
281
} ) ;
333
282
334
- showUIAlertController ( alertController ) ;
283
+ showUIAlertController ( alertController , options ) ;
335
284
} catch ( ex ) {
336
285
reject ( ex ) ;
337
286
}
@@ -422,7 +371,7 @@ export function prompt(arg: any): Promise<PromptResult> {
422
371
if ( options . autoFocus ) {
423
372
alertController . autoFocusTextField = textField ;
424
373
}
425
- showUIAlertController ( alertController ) ;
374
+ showUIAlertController ( alertController , options ) ;
426
375
} catch ( ex ) {
427
376
reject ( ex ) ;
428
377
}
@@ -499,7 +448,7 @@ export function login(arg: any): Promise<LoginResult> {
499
448
if ( options . beforeShow ) {
500
449
options . beforeShow ( options , userNameTextField , passwordTextField ) ;
501
450
}
502
- showUIAlertController ( alertController ) ;
451
+ showUIAlertController ( alertController , options ) ;
503
452
if ( options . autoFocus ) {
504
453
alertController . autoFocusTextField = userNameTextField ;
505
454
}
@@ -509,7 +458,7 @@ export function login(arg: any): Promise<LoginResult> {
509
458
} ) ;
510
459
}
511
460
512
- function showUIAlertController ( alertController : MDCAlertController ) {
461
+ function showUIAlertController ( alertController : MDCAlertController , options : DialogOptions & MDCAlertControlerOptions ) {
513
462
// themer needs to be applied after actions creation
514
463
const colorScheme = themer . getAppColorScheme ( ) as MDCSemanticColorScheme ;
515
464
const scheme = MDCContainerScheme . alloc ( ) . init ( ) ;
@@ -518,6 +467,58 @@ function showUIAlertController(alertController: MDCAlertController) {
518
467
}
519
468
alertController . applyThemeWithScheme ( scheme ) ;
520
469
470
+ if ( options . messageFont ) {
471
+ alertController . messageFont = options . messageFont . getUIFont ( alertController . messageFont ) ;
472
+ }
473
+ if ( options . titleFont ) {
474
+ alertController . titleFont = options . titleFont . getUIFont ( alertController . titleFont ) ;
475
+ }
476
+ if ( options . buttonInkColor ) {
477
+ alertController . buttonInkColor = options . buttonInkColor . ios ;
478
+ }
479
+ if ( options . buttonTitleColor ) {
480
+ alertController . buttonTitleColor = options . buttonTitleColor . ios ;
481
+ }
482
+ if ( options . scrimColor ) {
483
+ alertController . scrimColor = options . scrimColor . ios ;
484
+ }
485
+ if ( options . titleColor ) {
486
+ alertController . titleColor = options . titleColor . ios ;
487
+ // } else if (lblColor) {
488
+ // alertController.titleColor = lblColor.ios;
489
+ }
490
+ if ( options . titleIconTintColor ) {
491
+ alertController . titleIconTintColor = options . titleIconTintColor . ios ;
492
+ }
493
+ if ( options . messageColor ) {
494
+ alertController . messageColor = options . messageColor . ios ;
495
+ }
496
+ if ( options . elevation !== undefined ) {
497
+ alertController . elevation = options . elevation ;
498
+ }
499
+ if ( options . cornerRadius !== undefined ) {
500
+ alertController . cornerRadius = options . cornerRadius ;
501
+ // } else {
502
+ // alertController.cornerRadius = 2;
503
+ }
504
+ if ( options . titleIcon ) {
505
+ alertController . titleIcon = options . titleIcon . ios ;
506
+ }
507
+ if ( options . titleAlignment ) {
508
+ switch ( options . titleAlignment ) {
509
+ case 'initial' :
510
+ case 'left' :
511
+ alertController . titleAlignment = NSTextAlignment . Left ;
512
+ break ;
513
+ case 'center' :
514
+ alertController . titleAlignment = NSTextAlignment . Center ;
515
+ break ;
516
+ case 'right' :
517
+ alertController . titleAlignment = NSTextAlignment . Right ;
518
+ break ;
519
+ }
520
+ }
521
+
521
522
let currentView = getCurrentPage ( ) || Application . getRootView ( ) ;
522
523
523
524
if ( currentView ) {
@@ -599,7 +600,7 @@ export function action(): Promise<string> {
599
600
) ;
600
601
}
601
602
602
- showUIAlertController ( alertController ) ;
603
+ showUIAlertController ( alertController , options ) ;
603
604
} catch ( ex ) {
604
605
reject ( ex ) ;
605
606
}
0 commit comments