@@ -128,29 +128,30 @@ function addButtonsToAlertController(alertController: MDCAlertController, option
128
128
}
129
129
alertController . dismissModalViewControllerAnimated ( true ) ;
130
130
}
131
+ let buttonsFont ;
132
+
133
+ function addButton ( title , emphasis , result ) {
134
+ const action = MDCAlertAction . actionWithTitleEmphasisHandler ( title , emphasis , ( ) => {
135
+ raiseCallback ( callback , result ) ;
136
+ } ) ;
137
+ alertController . addAction ( action ) ;
138
+ if ( options . buttonFont ) {
139
+ const titleLabel = alertController . buttonForAction ( action ) . titleLabel ;
140
+ if ( ! buttonsFont ) {
141
+ buttonsFont = options . buttonFont . getUIFont ( titleLabel . font ) ;
142
+ }
143
+ titleLabel . font = buttonsFont ;
144
+ }
145
+ }
131
146
132
147
if ( Utils . isString ( options . cancelButtonText ) ) {
133
- alertController . addAction (
134
- MDCAlertAction . actionWithTitleEmphasisHandler ( options . cancelButtonText , MDCActionEmphasis . Low , ( ) => {
135
- raiseCallback ( callback , false ) ;
136
- } )
137
- ) ;
148
+ addButton ( options . cancelButtonText , MDCActionEmphasis . Low , false ) ;
138
149
}
139
-
140
150
if ( Utils . isString ( options . neutralButtonText ) ) {
141
- alertController . addAction (
142
- MDCAlertAction . actionWithTitleEmphasisHandler ( options . neutralButtonText , MDCActionEmphasis . Low , ( ) => {
143
- raiseCallback ( callback , undefined ) ;
144
- } )
145
- ) ;
151
+ addButton ( options . neutralButtonText , MDCActionEmphasis . Low , undefined ) ;
146
152
}
147
-
148
153
if ( Utils . isString ( options . okButtonText ) ) {
149
- alertController . addAction (
150
- MDCAlertAction . actionWithTitleEmphasisHandler ( options . okButtonText , MDCActionEmphasis . Low , ( ) => {
151
- raiseCallback ( callback , true ) ;
152
- } )
153
- ) ;
154
+ addButton ( options . okButtonText , MDCActionEmphasis . Low , true ) ;
154
155
}
155
156
}
156
157
0 commit comments