react-native-acoustic-mobile-push-location-beta 3.9.9 → 3.9.11
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.
- package/README.md +13 -36
- package/android/build.gradle +1 -1
- package/package.json +2 -2
- package/postinstall.js +79 -59
package/README.md
CHANGED
|
@@ -1,45 +1,22 @@
|
|
|
1
1
|
# react-native-acoustic-mobile-push-location-beta
|
|
2
|
-
|
|
3
|
-
Contains Android/iOS native SDKs + the wrapper code to create plugins for React Native
|
|
2
|
+
Optional Campaign plugin location feature.
|
|
4
3
|
|
|
4
|
+
### Plugin Dependencies
|
|
5
|
+
react-native-acoustic-mobile-push-beta
|
|
6
|
+
react-native-acoustic-mobile-push-inapp-beta
|
|
7
|
+
react-native-acoustic-mobile-push-inbox-beta
|
|
5
8
|
----
|
|
6
9
|
|
|
7
10
|
[Overview](https://developer.goacoustic.com/acoustic-campaign/docs/add-the-react-native-plug-in-to-your-app#overview)
|
|
8
11
|
---
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
## Install
|
|
14
|
+
Add `react-native-acoustic-mobile-push-location-beta` to the project.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* `cd SampleApp`
|
|
17
|
-
* `yarn install`
|
|
16
|
+
```shell yarn
|
|
17
|
+
yarn add react-native-acoustic-mobile-push-location-beta
|
|
18
|
+
```
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Run iOS
|
|
24
|
-
* `cd ios`
|
|
25
|
-
* `pod install`
|
|
26
|
-
* open `.xcworkspace` file in xcode
|
|
27
|
-
* build to device or simulator
|
|
28
|
-
|
|
29
|
-
### Testing the Sample app
|
|
30
|
-
Tests are stored in the `SampleApp/e2e` directory. All test files of the form `*.spec.js` will be automatically picked up and run by the CI pipeline.
|
|
31
|
-
|
|
32
|
-
To run tests, first build the app using the desired configuration using `detox -c [config name] build`, then run the tests using `detox -c [config name] run`.
|
|
33
|
-
|
|
34
|
-
Available configurations are:
|
|
35
|
-
* ios-15
|
|
36
|
-
* ios-14
|
|
37
|
-
* ios-13
|
|
38
|
-
* android-31
|
|
39
|
-
* android-30
|
|
40
|
-
* android-29
|
|
41
|
-
* android-28
|
|
42
|
-
* android-27
|
|
43
|
-
* android-25
|
|
44
|
-
|
|
45
|
-
Test results will be placed in `SampleApp/test-results.xml`.
|
|
20
|
+
```shell npm
|
|
21
|
+
npm i react-native-acoustic-mobile-push-location-beta
|
|
22
|
+
```
|
package/android/build.gradle
CHANGED
|
@@ -35,7 +35,7 @@ dependencies {
|
|
|
35
35
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
|
36
36
|
implementation 'com.google.android.gms:play-services-base:18.3.0'
|
|
37
37
|
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
|
38
|
-
implementation "io.github.go-acoustic:acoustic-mobile-push-android-sdk
|
|
38
|
+
implementation "io.github.go-acoustic:acoustic-mobile-push-android-sdk:$campaignSDKVersion"
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
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.
|
|
27
|
+
"react-native-acoustic-mobile-push-beta": "3.9.11"
|
|
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.
|
|
39
|
+
"version": "3.9.11"
|
|
40
40
|
}
|
package/postinstall.js
CHANGED
|
@@ -167,82 +167,105 @@ function modifyInfoPlist(mainAppPath) {
|
|
|
167
167
|
fs.writeFileSync(infoPath, plist.build(infoPlist), "utf8");
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
function updateiOSConfigFile(mainAppPath) {
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
170
|
+
function updateiOSConfigFile(projectPath, mainAppPath) {
|
|
171
|
+
const campaignConfigName = 'CampaignConfig.json';
|
|
172
|
+
const appConfigName = 'MceConfig.json';
|
|
173
|
+
const campaignConfigPath = path.join(projectPath, campaignConfigName);
|
|
174
|
+
const appConfigPath = path.join(mainAppPath, appConfigName);
|
|
175
|
+
|
|
176
|
+
let configTemplate = {
|
|
177
|
+
"The location autoInitialize flag can be set to false to delay turning on the location services until desired.": "",
|
|
178
|
+
"autoInitialize": true,
|
|
179
|
+
|
|
180
|
+
"The sync key is only used to customize the iBeacon and Geofence syncing sevice, it is not required for those features": "",
|
|
181
|
+
"sync": {
|
|
182
|
+
"Location Sync radius is in meters, default 100km": "",
|
|
183
|
+
"syncRadius": 100000,
|
|
184
|
+
|
|
185
|
+
"Specify how long to wait before syncing again on significant location change in seconds, default 5 minutes": "",
|
|
186
|
+
"syncInterval": 300
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var config = JSON.parse(fs.readFileSync(campaignConfigPath));
|
|
191
|
+
|
|
192
|
+
if(typeof(config.iOS.location) == "undefined") {
|
|
193
|
+
console.log("Adding location preferences to iOS CampaignConfig.json file.");
|
|
194
|
+
config.iOS["Please note, the existince of the location key is not required, if it is not present though, iBeacon and Geofence support will be disabled."] = "";
|
|
193
195
|
|
|
194
|
-
|
|
196
|
+
config.iOS.location = configTemplate;
|
|
197
|
+
|
|
198
|
+
fs.writeFileSync(campaignConfigPath, JSON.stringify(config, null, 2));
|
|
199
|
+
|
|
200
|
+
console.log("Adding location preferences to Android MceConfig.json file.");
|
|
201
|
+
var appConfig = JSON.parse(fs.readFileSync(appConfigPath));
|
|
202
|
+
|
|
203
|
+
appConfig.location = configTemplate;
|
|
204
|
+
fs.writeFileSync(appConfigPath, JSON.stringify(appConfig, null, 2));
|
|
205
|
+
}
|
|
195
206
|
}
|
|
196
207
|
|
|
197
|
-
function updateAndroidConfigFile(installDirectory) {
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
|
|
208
|
+
function updateAndroidConfigFile(projectPath, installDirectory) {
|
|
209
|
+
const campaignConfigName = 'CampaignConfig.json';
|
|
210
|
+
const appConfigName = 'MceConfig.json';
|
|
211
|
+
const campaignConfigPath = path.join(projectPath, campaignConfigName);
|
|
212
|
+
const appConfigPath = path.join(installDirectory, "android", "app", "src", "main", "assets", appConfigName);
|
|
201
213
|
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
let configTemplate = {
|
|
215
|
+
"The location autoInitialize flag can be set to false to delay turning on the location services until desired.": "",
|
|
216
|
+
"autoInitialize": true,
|
|
204
217
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
"
|
|
218
|
+
"The sync key is only used to customize the iBeacon and Geofence syncing service, it is not required for those features": "",
|
|
219
|
+
"sync": {
|
|
220
|
+
"Specify how long to wait before syncing again on significant location change in seconds, default 5 minutes":"",
|
|
221
|
+
"syncInterval": 300,
|
|
209
222
|
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"Specify how long to wait before syncing again on significant location change in seconds, default 5 minutes":"",
|
|
213
|
-
"syncInterval": 300,
|
|
223
|
+
"Location Sync radius is in meters, default 100km":"",
|
|
224
|
+
"syncRadius": 100000,
|
|
214
225
|
|
|
215
|
-
|
|
216
|
-
|
|
226
|
+
"Specify how long to wait before retrieving a new location from the device, default 5 minutes":"",
|
|
227
|
+
"locationResponsiveness": 300,
|
|
217
228
|
|
|
218
|
-
|
|
219
|
-
|
|
229
|
+
"Specify the minimum results when looking for locations nearby, default is 1, minimum value is 1":"",
|
|
230
|
+
"minLocationsForSearch": 1,
|
|
220
231
|
|
|
221
|
-
|
|
222
|
-
|
|
232
|
+
"Specify the maximum results when looking for locations nearby, default is 20, minimum value is 1":"",
|
|
233
|
+
"maxLocationsForSearch": 20,
|
|
223
234
|
|
|
224
|
-
|
|
225
|
-
|
|
235
|
+
"Specify the location providers that will be used to retrieve the device location. 'gps' - gps location. 'network' - wifi + cellular, default is gps + network":"",
|
|
236
|
+
"providerPreferences": ["gps", "network"]
|
|
237
|
+
}
|
|
238
|
+
};
|
|
226
239
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
240
|
+
var config = JSON.parse(fs.readFileSync(campaignConfigPath));
|
|
241
|
+
|
|
242
|
+
if(typeof(config.android.location) == "undefined") {
|
|
243
|
+
console.log("Adding location preferences to Android CampaignConfig.json file.");
|
|
244
|
+
config.android["Please note, the existince of the location key is not required, if it is not present though, iBeacon and Geofence support will be disabled."] = "";
|
|
245
|
+
|
|
246
|
+
config.android.location = configTemplate;
|
|
247
|
+
fs.writeFileSync(campaignConfigPath, JSON.stringify(config, null, 2));
|
|
248
|
+
|
|
249
|
+
console.log("Adding location preferences to Android MceConfig.json file.");
|
|
250
|
+
var appConfig = JSON.parse(fs.readFileSync(appConfigPath));
|
|
251
|
+
|
|
252
|
+
appConfig.location = configTemplate;
|
|
253
|
+
fs.writeFileSync(appConfigPath, JSON.stringify(appConfig, null, 2));
|
|
231
254
|
}
|
|
232
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
233
255
|
}
|
|
234
256
|
|
|
235
257
|
if(process.env.MCE_RN_NOCONFIG) {
|
|
236
|
-
console.log(chalk.yellow.bold("Acoustic
|
|
258
|
+
console.log(chalk.yellow.bold("Acoustic Campaign Location Plugin installed, but will not be auto configured because MCE_RN_NOCONFIG environment flag detected."));
|
|
237
259
|
return;
|
|
238
260
|
}
|
|
239
261
|
|
|
240
|
-
console.log(chalk.green.bold("Setting up Acoustic
|
|
262
|
+
console.log(chalk.green.bold("Setting up Acoustic Campaign Location Plugin"));
|
|
263
|
+
const projectPath = process.cwd();
|
|
241
264
|
const installDirectory = findInstallDirectory();
|
|
242
265
|
const mainAppPath = findMainPath(installDirectory);
|
|
243
266
|
modifyInfoPlist(mainAppPath);
|
|
244
|
-
updateiOSConfigFile(mainAppPath);
|
|
245
|
-
updateAndroidConfigFile(installDirectory);
|
|
267
|
+
updateiOSConfigFile(projectPath, mainAppPath);
|
|
268
|
+
updateAndroidConfigFile(projectPath, installDirectory);
|
|
246
269
|
modifyManifest(installDirectory);
|
|
247
270
|
|
|
248
271
|
console.log(chalk.green("Installation Complete!"));
|
|
@@ -252,7 +275,4 @@ console.log(chalk.blue('For react-native 0.59 and lower link the plugin with:'))
|
|
|
252
275
|
console.log('react-native link react-native-acoustic-mobile-push-location\n');
|
|
253
276
|
|
|
254
277
|
console.log(chalk.blue('iOS Support:'));
|
|
255
|
-
console.log("Please replace the placeholder location usage descriptions in info.plist in the NSLocationWhenInUseUsageDescription, NSLocationAlwaysUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys.\n");
|
|
256
|
-
|
|
257
|
-
console.log(chalk.blue('Android Support:'));
|
|
258
|
-
console.log("Note, this version of the plugin only supports AndroidX on React Native 0.60 and higher");
|
|
278
|
+
console.log("Please replace the placeholder location usage descriptions in info.plist in the NSLocationWhenInUseUsageDescription, NSLocationAlwaysUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys.\n");
|