react-native-background-geolocation 4.9.2 → 4.9.4

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 (58) hide show
  1. package/README.md +3 -0
  2. package/android/build.gradle +1 -1
  3. package/android/libs/com/transistorsoft/tslocationmanager/{3.2.6/tslocationmanager-3.2.6.aar → 3.2.10/tslocationmanager-3.2.10.aar} +0 -0
  4. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.md5 +1 -0
  5. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha1 +1 -0
  6. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha256 +1 -0
  7. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.aar.sha512 +1 -0
  8. package/android/libs/com/transistorsoft/tslocationmanager/{3.2.6/tslocationmanager-3.2.6.pom → 3.2.10/tslocationmanager-3.2.10.pom} +1 -1
  9. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.md5 +1 -0
  10. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha1 +1 -0
  11. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha256 +1 -0
  12. package/android/libs/com/transistorsoft/tslocationmanager/3.2.10/tslocationmanager-3.2.10.pom.sha512 +1 -0
  13. package/android/libs/com/transistorsoft/tslocationmanager/maven-metadata.xml +7 -3
  14. package/android/libs/com/transistorsoft/tslocationmanager-reverse/{3.2.6/tslocationmanager-reverse-3.2.6.aar → 3.2.10/tslocationmanager-reverse-3.2.10.aar} +0 -0
  15. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.md5 +1 -0
  16. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha1 +1 -0
  17. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha256 +1 -0
  18. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.aar.sha512 +1 -0
  19. package/android/libs/com/transistorsoft/tslocationmanager-reverse/{3.2.6/tslocationmanager-reverse-3.2.6.pom → 3.2.10/tslocationmanager-reverse-3.2.10.pom} +1 -1
  20. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.md5 +1 -0
  21. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha1 +1 -0
  22. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha256 +1 -0
  23. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.10/tslocationmanager-reverse-3.2.10.pom.sha512 +1 -0
  24. package/android/libs/com/transistorsoft/tslocationmanager-reverse/maven-metadata.xml +7 -3
  25. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/Info.plist +6 -6
  26. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/Info.plist +0 -0
  27. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_armv7/TSLocationManager.framework/TSLocationManager +0 -0
  28. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/Info.plist +0 -0
  29. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/TSLocationManager +0 -0
  30. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeDirectory +0 -0
  31. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeRequirements-1 +0 -0
  32. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_i386_x86_64-simulator/TSLocationManager.framework/_CodeSignature/CodeResources +1 -1
  33. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/Resources/Info.plist +2 -2
  34. package/ios/RNBackgroundGeolocation/TSLocationManager.xcframework/ios-arm64_x86_64-maccatalyst/TSLocationManager.framework/TSLocationManager +0 -0
  35. package/package.json +1 -1
  36. package/src/declarations/types.d.ts +1 -1
  37. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.aar.md5 +0 -1
  38. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.aar.sha1 +0 -1
  39. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.aar.sha256 +0 -1
  40. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.aar.sha512 +0 -1
  41. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.pom.md5 +0 -1
  42. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.pom.sha1 +0 -1
  43. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.pom.sha256 +0 -1
  44. package/android/libs/com/transistorsoft/tslocationmanager/3.2.6/tslocationmanager-3.2.6.pom.sha512 +0 -1
  45. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.aar.md5 +0 -1
  46. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.aar.sha1 +0 -1
  47. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.aar.sha256 +0 -1
  48. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.aar.sha512 +0 -1
  49. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.pom.md5 +0 -1
  50. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.pom.sha1 +0 -1
  51. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.pom.sha256 +0 -1
  52. package/android/libs/com/transistorsoft/tslocationmanager-reverse/3.2.6/tslocationmanager-reverse-3.2.6.pom.sha512 +0 -1
  53. package/scripts/cp-declarations +0 -53
  54. package/scripts/declare-module +0 -3
  55. package/scripts/docs-index.html +0 -4
  56. package/scripts/generate-docs +0 -23
  57. package/scripts/tsconfig.json +0 -21
  58. package/scripts/xcode-helpers.js +0 -171
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ | <img src="https://dl.dropbox.com/s/gxl3sr8znhkrtah/expo-logo.png?dl=1" alt="alt text" width="32" /> | Now with *Expo* support |
2
+ | --- | --- |
3
+
1
4
  Background Geolocation for React Native &middot; [![npm](https://img.shields.io/npm/dm/react-native-background-geolocation.svg)]() [![npm](https://img.shields.io/npm/v/react-native-background-geolocation.svg)]()
2
5
  ============================================================================
3
6
 
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2
2
 
3
3
  // Android dependencies
4
4
  def DEFAULT_COMPILE_SDK_VERSION = 31
5
- def DEFAULT_TARGET_SDK_VERSION = 31
5
+ def DEFAULT_TARGET_SDK_VERSION = 30
6
6
  def DEFAULT_APP_COMPAT_VERSION = "1.4.1"
7
7
 
8
8
  // Plugin dependencies
@@ -0,0 +1 @@
1
+ ef77cce0941f7d2d23fc70420713d12b81f47b6f
@@ -0,0 +1 @@
1
+ e9a62bbf629437062a9b7947ae9441c271e0596c1d12d82a9dfa392f60ab1a25
@@ -0,0 +1 @@
1
+ c899a71f1519a3258681a19750326e60a5f305eefe52be71833134676a4149ef13800947a2309b65c1c17c7f156ce16ef5f6806db8f2c6171f1d2b944193ddde
@@ -4,6 +4,6 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>com.transistorsoft</groupId>
6
6
  <artifactId>tslocationmanager</artifactId>
7
- <version>3.2.6</version>
7
+ <version>3.2.10</version>
8
8
  <packaging>aar</packaging>
9
9
  </project>
@@ -0,0 +1 @@
1
+ 9a11922ab398d24e5484e9fb094eaa580b2e182b
@@ -0,0 +1 @@
1
+ d3778894c34d3707ea0e5e49384931ae4d550d807c6642049d2d09a3a50d91f8
@@ -0,0 +1 @@
1
+ 6bec4e3658451aaa08ce95ec4fdd1f6f2fa74e2910206e1b2fa3b70b5f2b97c102e576bee672aa51c576fc9120e0c88a97d00660061757c30a6c6cd92344ec4d
@@ -3,11 +3,15 @@
3
3
  <groupId>com.transistorsoft</groupId>
4
4
  <artifactId>tslocationmanager</artifactId>
5
5
  <versioning>
6
- <latest>3.2.6</latest>
7
- <release>3.2.6</release>
6
+ <latest>3.2.10</latest>
7
+ <release>3.2.10</release>
8
8
  <versions>
9
9
  <version>3.2.6</version>
10
+ <version>3.2.7</version>
11
+ <version>3.2.8</version>
12
+ <version>3.2.9</version>
13
+ <version>3.2.10</version>
10
14
  </versions>
11
- <lastUpdated>20221025164146</lastUpdated>
15
+ <lastUpdated>20221205171146</lastUpdated>
12
16
  </versioning>
13
17
  </metadata>
@@ -0,0 +1 @@
1
+ 46598519b4ddd39e6d99768a242e7e7979ba40be96001488f72a337f2d34c154
@@ -0,0 +1 @@
1
+ 27be7df123413942e45770255f433dd67424950981e7a6bc7e361fc27a71bd13cbdec97c085648afa2fa3d1503649eac241561cfd2191a431a3e09003c2f1b05
@@ -4,6 +4,6 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>com.transistorsoft</groupId>
6
6
  <artifactId>tslocationmanager-reverse</artifactId>
7
- <version>3.2.6</version>
7
+ <version>3.2.10</version>
8
8
  <packaging>aar</packaging>
9
9
  </project>
@@ -0,0 +1 @@
1
+ 7dfd0ff571618895a18de13d556a367a5ceaf2f7de525f29ec3c0fcc9b092e59
@@ -0,0 +1 @@
1
+ 642475d3434e300c033809a5e934c5c876f5d4ea79472dc98c591390040ced8d2ba22cd261ac23cda990a99cffcbddb369afb3a9baf27bcf3ebb9bd09698b201
@@ -3,11 +3,15 @@
3
3
  <groupId>com.transistorsoft</groupId>
4
4
  <artifactId>tslocationmanager-reverse</artifactId>
5
5
  <versioning>
6
- <latest>3.2.6</latest>
7
- <release>3.2.6</release>
6
+ <latest>3.2.10</latest>
7
+ <release>3.2.10</release>
8
8
  <versions>
9
9
  <version>3.2.6</version>
10
+ <version>3.2.7</version>
11
+ <version>3.2.8</version>
12
+ <version>3.2.9</version>
13
+ <version>3.2.10</version>
10
14
  </versions>
11
- <lastUpdated>20221025164146</lastUpdated>
15
+ <lastUpdated>20221205171146</lastUpdated>
12
16
  </versioning>
13
17
  </metadata>
@@ -6,31 +6,31 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_armv7</string>
9
+ <string>ios-arm64_x86_64-maccatalyst</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>TSLocationManager.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>armv7</string>
15
+ <string>x86_64</string>
16
16
  </array>
17
17
  <key>SupportedPlatform</key>
18
18
  <string>ios</string>
19
+ <key>SupportedPlatformVariant</key>
20
+ <string>maccatalyst</string>
19
21
  </dict>
20
22
  <dict>
21
23
  <key>LibraryIdentifier</key>
22
- <string>ios-arm64_x86_64-maccatalyst</string>
24
+ <string>ios-arm64_armv7</string>
23
25
  <key>LibraryPath</key>
24
26
  <string>TSLocationManager.framework</string>
25
27
  <key>SupportedArchitectures</key>
26
28
  <array>
27
29
  <string>arm64</string>
28
- <string>x86_64</string>
30
+ <string>armv7</string>
29
31
  </array>
30
32
  <key>SupportedPlatform</key>
31
33
  <string>ios</string>
32
- <key>SupportedPlatformVariant</key>
33
- <string>maccatalyst</string>
34
34
  </dict>
35
35
  <dict>
36
36
  <key>LibraryIdentifier</key>
@@ -138,7 +138,7 @@
138
138
  </data>
139
139
  <key>Info.plist</key>
140
140
  <data>
141
- s5vsrtTl12zwWaO61fpcxIwNozw=
141
+ ao8MpL4pZ1Tp7lSNiXrn30ILFdc=
142
142
  </data>
143
143
  <key>Modules/module.modulemap</key>
144
144
  <data>
@@ -17,13 +17,13 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>FMWK</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>4.1.5</string>
20
+ <string>4.1.6</string>
21
21
  <key>CFBundleSupportedPlatforms</key>
22
22
  <array>
23
23
  <string>MacOSX</string>
24
24
  </array>
25
25
  <key>CFBundleVersion</key>
26
- <string>387</string>
26
+ <string>388</string>
27
27
  <key>DTCompiler</key>
28
28
  <string>com.apple.compilers.llvm.clang.1_0</string>
29
29
  <key>DTPlatformBuild</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-background-geolocation",
3
- "version": "4.9.2",
3
+ "version": "4.9.4",
4
4
  "description": "The most sophisticated cross-platform background location-tracking & geofencing module with battery-conscious motion-detection intelligence",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -109,7 +109,7 @@ declare module "react-native-background-geolocation" {
109
109
  * | [[AUTHORIZATION_STATUS_RESTRICTED]] | iOS only |
110
110
  * | [[AUTHORIZATION_STATUS_DENIED]] | iOS & Android |
111
111
  * | [[AUTHORIZATION_STATUS_ALWAYS]] | iOS & Android |
112
- * | [[AUTHORIZATION_STATUS_WHEN_IN_USE]] | iOS only |
112
+ * | [[AUTHORIZATION_STATUS_WHEN_IN_USE]] | iOS & Android 10+ |
113
113
  */
114
114
  type AuthorizationStatus = 0 | 1 | 2 | 3 | 4;
115
115
 
@@ -1 +0,0 @@
1
- c65a6f4d0721d90fee84de3e60a2676a696866ef
@@ -1 +0,0 @@
1
- 734dca901c9fa132ef04bcff43a2a20bc045e88cb7e55e9ca17fde2474f58672
@@ -1 +0,0 @@
1
- 517eca12476d737d2b7469b4246d8f488654fd8355666910b9e4e5b641afe10c3fe963849926a607c13e03144308cc355c7b4dd3c5cf5532c815df2a374cbbf1
@@ -1 +0,0 @@
1
- 9048834dc1ad2dc8047811dd58c2a8adf59798c1
@@ -1 +0,0 @@
1
- 364bb683fb5235a848be6cf96b801852880b6ab6df36a4604b7e0ef43c653cbb
@@ -1 +0,0 @@
1
- c2501c6c8c322cbc07839c36ee9ffcd5d0a2328723699c8d9ea80fa246134e26de943bd50e2c49d61c971f802e35f7da10c200df8f4ada248d7f44c2b6e8e16a
@@ -1 +0,0 @@
1
- d8895605981e46748187b8b09a66e61352188ec48ec04338531383b985fbb4c2
@@ -1 +0,0 @@
1
- f4b6b70c113a7fac573f224168f1e637881419b12f729928ef15cad3dce74924964158dbe6dc791f32d75c8ca6365049b64d227bae81452b24ad778e1b96e18d
@@ -1 +0,0 @@
1
- 74bb64c1b2f6aed572821a3356ee6aee71d6d7a63c317ea1a33d96afcef98064
@@ -1 +0,0 @@
1
- 45d69b06687c7e3340be6fd163082b5d9872bc88d573109fb12d7feab559a8896f871269c36dc4cd428db6e786c7febc0b266064f90f6dbad46e5f84ab180805
@@ -1,53 +0,0 @@
1
- #!/bin/sh
2
-
3
- ###
4
- # Copies the Typescript modules from another project (eg: Free->Premium and vice-versa).
5
- # Re-writes each definition file's declare module "module-name" to the current module-name.
6
- #
7
- # Usage:
8
- # $ ./cp-declaration ../xxx-background-geolocation
9
- #
10
-
11
- if [ -z "$1" ]
12
- then
13
- echo "ERROR: No source path provided"
14
- exit
15
- fi
16
- # Strip trailing /
17
- SOURCE_PATH=$(echo $1 | tr -s /)
18
- SOURCE_PATH=${SOURCE_PATH%/}
19
-
20
- # Sample the source directory for path of /declarations
21
- if [ -d "$SOURCE_PATH/src/declarations" ]; then
22
- SOURCE_PATH="$SOURCE_PATH/src/declarations"
23
- elif [ -d "$SOURCE_PATH/src/ionic/declarations" ]; then
24
- SOURCE_PATH="$SOURCE_PATH/src/ionic/declarations"
25
- else
26
- echo "ERROR: Invalid source path"
27
- exit
28
- fi
29
-
30
- # Sample the destination directory for path of /declarations
31
- DESTINATION_PATH="."
32
- if [ -d "$DESTINATION_PATH/src/declarations" ]; then
33
- DESTINATION_PATH="$DESTINATION_PATH/src"
34
- elif [ -d "$DESTINATION_PATH/src/ionic" ]; then
35
- DESTINATION_PATH="$DESTINATION_PATH/src/ionic"
36
- else
37
- echo "ERROR: Invalid destination. Are you in a background-geolocation project?"
38
- exit
39
- fi
40
-
41
- # This module's name
42
- MODULE_NAME="${PWD##*/}"
43
-
44
- cp -R -f "$SOURCE_PATH" "$DESTINATION_PATH"
45
- echo "MODULE $MODULE_NAME"
46
- echo "SOURCE: $SOURCE_PATH"
47
- echo "DESTINATION: $DESTINATION_PATH"
48
-
49
-
50
- # Finally, 'declare module "xxx-background-geolocation"' in every .d.ts file.
51
- find "$DESTINATION_PATH/declarations" -type f -name "*.d.ts" -print0 | xargs -0 sed -i '' -e "s/declare module.*/declare module \"$MODULE_NAME\" \{/g"
52
-
53
-
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- find ./src/declarations -type f -name "*.d.ts" -print0 | xargs -0 sed -i '' -e 's/declare module.*/declare module "react-native-background-geolocation" \{/g'
@@ -1,4 +0,0 @@
1
- <html>
2
- <meta http-equiv="refresh" content="0; URL=classes/backgroundgeolocation.backgroundgeolocation-1.html" />
3
- <body></body>
4
- </html>
@@ -1,23 +0,0 @@
1
- #!/bin/sh
2
-
3
- echo "Analytics ID: $GA_ID"
4
-
5
- #typedoc --out docs --includeDeclarations --excludeExternals --listInvalidSymbolLinks --name "React Native Background Geolocation" --theme ./node_modules/typedoc-theme-transistor/src/default --mode file --gaID $GA_ID --gaSite "auto" ./src/declarations/
6
-
7
- typedoc --out docs \
8
- --tsconfig ./scripts/tsconfig.json \
9
- --excludeExternals \
10
- --listInvalidSymbolLinks \
11
- --readme none \
12
- --name "React Native Background Geolocation" \
13
- --theme node_modules/\@transistorsoft/typedoc-theme/bin/default \
14
- --highlightTheme monokai \
15
- --gaID $GA_ID \
16
- --gaSite "auto" \
17
- --plugin ./node_modules/\@transistorsoft/typedoc-theme/node_modules/\@transistorsoft/typedoc-plugin-mediaplayer \
18
- --plugin ./node_modules/\@transistorsoft/typedoc-theme/node_modules/\@transistorsoft/typedoc-plugin-gitlink \
19
- --plugin ./node_modules/\@transistorsoft/typedoc-theme/node_modules/typedoc-plugin-merge-modules \
20
- ./src/declarations/
21
-
22
- touch ./docs/.nojekyll
23
-
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "",
4
- "allowSyntheticDefaultImports": true,
5
- "declaration": true,
6
- "emitDecoratorMetadata": true,
7
- "experimentalDecorators": true,
8
- "lib": [
9
- "dom",
10
- "es2015"
11
- ],
12
- "module": "es2015",
13
- "moduleResolution": "node",
14
- "sourceMap": true,
15
- "target": "es5"
16
- },
17
- "include": [
18
- "../src/declarations/*.d.ts",
19
- "../src/declarations/interfaces/*d.ts"
20
- ]
21
- }
@@ -1,171 +0,0 @@
1
- const path = require('path');
2
- const fs = require('fs');
3
- const glob = require('glob');
4
- // unfortunately we can't use the 'plist' module at the moment for parsing
5
- // because it has a few issues with empty strings and keys.
6
- // There are several issues and PRs on that repository open though and hopefully
7
- // we can revert back to only using one module once they're merged.
8
- const plistParser = require('fast-plist');
9
- const plistWriter = require('plist');
10
-
11
- // The getBuildProperty method of the 'xcode' project is a bit naive in that it
12
- // doesn't take a specific target but iterates over all of them and doesn't have
13
- // an exit condition if a property has been found.
14
- // Which in the case of react-native projects usually is the tvOS target because
15
- // it comes last.
16
- function getBuildProperty(project, property) {
17
- const firstTarget = project.getFirstTarget().firstTarget;
18
- const configurationList = project.pbxXCConfigurationList()[
19
- firstTarget.buildConfigurationList
20
- ];
21
- const defaultBuildConfiguration = configurationList.buildConfigurations.reduce(
22
- (acc, config) => {
23
- const buildSection = project.pbxXCBuildConfigurationSection()[
24
- config.value
25
- ];
26
- return buildSection.name ===
27
- configurationList.defaultConfigurationName
28
- ? buildSection
29
- : acc;
30
- },
31
- configurationList.buildConfigurations[0]
32
- );
33
-
34
- return defaultBuildConfiguration.buildSettings[property];
35
- }
36
-
37
- function getPlistPath(sourceDir, project) {
38
- const plistFile = getBuildProperty(project, 'INFOPLIST_FILE');
39
- if (!plistFile) {
40
- return null;
41
- }
42
- return path.join(
43
- sourceDir,
44
- plistFile.replace(/"/g, '').replace('$(SRCROOT)', '')
45
- );
46
- }
47
-
48
- function readPlist(sourceDir, project) {
49
- const plistPath = getPlistPath(sourceDir, project);
50
- if (!plistPath || !fs.existsSync(plistPath)) {
51
- return null;
52
- }
53
- return plistParser.parse(fs.readFileSync(plistPath, 'utf-8'));
54
- }
55
-
56
- function writePlist(sourceDir, project, plist) {
57
- fs.writeFileSync(
58
- getPlistPath(sourceDir, project),
59
- plistWriter.build(plist)
60
- );
61
- }
62
-
63
- // based on: https://github.com/facebook/react-native/blob/545072b/local-cli/link/ios/mapHeaderSearchPaths.js#L5
64
- function eachBuildConfiguration(project, predicate, callback) {
65
- const config = project.pbxXCBuildConfigurationSection();
66
- Object.keys(config)
67
- .filter(ref => ref.indexOf('_comment') === -1)
68
- .filter(ref => predicate(config[ref]))
69
- .forEach(ref => callback(config[ref]));
70
- }
71
-
72
- // this is being used to determine whether the current target is a react-native
73
- // project: https://github.com/facebook/react-native/blob/545072b/local-cli/link/ios/mapHeaderSearchPaths.js#L31
74
- function hasLCPlusPlus(config) {
75
- return (config.buildSettings.OTHER_LDFLAGS || []).indexOf('"-lc++"') >= 0;
76
- }
77
-
78
- // based on: https://github.com/facebook/react-native/blob/1490ab1/local-cli/core/ios/findProject.js
79
- function findProject(folder) {
80
- const GLOB_PATTERN = '**/*.xcodeproj';
81
- const TEST_PROJECTS = /test|example|sample/i;
82
- const IOS_BASE = 'ios';
83
- const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules)/**'];
84
-
85
- const projects = glob
86
- .sync(GLOB_PATTERN, {
87
- cwd: folder,
88
- ignore: GLOB_EXCLUDE_PATTERN,
89
- })
90
- .filter(project => {
91
- return path.dirname(project) === IOS_BASE || !TEST_PROJECTS.test(project);
92
- })
93
- .sort((projectA, projectB) => {
94
- return path.dirname(projectA) === IOS_BASE ? -1 : 1;
95
- });
96
-
97
- if (projects.length === 0) {
98
- return null;
99
- }
100
-
101
- return projects[0];
102
- };
103
-
104
- function addToFrameworkSearchPaths(project, path, recursive) {
105
- eachBuildConfiguration(project, hasLCPlusPlus, config => {
106
- if (!config.buildSettings.FRAMEWORK_SEARCH_PATHS) {
107
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = [];
108
- } else if (typeof config.buildSettings.FRAMEWORK_SEARCH_PATHS === 'string') {
109
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = [config.buildSettings.FRAMEWORK_SEARCH_PATHS];
110
- }
111
- const fullPath = '"' + path + (recursive ? '/**' : '') + '"';
112
-
113
- if (
114
- config.buildSettings.FRAMEWORK_SEARCH_PATHS.indexOf(fullPath) === -1
115
- ) {
116
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = config.buildSettings.FRAMEWORK_SEARCH_PATHS.concat(
117
- fullPath
118
- );
119
- }
120
- });
121
- }
122
-
123
- function removeFromFrameworkSearchPaths(project, path) {
124
- eachBuildConfiguration(project, hasLCPlusPlus, config => {
125
- if (!config.buildSettings.FRAMEWORK_SEARCH_PATHS) {
126
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = [];
127
- } else if (typeof config.buildSettings.FRAMEWORK_SEARCH_PATHS === 'string') {
128
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = [config.buildSettings.FRAMEWORK_SEARCH_PATHS];
129
- }
130
-
131
- const fullPath = unquote(path) + '/**';
132
-
133
- config.buildSettings.FRAMEWORK_SEARCH_PATHS = config.buildSettings.FRAMEWORK_SEARCH_PATHS.filter(
134
- searchPath =>
135
- unquote(searchPath) !== unquote(path) &&
136
- unquote(searchPath) !== fullPath
137
- );
138
- });
139
- }
140
-
141
- // The node-xcode library doesn't offer a method to get all target attributes,
142
- // so we'll have to implement it ourselves.
143
- function getTargetAttributes(project, target) {
144
- var attributes = project.getFirstProject()['firstProject']['attributes'];
145
- target = target || project.getFirstTarget();
146
-
147
- if (attributes['TargetAttributes'] === undefined) {
148
- attributes['TargetAttributes'] = {};
149
- }
150
-
151
- if (attributes['TargetAttributes'][target.uuid] === undefined) {
152
- attributes['TargetAttributes'][target.uuid] = {};
153
- }
154
-
155
- return attributes['TargetAttributes'][target.uuid];
156
- }
157
-
158
- function unquote(str) {
159
- return (str || '').replace(/^"(.*)"$/, '$1');
160
- }
161
-
162
- module.exports = {
163
- getBuildProperty: getBuildProperty,
164
- getPlistPath: getPlistPath,
165
- readPlist: readPlist,
166
- writePlist: writePlist,
167
- getTargetAttributes: getTargetAttributes,
168
- addToFrameworkSearchPaths: addToFrameworkSearchPaths,
169
- removeFromFrameworkSearchPaths: removeFromFrameworkSearchPaths,
170
- findProject: findProject,
171
- };