nativescript-push-notifications
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -12,3 +12,3 @@ var utils = require('./utils'); | ||
if (utils.targetsAndroid($projectData.projectDir)) { | ||
utils.addIfNecessary($projectData.platformsDir); | ||
utils.addIfNecessary($projectData.platformsDir, $projectData.appResourcesDirectoryPath); | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -30,9 +30,9 @@ var path = require('path'); | ||
function addOnPluginInstall(platformsDir) { | ||
function addOnPluginInstall(platformsDir, resourcesDir) { | ||
if (buildGradleExists(platformsDir)) { | ||
addIfNecessary(platformsDir); | ||
addIfNecessary(platformsDir, resourcesDir); | ||
} | ||
} | ||
function addIfNecessary(platformsDir) { | ||
function addIfNecessary(platformsDir, resourcesDir) { | ||
_amendBuildGradle(platformsDir, function(pluginImported, pluginApplied, fileContents) { | ||
@@ -53,3 +53,3 @@ if (!pluginImported) { | ||
_copyGoogleServices(platformsDir); | ||
_copyGoogleServices(resourcesDir, platformsDir); | ||
} | ||
@@ -85,4 +85,4 @@ | ||
function _copyGoogleServices(platformsDir) { | ||
var srcServicesFile = path.join(platformsDir, '..', 'app', 'App_Resources', 'Android', 'google-services.json'); | ||
function _copyGoogleServices(resourcesDir, platformsDir) { | ||
var srcServicesFile = path.join(resourcesDir, 'Android', 'google-services.json'); | ||
var dstServicesFile = path.join(platformsDir, 'android', 'app', 'google-services.json'); | ||
@@ -136,3 +136,3 @@ if (fs.existsSync(srcServicesFile) && !fs.existsSync(dstServicesFile) && fs.existsSync(path.join(platformsDir, 'android', 'app'))) { | ||
var insertBeforeDoubleQuotes = 'classpath "' + androidGradle; | ||
var insertBeforeSingleQoutes = 'classpath \'' + androidGradle; | ||
var insertBeforeSingleQuotes = 'classpath \'' + androidGradle; | ||
var quoteToInsert = '"' | ||
@@ -143,5 +143,5 @@ var matchedString = insertBeforeDoubleQuotes; | ||
if (ind === -1) { | ||
ind = buildGradleContents.indexOf(insertBeforeSingleQoutes); | ||
ind = buildGradleContents.indexOf(insertBeforeSingleQuotes); | ||
quoteToInsert = '\''; | ||
matchedString = insertBeforeSingleQoutes; | ||
matchedString = insertBeforeSingleQuotes; | ||
} | ||
@@ -148,0 +148,0 @@ |
{ | ||
"name": "nativescript-push-notifications", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Receive push notifications in your NativeScript app on Android and iOS.", | ||
@@ -5,0 +5,0 @@ "main": "push-plugin", |
@@ -9,4 +9,16 @@ var path = require('path'); | ||
if (projDir) { | ||
utils.checkForGoogleServicesJson(projDir, path.join(projDir, 'app', 'App_Resources')); | ||
utils.addOnPluginInstall(path.join(projDir, 'platforms')); | ||
var resourcesDir; | ||
try { | ||
var globalPath = require('child_process').execSync('npm root -g').toString().trim(); | ||
var tns = require(path.join(globalPath, 'nativescript')); | ||
var project = tns.projectDataService.getProjectData(projDir); | ||
resourcesDir = project.appResourcesDirectoryPath; | ||
} catch (exc) { | ||
console.log('Push plugin cannot find project root. Project will be initialized during build.'); | ||
} | ||
if (resourcesDir) { | ||
utils.checkForGoogleServicesJson(projDir, resourcesDir); | ||
utils.addOnPluginInstall(path.join(projDir, 'platforms'), resourcesDir); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
488903
501
3
1