From 0bb9245762d25c8f135d89051eeb369ed76010bc Mon Sep 17 00:00:00 2001 From: Danilo De Luca Date: Tue, 3 Nov 2020 10:46:58 +0100 Subject: [PATCH 1/2] Fix bug on iOS platform occurring when application is built in release mode with development environment. In this case, before this patch, the plugin copies firebase prod file in place of the firebase dev file. --- publish/scripts/installer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/scripts/installer.js b/publish/scripts/installer.js index e1eebc0b..b699c463 100755 --- a/publish/scripts/installer.js +++ b/publish/scripts/installer.js @@ -846,7 +846,7 @@ module.exports = function($logger, hookArgs) { }); } - var buildType = isReleaseBuild || isProdEnv ? 'production' : 'development'; + var buildType = (isReleaseBuild && isProdEnv) || (!isReleaseBuild && isProdEnv) ? 'production' : 'development'; /* Detect if we have nativescript-plugin-firebase temp file created during after-prepare hook, so we know From 27e766fc19f6a78b511caec54b4a6dd2451d8267 Mon Sep 17 00:00:00 2001 From: Danilo De Luca Date: Tue, 3 Nov 2020 12:58:10 +0100 Subject: [PATCH 2/2] Fix bug on iOS platform occurring when application is built in release mode with development environment. In this case, before this patch, the plugin copies firebase prod file in place of the firebase dev file. --- publish/scripts/installer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/publish/scripts/installer.js b/publish/scripts/installer.js index b699c463..5aae77f0 100755 --- a/publish/scripts/installer.js +++ b/publish/scripts/installer.js @@ -837,16 +837,21 @@ module.exports = function($logger, hookArgs) { var isReleaseBuild = !!((hookArgs.checkForChangesOpts && hookArgs.checkForChangesOpts.projectChangesOptions) || hookArgs.prepareData).release; var validProdEnvs = ['prod','production']; + var validStagingEnvs = ["dev", "development", "staging"]; + var isStagingEnv = false; var isProdEnv = false; // building with --env.prod or --env.production flag var env = ((hookArgs.checkForChangesOpts && hookArgs.checkForChangesOpts.projectData && hookArgs.checkForChangesOpts.projectData.$options && hookArgs.checkForChangesOpts.projectData.$options.argv) || hookArgs.prepareData).env; if (env) { Object.keys(env).forEach((key) => { if (validProdEnvs.indexOf(key)>-1) { isProdEnv=true; } + if (validStagingEnvs.indexOf(key) > -1) { isStagingEnv = true; } }); + + } - var buildType = (isReleaseBuild && isProdEnv) || (!isReleaseBuild && isProdEnv) ? 'production' : 'development'; + var buildType = (isReleaseBuild && !isStagingEnv) || isProdEnv ? 'production' : 'development'; /* Detect if we have nativescript-plugin-firebase temp file created during after-prepare hook, so we know