@@ -13,34 +13,33 @@ readline.question('Which platform? (ios or android): ', entry => {
13
13
readline . close ( ) ;
14
14
return ;
15
15
}
16
-
17
16
readline . question ( 'Enter Braze key: ' , key => {
18
17
readline . question ( 'Enter Braze endpoint: ' , endpoint => {
19
-
20
- const complete = ( ) => {
21
- fs . writeFileSync ( file , content ) ;
22
- console . log ( `Braze config successfully updated for ${ platform } ` ) ;
23
- readline . close ( ) ;
24
- } ;
25
18
const platform = entry . toUpperCase ( ) ;
26
-
27
- content = content . replace ( `${ platform } _BRAZE_API_KEY_REPLACE_ME` , key ) ;
28
-
29
- content = content . replace (
30
- `${ platform } _BRAZE_API_ENDPOINT_REPLACE_ME` ,
31
- endpoint
32
- ) ;
33
-
34
19
if ( platform === 'ANDROID' ) {
35
20
readline . question ( 'Enter fcm senderId: ' , senderId => {
36
- content = content . replace (
37
- `ANDROID_BRAZE_FCM_SENDER_ID_REPLACE_ME` ,
38
- `str_${ senderId } `
39
- ) ;
40
- complete ( ) ;
21
+ const brazeXML =
22
+ `<?xml version="1.0" encoding="utf-8"?>
23
+ <resources>
24
+ <string name="com_appboy_api_key">${ key } </string>
25
+ <string name="com_appboy_custom_endpoint">${ endpoint } </string>
26
+ <bool name="com_appboy_firebase_cloud_messaging_registration_enabled">true</bool>
27
+ <bool name="com_appboy_handle_push_deep_links_automatically">true</bool>
28
+ <string name="com_appboy_firebase_cloud_messaging_sender_id">${ senderId } </string>
29
+ </resources>` ;
30
+ fs . writeFileSync ( `${ __dirname } /../app-template/braze.xml` , brazeXML ) ;
31
+ console . log ( 'Braze XML successfully created' ) ;
32
+ readline . close ( ) ;
41
33
} ) ;
42
34
} else {
43
- complete ( ) ;
35
+ content = content . replace ( `${ platform } _BRAZE_API_KEY_REPLACE_ME` , key ) ;
36
+ content = content . replace (
37
+ `${ platform } _BRAZE_API_ENDPOINT_REPLACE_ME` ,
38
+ endpoint
39
+ ) ;
40
+ fs . writeFileSync ( file , content ) ;
41
+ console . log ( `Braze config successfully updated for ${ platform } ` ) ;
42
+ readline . close ( ) ;
44
43
}
45
44
} ) ;
46
45
} ) ;
0 commit comments