Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit e193e8b

Browse files
author
Sean Perkins
committed
ApplicationID for Android, directions for re-run, label adjustments for Facebook & Google
1 parent 9dbd60e commit e193e8b

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

scripts/postinstall.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var fs = require('fs');
22
var prompt = require('prompt');
33

44
// Default settings for using ios and android with Firebase
5-
var usingiOS = false, usingAndroid = false;
5+
var usingiOS = false, usingAndroid = false, packageName = 'your.package.name';
66

77
// The directories where the Podfile and include.gradle are stored
88
var directories = {
@@ -26,7 +26,7 @@ function askiOSPrompt() {
2626
if (err) {
2727
return console.log(err);
2828
}
29-
if (result.using_ios && result.using_ios.toLowerCase() === 'y') {
29+
if (isSelected(result.using_ios)) {
3030
usingiOS = true;
3131
}
3232
askAndroidPrompt();
@@ -45,11 +45,24 @@ function askAndroidPrompt() {
4545
if (err) {
4646
return console.log(err);
4747
}
48-
if (result.using_android && result.using_android.toLowerCase() === 'y') {
48+
if (isSelected(result.using_android)) {
4949
usingAndroid = true;
50+
prompt.get({
51+
name: 'package_name',
52+
description: 'Enter your application id (i.e. your.package.name)',
53+
required: true
54+
}, function(err, result) {
55+
if(err) {
56+
return console.log(err);
57+
}
58+
packageName = result.package_name;
59+
promptQuestions();
60+
});
5061
}
51-
if(usingiOS || usingAndroid) {
52-
promptQuestions();
62+
else {
63+
if(usingiOS || usingAndroid) {
64+
promptQuestions();
65+
}
5366
}
5467
});
5568
}
@@ -72,11 +85,11 @@ function promptQuestions() {
7285
default: 'n'
7386
}, {
7487
name: 'facebook_auth',
75-
description: 'Are you using Facebook Authentication (y/n)',
88+
description: 'Are you using Firebase Facebook Authentication (y/n)',
7689
default: 'n'
7790
}, {
7891
name: 'google_auth',
79-
description: 'Are you using Google Authentication (y/n)',
92+
description: 'Are you using Firebase Google Authentication (y/n)',
8093
default: 'n'
8194
}], function (err, result) {
8295
if (err) {
@@ -88,6 +101,7 @@ function promptQuestions() {
88101
if(usingAndroid) {
89102
writeGradleFile(result);
90103
}
104+
console.log('Firebase post install completed. To re-run this script, navigate to the root directory of `nativescript-plugin-firebase` in your `node_modules` folder and run: `npm run postinstall`.');
91105
});
92106
}
93107

@@ -145,6 +159,9 @@ function writeGradleFile(result) {
145159
dimension "fireb"
146160
}
147161
}
162+
defaultConfig {
163+
applicationId = "` + packageName + `"
164+
}
148165
}
149166
150167
repositories {

0 commit comments

Comments
 (0)