react-native-acoustic-mobile-push-location-beta 3.9.14 → 3.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/postinstall.js +24 -2
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "main": "index.js",
25
25
  "name": "react-native-acoustic-mobile-push-location-beta",
26
26
  "peerDependencies": {
27
- "react-native-acoustic-mobile-push-beta": "3.9.14"
27
+ "react-native-acoustic-mobile-push-beta": "3.9.16"
28
28
  },
29
29
  "repository": {
30
30
  "directory": "plugins/react-native-acoustic-mobile-push-location",
@@ -36,5 +36,5 @@
36
36
  "test": "echo \"Error: no test specified\" && exit 1"
37
37
  },
38
38
  "summary": "react-native ios android mobile push Campaign",
39
- "version": "3.9.14"
39
+ "version": "3.9.16"
40
40
  }
package/postinstall.js CHANGED
@@ -170,9 +170,20 @@ function modifyInfoPlist(mainAppPath) {
170
170
  function updateiOSConfigFile(projectPath, mainAppPath) {
171
171
  const campaignConfigName = 'CampaignConfig.json';
172
172
  const appConfigName = 'MceConfig.json';
173
- const campaignConfigPath = path.join(projectPath, campaignConfigName);
173
+ let campaignConfigPath = path.join(projectPath, campaignConfigName);
174
174
  const appConfigPath = path.join(mainAppPath, appConfigName);
175
175
 
176
+ // Handles both plugin install, and manual script execution
177
+ if (!fs.existsSync(campaignConfigPath)) {
178
+ const tempPath = path.join(projectPath, "../../", campaignConfigName);
179
+ if (fs.existsSync(tempPath)) {
180
+ campaignConfigPath = tempPath;
181
+ } else {
182
+ console.error(chalk.red("Could not find CampaignConfig.json. Install required react-native-acoustic-mobile-push plugin."));
183
+ return;
184
+ }
185
+ }
186
+
176
187
  let configTemplate = {
177
188
  "The location autoInitialize flag can be set to false to delay turning on the location services until desired.": "",
178
189
  "autoInitialize": true,
@@ -208,9 +219,20 @@ function updateiOSConfigFile(projectPath, mainAppPath) {
208
219
  function updateAndroidConfigFile(projectPath, installDirectory) {
209
220
  const campaignConfigName = 'CampaignConfig.json';
210
221
  const appConfigName = 'MceConfig.json';
211
- const campaignConfigPath = path.join(projectPath, campaignConfigName);
222
+ let campaignConfigPath = path.join(projectPath, campaignConfigName);
212
223
  const appConfigPath = path.join(installDirectory, "android", "app", "src", "main", "assets", appConfigName);
213
224
 
225
+ // Handles both plugin install, and manual script execution
226
+ if (!fs.existsSync(campaignConfigPath)) {
227
+ const tempPath = path.join(projectPath, "../../", campaignConfigName);
228
+ if (fs.existsSync(tempPath)) {
229
+ campaignConfigPath = tempPath;
230
+ } else {
231
+ console.error(chalk.red("Could not find CampaignConfig.json. Install required react-native-acoustic-mobile-push plugin."));
232
+ return;
233
+ }
234
+ }
235
+
214
236
  let configTemplate = {
215
237
  "The location autoInitialize flag can be set to false to delay turning on the location services until desired.": "",
216
238
  "autoInitialize": true,