@@ -25,13 +25,8 @@ export class ModalsPluginElectron extends WebPlugin implements ModalsPlugin {
25
25
}
26
26
27
27
async alert ( options : AlertOptions ) : Promise < void > {
28
- const alert = ( message : string , title : string = '' ) =>
29
- {
30
- let buttons = [ options . buttonTitle || 'OK' ]
31
- dialog . showMessageBox ( getCurrentWindow ( ) , { message, title, buttons} ) ;
32
- }
33
- alert ( options . message , options . title ) ;
34
- return Promise . resolve ( ) ;
28
+ const buttons = [ options . buttonTitle || 'OK' ] ;
29
+ return await dialog . showMessageBox ( getCurrentWindow ( ) , { message : options . message , title : options . title , buttons} ) ;
35
30
}
36
31
37
32
async prompt ( options : PromptOptions ) : Promise < PromptResult > {
@@ -43,15 +38,9 @@ export class ModalsPluginElectron extends WebPlugin implements ModalsPlugin {
43
38
}
44
39
45
40
async confirm ( options : ConfirmOptions ) : Promise < ConfirmResult > {
46
- const confirm = ( message : string , title : string = '' ) =>
47
- {
48
- let buttons = [ options . okButtonTitle || 'OK' , options . cancelButtonTitle || 'Cancel' ]
49
- return ! dialog . showMessageBox ( getCurrentWindow ( ) , { message, title, buttons} ) ;
50
- }
51
- const val = confirm ( options . message , options . title ) ;
52
- return Promise . resolve ( {
53
- value : val
54
- } ) ;
41
+ const buttons = [ options . okButtonTitle || 'OK' , options . cancelButtonTitle || 'Cancel' ] ;
42
+ const value = await dialog . showMessageBox ( getCurrentWindow ( ) , { message : options . message , title : options . title , buttons} )
43
+ return { value : value . response === 0 } ;
55
44
}
56
45
57
46
async showActions ( options : ActionSheetOptions ) : Promise < ActionSheetResult > {
0 commit comments