File tree Expand file tree Collapse file tree 1 file changed +21
-16
lines changed Expand file tree Collapse file tree 1 file changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -9,28 +9,33 @@ export const showToast = (message: string) => {
9
9
Toast . show ( message ) ;
10
10
} ;
11
11
12
+ type LearnMoreButton = { |
13
+ url : URL ,
14
+ text ?: string ,
15
+
16
+ // Needed by openLinkWithUserPreference
17
+ globalSettings : GlobalSettingsState ,
18
+ | } ;
19
+
20
+ const makeLearnMoreButton = learnMoreButton => {
21
+ const { url, text, globalSettings } = learnMoreButton ;
22
+ return {
23
+ // TODO: Translate default text
24
+ text : text ?? 'Learn more' ,
25
+ onPress : ( ) => {
26
+ openLinkWithUserPreference ( url . toString ( ) , globalSettings ) ;
27
+ } ,
28
+ } ;
29
+ } ;
30
+
12
31
export const showErrorAlert = (
13
32
title : string ,
14
33
message ? : string ,
15
-
16
- learnMoreButton ?: { |
17
- url : URL ,
18
- text ? : string ,
19
-
20
- // Needed by openLinkWithUserPreference
21
- globalSettings : GlobalSettingsState ,
22
- | } ,
34
+ learnMoreButton ? : LearnMoreButton ,
23
35
) : void => {
24
36
const buttons = [ ] ;
25
37
if ( learnMoreButton ) {
26
- const { url, text, globalSettings } = learnMoreButton ;
27
- buttons . push ( {
28
- // TODO: Translate default text
29
- text : text ?? 'Learn more' ,
30
- onPress : ( ) => {
31
- openLinkWithUserPreference ( url . toString ( ) , globalSettings ) ;
32
- } ,
33
- } ) ;
38
+ buttons . push ( makeLearnMoreButton ( learnMoreButton ) ) ;
34
39
}
35
40
buttons . push ( { text : 'OK' , onPress : ( ) => { } } ) ;
36
41
You can’t perform that action at this time.
0 commit comments