Use Sentry to report errors in production

This commit is contained in:
wpetit 2018-12-26 22:26:39 +01:00
parent a8e40f00a2
commit a196bb62ee
13 changed files with 464 additions and 21 deletions

View File

@ -1,3 +1,3 @@
{
"presets": ["module:metro-react-native-babel-preset"]
"presets": ["module:metro-react-native-babel-preset", "module:react-native-dotenv"]
}

2
.env.dist Normal file
View File

@ -0,0 +1,2 @@
SENTRY_DSN=
MAPBOX_ACCESS_TOKEN=

3
.gitignore vendored
View File

@ -54,3 +54,6 @@ buck-out/
# Bundle artifact
*.jsbundle
.env*
!.env.dist

View File

@ -78,6 +78,13 @@ project.ext.react = [
apply from: "../../node_modules/react-native/react.gradle"
/* Sentry configuration */
project.ext.sentryCli = [
logLevel: "debug",
flavorAware: true
]
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
@ -187,6 +194,7 @@ dependencies {
}
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.1'
}
implementation project(':react-native-sentry')
implementation "org.osmdroid:osmdroid-android:${rootProject.ext.osmdroidVersion}"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

View File

@ -15,6 +15,7 @@ import com.reactnativedocumentpicker.ReactNativeDocumentPicker;
import cl.json.ShareApplication;
import com.rnfs.RNFSPackage;
import com.mapbox.rctmgl.RCTMGLPackage;
import io.sentry.RNSentryPackage;
import java.util.Arrays;
import java.util.List;
@ -38,7 +39,8 @@ public class MainApplication extends Application implements ReactApplication, Sh
new RNSharePackage(),
new RNFSPackage(),
new ReactNativeDocumentPicker(),
new RCTMGLPackage()
new RCTMGLPackage(),
new RNSentryPackage()
);
}

View File

@ -1,4 +1,6 @@
rootProject.name = 'fieldnotes'
include ':react-native-sentry'
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
include ':mapbox-react-native-mapbox-gl'
project(':mapbox-react-native-mapbox-gl').projectDir = new File(rootProject.projectDir, '../node_modules/@mapbox/react-native-mapbox-gl/android/rctmgl')
include ':react-native-document-picker'

View File

@ -1,5 +1,10 @@
/** @format */
import { Sentry } from 'react-native-sentry';
import { SENTRY_DSN } from 'react-native-dotenv';
Sentry.config(SENTRY_DSN).install();
import {AppRegistry} from 'react-native';
import App from './src/app';
import {name as appName} from './app.json';

409
package-lock.json generated
View File

@ -843,6 +843,237 @@
"redux-persist": "^4.5.0"
}
},
"@sentry/cli": {
"version": "1.37.2",
"resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-1.37.2.tgz",
"integrity": "sha512-AWZ2Pbp2hhtJag9sH4qP07vlEt7Y3sGdr0x+dxAkTMbUIRyFQeMycpGc4+sKt26bl0LIdp6FVoYhP/Ix2LqyEw==",
"requires": {
"fs-copy-file-sync": "^1.1.1",
"https-proxy-agent": "^2.2.1",
"mkdirp": "^0.5.1",
"node-fetch": "^2.1.2",
"progress": "2.0.0",
"proxy-from-env": "^1.0.0"
}
},
"@sentry/wizard": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/@sentry/wizard/-/wizard-0.12.1.tgz",
"integrity": "sha512-kSqGcETUHR6n3DlyU/gcCwu+fcDVveEFXmLqGvib7c4nlV/ZwxT0J9TQi2u3Ux5EZQjYjTsdtvw6PYXvPXRPZA==",
"requires": {
"@sentry/cli": "^1.36.1",
"chalk": "^2.4.1",
"glob": "^7.1.3",
"inquirer": "^6.2.0",
"lodash": "^4.17.11",
"opn": "^5.4.0",
"r2": "^2.0.1",
"read-env": "^1.3.0",
"xcode": "git+https://github.com/apache/cordova-node-xcode.git#e7646f0680d509b590b839e567c217590451505b",
"yargs": "^12.0.2"
},
"dependencies": {
"ansi-regex": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz",
"integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w=="
},
"camelcase": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz",
"integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA=="
},
"chardet": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"requires": {
"nice-try": "^1.0.4",
"path-key": "^2.0.1",
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"execa": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz",
"integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==",
"requires": {
"cross-spawn": "^6.0.0",
"get-stream": "^3.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
}
},
"external-editor": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz",
"integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==",
"requires": {
"chardet": "^0.7.0",
"iconv-lite": "^0.4.24",
"tmp": "^0.0.33"
}
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"requires": {
"locate-path": "^3.0.0"
}
},
"inquirer": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.1.tgz",
"integrity": "sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg==",
"requires": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.0.0",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^3.0.0",
"figures": "^2.0.0",
"lodash": "^4.17.10",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rxjs": "^6.1.0",
"string-width": "^2.1.0",
"strip-ansi": "^5.0.0",
"through": "^2.3.6"
}
},
"invert-kv": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
"integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA=="
},
"lcid": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
"integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
"requires": {
"invert-kv": "^2.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"mem": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz",
"integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==",
"requires": {
"map-age-cleaner": "^0.1.1",
"mimic-fn": "^1.0.0",
"p-is-promise": "^1.1.0"
}
},
"opn": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/opn/-/opn-5.4.0.tgz",
"integrity": "sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==",
"requires": {
"is-wsl": "^1.1.0"
}
},
"os-locale": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz",
"integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==",
"requires": {
"execa": "^0.10.0",
"lcid": "^2.0.0",
"mem": "^4.0.0"
}
},
"p-limit": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz",
"integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz",
"integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ=="
},
"strip-ansi": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz",
"integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==",
"requires": {
"ansi-regex": "^4.0.0"
}
},
"uuid": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz",
"integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE="
},
"xcode": {
"version": "git+https://github.com/apache/cordova-node-xcode.git#e7646f0680d509b590b839e567c217590451505b",
"from": "git+https://github.com/apache/cordova-node-xcode.git#e7646f0680d509b590b839e567c217590451505b",
"requires": {
"simple-plist": "^0.2.1",
"uuid": "3.0.1"
}
},
"yargs": {
"version": "12.0.5",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz",
"integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==",
"requires": {
"cliui": "^4.0.0",
"decamelize": "^1.2.0",
"find-up": "^3.0.0",
"get-caller-file": "^1.0.1",
"os-locale": "^3.0.0",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"set-blocking": "^2.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
"y18n": "^3.2.1 || ^4.0.0",
"yargs-parser": "^11.1.1"
}
},
"yargs-parser": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
"integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"@turf/helpers": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-4.6.0.tgz",
@ -898,6 +1129,14 @@
"integrity": "sha512-ugTb7Lq7u4GfWSqqpwE0bGyoBZNMTok/zDBXxfEG0QM50jNlGhIWjRC1pPN7bvV1anhF+bs+/gNcRw+o55Evbg==",
"dev": true
},
"agent-base": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
"integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==",
"requires": {
"es6-promisify": "^5.0.0"
}
},
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
@ -1588,6 +1827,15 @@
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-dotenv": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/babel-plugin-dotenv/-/babel-plugin-dotenv-0.1.1.tgz",
"integrity": "sha1-nI+upnp8A0/n6UCZGHqy51c0ALw=",
"dev": true,
"requires": {
"dotenv": "^2.0.0"
}
},
"babel-plugin-istanbul": {
"version": "4.1.6",
"resolved": "http://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz",
@ -2314,8 +2562,7 @@
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"chalk": {
"version": "2.4.1",
@ -2386,7 +2633,6 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz",
"integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==",
"dev": true,
"requires": {
"string-width": "^2.1.1",
"strip-ansi": "^4.0.0",
@ -2396,14 +2642,12 @@
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
@ -2814,6 +3058,12 @@
"webidl-conversions": "^4.0.2"
}
},
"dotenv": {
"version": "2.0.0",
"resolved": "http://registry.npmjs.org/dotenv/-/dotenv-2.0.0.tgz",
"integrity": "sha1-vXWcNXqqcDZeAclrewvsCKbg2Uk=",
"dev": true
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -2897,6 +3147,19 @@
"is-symbol": "^1.0.2"
}
},
"es6-promise": {
"version": "4.2.5",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz",
"integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg=="
},
"es6-promisify": {
"version": "5.0.0",
"resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
"requires": {
"es6-promise": "^4.0.3"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@ -3291,6 +3554,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs-copy-file-sync": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/fs-copy-file-sync/-/fs-copy-file-sync-1.1.1.tgz",
"integrity": "sha512-2QY5eeqVv4m2PfyMiEuy9adxNP+ajf+8AR05cEi+OAzPcOj90hvFImeZhTmKLBgSd9EvG33jsD7ZRxsx9dThkQ=="
},
"fs-extra": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz",
@ -4058,6 +4326,30 @@
"sshpk": "^1.7.0"
}
},
"https-proxy-agent": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
"integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==",
"requires": {
"agent-base": "^4.1.0",
"debug": "^3.1.0"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"requires": {
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -4348,8 +4640,7 @@
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"is-utf8": {
"version": "0.2.1",
@ -4362,6 +4653,11 @@
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
},
"is-wsl": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz",
"integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
@ -5225,6 +5521,14 @@
"tmpl": "1.0.x"
}
},
"map-age-cleaner": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
"integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
"requires": {
"p-defer": "^1.0.0"
}
},
"map-cache": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
@ -6929,11 +7233,21 @@
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"p-defer": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
"integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww="
},
"p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
},
"p-is-promise": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
"integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4="
},
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
@ -7220,6 +7534,11 @@
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
},
"progress": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
"integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8="
},
"proj4": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/proj4/-/proj4-2.5.0.tgz",
@ -7256,6 +7575,11 @@
"object-assign": "^4.1.1"
}
},
"proxy-from-env": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
"integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4="
},
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
@ -7297,6 +7621,16 @@
"strict-uri-encode": "^2.0.0"
}
},
"r2": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/r2/-/r2-2.0.1.tgz",
"integrity": "sha512-EEmxoxYCe3LHzAUhRIRxdCKERpeRNmlLj6KLUSORqnK6dWl/K5ShmDGZqM2lRZQeqJgF+wyqk0s1M7SWUveNOQ==",
"requires": {
"caseless": "^0.12.0",
"node-fetch": "^2.0.0-alpha.8",
"typedarray-to-buffer": "^3.1.2"
}
},
"raf": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz",
@ -7332,6 +7666,11 @@
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
},
"raven-js": {
"version": "3.27.0",
"resolved": "https://registry.npmjs.org/raven-js/-/raven-js-3.27.0.tgz",
"integrity": "sha512-vChdOL+yzecfnGA+B5EhEZkJ3kY3KlMzxEhShKh6Vdtooyl0yZfYNFQfYzgMf2v4pyQa+OTZ5esTxxgOOZDHqw=="
},
"react": {
"version": "16.6.0",
"resolved": "https://registry.npmjs.org/react/-/react-16.6.0.tgz",
@ -7566,6 +7905,15 @@
"resolved": "https://registry.npmjs.org/react-native-document-picker/-/react-native-document-picker-2.2.0.tgz",
"integrity": "sha512-Msi+/3gDHgbnGXAoCmcxchITUfYMugvM0wLjHWOFpV57sk4jvBMJiJz30eLMmVkgdT5tE6WcHXTK/TXa5FWelw=="
},
"react-native-dotenv": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/react-native-dotenv/-/react-native-dotenv-0.2.0.tgz",
"integrity": "sha1-MRVRy2o1o9z+3mSL3tVcDj7OV50=",
"dev": true,
"requires": {
"babel-plugin-dotenv": "0.1.1"
}
},
"react-native-drawer": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/react-native-drawer/-/react-native-drawer-2.5.0.tgz",
@ -7643,6 +7991,15 @@
"resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-1.0.0-alpha.15.tgz",
"integrity": "sha512-S2OM/ieD+Krk+0/Z2Vz2rTUWYud5hJgCRZqXRtqEfMgEcGI4FBopXp7mwXCGbA2PFLjZwZSwLlsZ6RX30WnjRw=="
},
"react-native-sentry": {
"version": "0.40.2",
"resolved": "https://registry.npmjs.org/react-native-sentry/-/react-native-sentry-0.40.2.tgz",
"integrity": "sha512-CRA3XinKNE066yb6HQXNCGighlX6t4oG7dbHO3WQ35Pwt9IwsnIvfa7OjeEhCI/mUrjLZ1NkijfXvFMiSjLsIA==",
"requires": {
"@sentry/wizard": "^0.12.1",
"raven-js": "^3.24.2"
}
},
"react-native-share": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/react-native-share/-/react-native-share-1.1.3.tgz",
@ -7844,6 +8201,21 @@
"tween-functions": "^1.0.1"
}
},
"read-env": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/read-env/-/read-env-1.3.0.tgz",
"integrity": "sha512-DbCgZ8oHwZreK/E2E27RGk3EUPapMhYGSGIt02k9sX6R3tCFc4u4tkltKvkCvzEQ3SOLUaiYHAnGb+TdsnPp0A==",
"requires": {
"camelcase": "5.0.0"
},
"dependencies": {
"camelcase": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz",
"integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA=="
}
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
@ -8165,6 +8537,14 @@
"rx-lite": "*"
}
},
"rxjs": {
"version": "6.3.3",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz",
"integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
"requires": {
"tslib": "^1.9.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@ -9237,6 +9617,11 @@
"resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz",
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM="
},
"tslib": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -9272,6 +9657,14 @@
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
"requires": {
"is-typedarray": "^1.0.0"
}
},
"ua-parser-js": {
"version": "0.7.18",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.18.tgz",

View File

@ -10,6 +10,7 @@
"@babel/runtime": "^7.1.2",
"@mapbox/react-native-mapbox-gl": "^6.1.1",
"@redux-offline/redux-offline": "^2.4.0",
"base-64": "^0.1.0",
"fast-png": "^3.1.0",
"geotiff": "^1.0.0-beta.6",
"lodash.throttle": "^4.1.1",
@ -22,6 +23,7 @@
"react-native-document-picker": "^2.2.0",
"react-native-fs": "^2.12.1",
"react-native-maps": "git://github.com/fqborges/react-native-maps.git#osmdroid+hotfix",
"react-native-sentry": "^0.40.2",
"react-native-share": "^1.1.3",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.18.1",
@ -35,6 +37,7 @@
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "^0.50.0",
"react-native-dotenv": "^0.2.0",
"react-test-renderer": "16.5.0",
"redux-logger": "^3.0.6"
},

View File

@ -3,8 +3,9 @@ import { connect } from 'react-redux';
import Mapbox from '@mapbox/react-native-mapbox-gl';
import { Icon, View, CheckBox, Text } from 'native-base';
import throttle from 'lodash.throttle';
import { MAPBOX_ACCESS_TOKEN } from 'react-native-dotenv';
Mapbox.setAccessToken('pk.eyJ1IjoiY2Fkb2xlcyIsImEiOiJjanEyZGdwZDUxMGxtNDNwM3hjdndsdmVvIn0.YaxEiRWUe25A7D7xSXucGA');
Mapbox.setAccessToken(MAPBOX_ACCESS_TOKEN);
const styles = {
container: {

View File

@ -28,19 +28,22 @@ export default function sitesReducer(state = defaultState, action) {
}
function handleCreateSite(state, action) {
return {
const newState = {
...state,
byUUID: {
...state.byUUID,
[action.uuid]: {
name: action.name,
creationDate: action.creationDate,
plan: {
name: action.planName,
}
creationDate: action.creationDate
}
},
};
if (action.planName) {
newState.byUUID[action.uuid].plan = {
name: action.planName
};
}
return newState;
};
function handleUpdateSite(state, action) {

View File

@ -10,6 +10,8 @@ import {
} from '../actions';
import { project } from '../../util';
import { delay } from 'redux-saga';
import { Sentry } from 'react-native-sentry';
import { encode, decode } from 'base-64';
const GeoTIFF = require('geotiff/dist/geotiff.bundle');
const FastPNG = require('fast-png');
@ -28,7 +30,7 @@ function* updateSitePlanSaga(action) {
try {
yield put(addNotification(NOTIFICATION_LEVEL_INFO, "Vérification des données du plan..."));
yield put(addNotification(NOTIFICATION_LEVEL_INFO, "Extraction des données du plan... L'opération peut prendre quelques minutes."));
yield delay(1500);
const base64Data = yield RNFS.readFile(planURI, 'base64');
@ -67,6 +69,7 @@ function* updateSitePlanSaga(action) {
yield put(addNotification(NOTIFICATION_LEVEL_SUCCESS, "Données du plan chargées avec succès."));
} catch(err) {
Sentry.captureException(err);
yield put({type: UPDATE_PLAN_FAILURE, uuid, err });
yield put(addNotification(NOTIFICATION_LEVEL_ERROR, "Erreur inconnue lors du chargement des données du plan."));
}
@ -78,6 +81,7 @@ function* cleanupPlansSaga() {
const state = yield select();
const plans = new Set();
const deleted = [];
Object.keys(state.sites.byUUID).forEach(siteUUID => {
const site = state.sites.byUUID[siteUUID];
@ -85,9 +89,15 @@ function* cleanupPlansSaga() {
plans.add(site.plan.path);
});
const files = yield RNFS.readDir(PlanDirectory);
const exists = yield RNFS.exists(PlanDirectory);
if (!exists) {
yield put({ type: CLEANUP_PLANS_SUCCESS, deleted });
return;
}
const deleted = [];
const files = yield RNFS.readDir(PlanDirectory);
const promises = files.map(f => {
if (!f.isFile() || plans.has(f.path)) return;
deleted.push(f.path);
@ -99,12 +109,13 @@ function* cleanupPlansSaga() {
yield put({ type: CLEANUP_PLANS_SUCCESS, deleted });
} catch(err) {
Sentry.captureException(err);
yield put({ type: CLEANUP_PLANS_FAILURE, err });
}
}
function base64ToArrayBuffer(base64) {
var binary_string = window.atob(base64);
var binary_string = decode(base64);
var len = binary_string.length;
var bytes = new Uint8Array( len );
for (var i = 0; i < len; i++) {
@ -120,5 +131,5 @@ function arrayBufferToBase64(buffer) {
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return window.btoa(binary);
return encode(binary);
}

View File

@ -35,12 +35,14 @@ import {
NOTIFICATION_LEVEL_SUCCESS,
} from '../actions';
import { DeviceEventEmitter } from 'react-native';
import Sentry from 'react-native-sentry';
function* discoverReachviewServicesSaga() {
try {
const services = yield call(Reachview.discover, 10);
yield put({ type: DISCOVER_REACHVIEW_SERVICES_SUCCESS, services });
} catch(err) {
Sentry.captureException(err);
yield put({ type: DISCOVER_REACHVIEW_SERVICES_FAILURE, err });
}
}
@ -60,6 +62,7 @@ function* connectReachviewServiceSaga({ service }) {
});
} catch(err) {
Sentry.captureException(err);
yield put({ type: CONNECT_REACHVIEW_SERVICE_FAILURE, err });
}
}
@ -70,6 +73,7 @@ function* retrieveModuleModeSaga() {
const mode = yield call(Reachview.retrieveModuleMode, 5);
yield put({ type: GET_MODULE_MODE_SUCCESS, mode });
} catch(err) {
Sentry.captureException(err);
yield put({ type: GET_MODULE_MODE_FAILURE, err });
}
}
@ -81,6 +85,7 @@ function* reachviewStatusBroadcastSaga() {
yield call(Reachview.startStatusBroadcast, 2000);
yield put({ type: REACHVIEW_STATUS_BROADCAST_SUCCESS });
} catch(err) {
Sentry.captureException(err);
yield put({ type: REACHVIEW_STATUS_BROADCAST_FAILURE, err });
return;
}
@ -92,6 +97,7 @@ function* reachviewStatusBroadcastSaga() {
yield put({ type: UPDATE_REACH_MODULES_STATUS, status });
}
} catch(err) {
Sentry.captureException(err);
yield put({ type: REACHVIEW_STATUS_BROADCAST_FAILURE, err });
} finally {
statusChannel.close();
@ -130,6 +136,7 @@ function* connectToRoverSaga() {
});
if (result.failure) {
Sentry.captureException(result.failure.err);
yield put({ type: CONNECT_TO_ROVER_FAILURE, err: result.failure.err });
return;
}
@ -171,6 +178,7 @@ function* connectToRoverSaga() {
} catch(err) {
if (yield cancelled()) return;
Sentry.captureException(err);
yield put({ type: CONNECT_TO_ROVER_FAILURE, err });
return;
}
@ -182,6 +190,7 @@ function* getBaseConfigurationSaga() {
const config = yield call(Reachview.getBaseConfiguration, 5);
yield put({ type: GET_BASE_CONFIGURATION_SUCCESS, config });
} catch(err) {
Sentry.captureException(err);
yield put({ type: GET_BASE_CONFIGURATION_FAILURE, err });
}
}
@ -191,6 +200,7 @@ function* setBaseManualPositionSaga({ lat , lon, alt, antennaHeight }) {
yield call(Reachview.setBaseManualPosition, 5, lat , lon, alt, antennaHeight);
yield put({ type: SET_BASE_MANUAL_POSITION_SUCCESS });
} catch(err) {
Sentry.captureException(err);
yield put({ type: SET_BASE_MANUAL_POSITION_FAILURE, err });
}
yield put(addNotification(NOTIFICATION_LEVEL_SUCCESS, "Position de la base modifiée."))