├── .env ├── .expo └── settings.json ├── .gitignore ├── App.js ├── LICENSE ├── README.md ├── Screenshots ├── logsView.jpg ├── notificationView.jpg ├── settingsView.jpg ├── settingsView2.jpg └── trackerView.jpg ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── build_defs.bzl │ ├── debug.keystore │ ├── proguard-rules.pro │ ├── src │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── overlandandroid │ │ │ │ └── ReactNativeFlipper.java │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── overlandandroid │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── version.properties ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios ├── OverlandAndroid-tvOS │ └── Info.plist ├── OverlandAndroid-tvOSTests │ └── Info.plist ├── OverlandAndroid.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── OverlandAndroid-tvOS.xcscheme │ │ └── OverlandAndroid.xcscheme ├── OverlandAndroid │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ └── main.m ├── OverlandAndroidTests │ ├── Info.plist │ └── OverlandAndroidTests.m └── Podfile ├── metro.config.js ├── package-lock.json ├── package.json ├── privacy_policy.html ├── privacy_policy.md ├── src ├── assets │ └── .blank ├── components │ ├── .blank │ ├── app-navigation │ │ ├── components │ │ │ └── tab-icon │ │ │ │ └── index.js │ │ └── index.js │ └── container │ │ └── index.js ├── scenes │ ├── logs │ │ └── index.js │ ├── settings │ │ ├── components │ │ │ ├── activity-type │ │ │ │ ├── components │ │ │ │ │ └── activity-type-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── defer-location-updates │ │ │ │ ├── components │ │ │ │ │ └── defer-location-updates-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── desired-accuracy │ │ │ │ ├── components │ │ │ │ │ └── desired-accuracy-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── notifications-switch │ │ │ │ ├── components │ │ │ │ │ └── notif-switch-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── point-per-batch │ │ │ │ ├── components │ │ │ │ │ └── point-per-batch-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── receiver-endpoint │ │ │ │ ├── components │ │ │ │ │ └── receiver-endpoint-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── resume-geofence │ │ │ │ ├── components │ │ │ │ │ └── resume-geofence-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── settings-container │ │ │ │ └── index.js │ │ │ ├── significant-location │ │ │ │ ├── components │ │ │ │ │ └── significant-location-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ └── update-switch │ │ │ │ ├── components │ │ │ │ └── update-switch-container │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ └── index.js │ └── tracker │ │ ├── components │ │ ├── tracker-container │ │ │ └── index.js │ │ ├── tracker-interval │ │ │ ├── components │ │ │ │ └── tracker-interval-container │ │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── tracker-location-display │ │ │ ├── components │ │ │ │ ├── gps-element │ │ │ │ │ ├── components │ │ │ │ │ │ └── gps-container │ │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ ├── location-element │ │ │ │ │ ├── components │ │ │ │ │ │ └── location-container │ │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ └── tracker-location-display-container │ │ │ │ │ └── index.js │ │ │ └── index.js │ │ ├── tracker-switch │ │ │ ├── components │ │ │ │ └── tracker-switch-container │ │ │ │ │ └── index.js │ │ │ └── index.js │ │ └── trip-display │ │ │ ├── components │ │ │ ├── icon-element │ │ │ │ ├── components │ │ │ │ │ └── icon-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── location-element │ │ │ │ ├── components │ │ │ │ │ └── location-container │ │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ ├── trip-display-container │ │ │ │ └── index.js │ │ │ └── trip-mode │ │ │ │ ├── components │ │ │ │ ├── icon-element │ │ │ │ │ ├── components │ │ │ │ │ │ └── icon-container │ │ │ │ │ │ │ └── index.js │ │ │ │ │ └── index.js │ │ │ │ └── trip-mode-container │ │ │ │ │ └── index.js │ │ │ │ └── index.js │ │ │ └── index.js │ │ └── index.js └── utils │ ├── scaling.js │ └── store.js └── yarn.lock /.env: -------------------------------------------------------------------------------- 1 | MYAPP_RELEASE_NAME=com.openhumans.app.overland 2 | MYAPP_RELEASE_API_KEY="YOUR_API_KEY" 3 | MYAPP_RELEASE_STORE_FILE=my-key.keystore 4 | MYAPP_RELEASE_KEY_ALIAS=my-key-alias 5 | MYAPP_RELEASE_STORE_PASSWORD="YOUR_STORE_PASSWORD" 6 | MYAPP_RELEASE_KEY_PASSWORD="YOUR_KEY_PASSWORD" 7 | -------------------------------------------------------------------------------- /.expo/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "hostType": "lan", 3 | "lanType": "ip", 4 | "dev": true, 5 | "minify": false, 6 | "urlRandomness": null, 7 | "https": false 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | android/.idea 29 | android/.gradle 30 | android/local.properties 31 | android/*.iml 32 | # Gradle files 33 | android/.gradle/ 34 | android/build/ 35 | android/app/*.iml 36 | # node.js 37 | # 38 | node_modules/ 39 | npm-debug.log 40 | yarn-error.log 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | # fastlane 48 | # 49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 50 | # screenshots whenever they are needed. 51 | # For more information about the recommended setup visit: 52 | # https://docs.fastlane.tools/best-practices/source-control/ 53 | 54 | */fastlane/report.xml 55 | */fastlane/Preview.html 56 | */fastlane/screenshots 57 | 58 | # Bundle artifact 59 | *.jsbundle 60 | 61 | # CocoaPods 62 | /ios/Pods/ 63 | VoxImplantDemo.xcworkspace 64 | VoximplantDemo.xcworkspace 65 | 66 | android/app/google-services.json 67 | # Visual studio 68 | .vscode 69 | .vs 70 | 71 | my-key.keystore 72 | .env.production 73 | 74 | Public_release/ 75 | 76 | pepk.jar 77 | encrypted_private_key_path 78 | upload_certificate.pem 79 | -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Component} from 'react'; 3 | import { Alert, InteractionManager, View, Text, BackHandler, Linking } from 'react-native'; 4 | import { NavigationContainer } from '@react-navigation/native'; 5 | import {storeData,fetchData} from './src/utils/store'; 6 | 7 | import AppNavigation from './src/components/app-navigation'; 8 | 9 | 10 | import {Spinner} from 'native-base'; 11 | import BackgroundGeolocation, { 12 | State, 13 | Config, 14 | Location, 15 | LocationError, 16 | Geofence, 17 | HttpEvent, 18 | MotionActivityEvent, 19 | ProviderChangeEvent, 20 | MotionChangeEvent, 21 | GeofenceEvent, 22 | GeofencesChangeEvent, 23 | HeartbeatEvent, 24 | ConnectivityChangeEvent, 25 | DeviceSettings, DeviceSettingsRequest, 26 | Notification, 27 | DeviceInfo, 28 | Authorization, AuthorizationEvent, 29 | TransistorAuthorizationToken 30 | } from "react-native-background-geolocation"; 31 | import Dialog from "react-native-dialog"; 32 | import AFicons from 'react-native-vector-icons/FontAwesome'; 33 | 34 | import NetInfo from "@react-native-community/netinfo"; 35 | 36 | console.disableYellowBox = true; 37 | 38 | console.log('===================================================='); 39 | 40 | if (!__DEV__) { 41 | console.log = () => {}; 42 | } 43 | 44 | 45 | class Application extends Component { 46 | constructor(){ 47 | super() 48 | this.state = {loading: true}; 49 | global.wifiInfo = {"ssid":""} 50 | //global.isConnected = false; 51 | } 52 | 53 | async componentDidMount() { 54 | 55 | 56 | const unsubscribe = NetInfo.addEventListener(state => { 57 | if(state.type=="wifi"){ 58 | global.wifiInfo.ssid = state.details.ssid; 59 | }else{ 60 | global.wifiInfo.ssid = ""; 61 | } 62 | this.updateLocationTemplate(); 63 | }); 64 | 65 | //// 66 | // 1. Wire up event-listeners 67 | // 68 | 69 | // This handler fires whenever bgGeo receives a location update. 70 | BackgroundGeolocation.onLocation(this.onLocation, this.onError); 71 | 72 | // This handler fires when movement states changes (stationary->moving; moving->stationary) 73 | BackgroundGeolocation.onMotionChange(this.onMotionChange); 74 | 75 | // This event fires when a change in motion activity is detected 76 | BackgroundGeolocation.onActivityChange(this.onActivityChange); 77 | 78 | // This event fires when the user toggles location-services authorization 79 | BackgroundGeolocation.onProviderChange(this.onProviderChange); 80 | 81 | BackgroundGeolocation.onHttp(httpEvent => { 82 | if (__DEV__) { 83 | console.log("[http] ", httpEvent.success, httpEvent.status,httpEvent.responseText); 84 | } 85 | }); 86 | BackgroundGeolocation.onHeartbeat((event) => { 87 | if (__DEV__) { 88 | console.log("[onHeartbeat] ", event); 89 | } 90 | }); 91 | 92 | let _autoSyncThreshold = await fetchData ('autoSyncThreshold'); 93 | if(!_autoSyncThreshold) _autoSyncThreshold = 100; 94 | else _autoSyncThreshold = Number(_autoSyncThreshold); 95 | let _urlSync = await fetchData ('url'); 96 | if(!_urlSync) _urlSync = 'https://'; 97 | let _deviceIdSync = await fetchData ('device_id'); 98 | if(!_deviceIdSync) _deviceIdSync = ''; 99 | let s_debugNotification = await fetchData ('debugNotification'); 100 | if(!s_debugNotification) s_debugNotification = 'False'; 101 | let _debugNotification = s_debugNotification==="True"?true:false; 102 | let s_desiredAccuracy = await fetchData ('desiredAccuracy'); 103 | if(!s_desiredAccuracy) s_desiredAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_HIGH; 104 | let _desiredAccuracy = Number(s_desiredAccuracy)<0?0:Number(s_desiredAccuracy); 105 | let _httpTimeout = await fetchData ('httpTimeout'); 106 | if(!_httpTimeout) _httpTimeout = 60000; 107 | else _httpTimeout = Number(_httpTimeout); 108 | let _useSignificantChangesOnly = await fetchData ('useSignificantChangesOnly'); 109 | if(!_useSignificantChangesOnly) _useSignificantChangesOnly = 'False'; 110 | //_useSignificantChangesOnly is a string "False" or "True" 111 | _useSignificantChangesOnly = _useSignificantChangesOnly=='True' ? true:false; 112 | let _templateSignificantChangesOnly = _useSignificantChangesOnly ? "enabled":"disabled"; 113 | let _stopOnStationary = await fetchData ('stopOnStationary'); 114 | if(!_stopOnStationary) _stopOnStationary = "False"; 115 | _stopOnStationary = _stopOnStationary=='True' ? true:false; 116 | let _deferTime = await fetchData ('deferTime'); 117 | if(!_deferTime) _deferTime = 0; 118 | else _deferTime = Number(_deferTime); 119 | let _wifiInfo = global.wifiInfo.ssid; 120 | if(!_wifiInfo) _wifiInfo = ""; 121 | 122 | let s_geofenceProximityRadius = await fetchData ('geofenceProximityRadius'); 123 | let _geofenceProximityRadius; 124 | if(!s_geofenceProximityRadius) _geofenceProximityRadius = 1000; 125 | else{ 126 | _geofenceProximityRadius = s_geofenceProximityRadius ==='off'?1000:Number(s_geofenceProximityRadius) ; 127 | console.log("_geofenceProximityRadius :: ",_geofenceProximityRadius) 128 | } 129 | // 130 | // 2. Execute #ready method to initiate 131 | // 132 | BackgroundGeolocation.ready({ 133 | desiredAccuracy: _desiredAccuracy, 134 | activityType: BackgroundGeolocation.ACTIVITY_TYPE_OTHER, 135 | heartbeatInterval: 60, 136 | distanceFilter: 5, 137 | locationUpdateInterval: 10000, // Get a location every 5 seconds 138 | deferTime: _deferTime, 139 | useSignificantChangesOnly: _useSignificantChangesOnly, 140 | stopOnStationary: false,//_stopOnStationary, 141 | stopTimeout: 10, 142 | // Activity Recognition 143 | // Application config 144 | debug: _debugNotification, // <-- enable this hear sounds for background-geolocation life-cycle. 145 | logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, 146 | 147 | stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app. 148 | startOnBoot: true, // <-- Auto start tracking when device is powered-up. 149 | // HTTP / SQLite config 150 | url: _urlSync, 151 | batchSync: true, // <-- [Default: false] Set true to sync locations to server in a single HTTP request. 152 | autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives. 153 | autoSyncThreshold: _autoSyncThreshold, 154 | maxBatchSize: 2000, 155 | httpTimeout: _httpTimeout, 156 | //httpTimeout: _httpTimeout, 157 | geofenceProximityRadius: 500, 158 | httpRootProperty: 'locations', 159 | locationTemplate: '{\ 160 | "type": "Feature", \ 161 | "geometry": { \ 162 | "type": "Point", \ 163 | "coordinates": [ <%=longitude%>, <%=latitude%> ] },\ 164 | "properties": { \ 165 | "timestamp": "<%= timestamp %>", \ 166 | "battery_level": <%=battery.level%>, \ 167 | "speed": <%=speed%>, \ 168 | "altitude": <%=altitude%>,\ 169 | "horizontal_accuracy": <%=accuracy%>,\ 170 | "vertical_accuracy": <%=altitude_accuracy%>,\ 171 | "significant_change": \"'+_templateSignificantChangesOnly+'\" ,\ 172 | "locations_in_payload": 1,\ 173 | "battery_state": <%=battery.is_charging%>,\ 174 | "device_id": \"'+ _deviceIdSync +'\" ,\ 175 | "wifi": \"'+ _wifiInfo +'\" ,\ 176 | "deferred": \"'+_deferTime+'\",\ 177 | "desired_accuracy": \"'+ _desiredAccuracy +'\",\ 178 | "activity": "other",\ 179 | "pauses": <%=is_moving%>,\ 180 | "motion": ["<%=activity.type%>"]\ 181 | }\ 182 | }', 183 | notification: { 184 | channelName: "Allow Notification of Location Tracker" 185 | } 186 | }, (state) => { 187 | console.log("- BackgroundGeolocation is configured and ready: ", state.enabled); 188 | console.log(state) 189 | this.setState({loading:false}) 190 | 191 | if (!state.enabled) { 192 | //// 193 | // 3. Start tracking! 194 | // 195 | BackgroundGeolocation.start(function() { 196 | if (__DEV__) { 197 | console.log("- Start success"); 198 | } 199 | }); 200 | } 201 | }); 202 | 203 | } 204 | 205 | // You must remove listeners when your component unmounts 206 | componentWillUnmount() { 207 | BackgroundGeolocation.removeListeners(); 208 | } 209 | onLocation(location) { 210 | //console.log('[location] -', location); 211 | } 212 | onError(error) { 213 | if (__DEV__) { 214 | console.warn('[location] ERROR -', error); 215 | } 216 | } 217 | async onActivityChange(event) { 218 | if (__DEV__) { 219 | console.log('[activitychange] -', event); // eg: 'on_foot', 'still', 'in_vehicle' 220 | } 221 | } 222 | 223 | onProviderChange(provider) { 224 | if (__DEV__) { 225 | console.log('[providerchange] -', provider.enabled, provider.status); 226 | } 227 | BackgroundGeolocation.changePace(true); 228 | } 229 | onMotionChange(event) { 230 | if (__DEV__) { 231 | console.log('[motionchange] -', event.isMoving, event.location); 232 | } 233 | } 234 | 235 | updateLocationTemplate(){ 236 | BackgroundGeolocation.ready({}, (state) => { 237 | let _templateSignificantChangesOnly = state.useSignificantChangesOnly; 238 | let _deferTime = state.deferTime; 239 | let _desiredAccuracy = state.desiredAccuracy; 240 | let _deviceIdSync = state.device_id; 241 | let _wifiInfo = global.wifiInfo.ssid; 242 | if(!_wifiInfo) _wifiInfo = ""; 243 | let _template = '{\ 244 | "type": "Feature", \ 245 | "geometry": { \ 246 | "type": "Point", \ 247 | "coordinates": [ <%=longitude%>, <%=latitude%> ] },\ 248 | "properties": { \ 249 | "timestamp": "<%= timestamp %>", \ 250 | "battery_level": <%=battery.level%>, \ 251 | "speed": <%=speed%>, \ 252 | "altitude": <%=altitude%>,\ 253 | "horizontal_accuracy": <%=accuracy%>,\ 254 | "vertical_accuracy": <%=altitude_accuracy%>,\ 255 | "significant_change": \"'+_templateSignificantChangesOnly+'\" ,\ 256 | "locations_in_payload": 1,\ 257 | "battery_state": <%=battery.is_charging%>,\ 258 | "device_id": \"'+ _deviceIdSync +'\" ,\ 259 | "wifi": \"'+ _wifiInfo +'\" ,\ 260 | "deferred": \"'+_deferTime+'\",\ 261 | "desired_accuracy": \"'+ _desiredAccuracy +'\",\ 262 | "activity": "other",\ 263 | "pauses": <%=is_moving%>,\ 264 | "motion": ["<%=activity.type%>"]\ 265 | }\ 266 | }'; 267 | BackgroundGeolocation.setConfig({locationTemplate:_template}) 268 | }) 269 | }; 270 | 271 | 272 | 273 | render() { 274 | const isLoading = this.state.loading; 275 | return (<>{ isLoading ? : }); 276 | 277 | } 278 | } 279 | 280 | 281 | //Mise en conformité avec les règles relative à la geolocalisation de l'App Store de Google 282 | class NotificationLocalisation extends Component { 283 | constructor(){ 284 | super() 285 | this.state = {userIsNotInformed: true}; 286 | } 287 | async componentDidMount() { 288 | let _userIsNotInformed = await fetchData ('userIsNotInformed');//return a string 289 | if (__DEV__) { 290 | console.log("value of _userIsNotInformed :: ", _userIsNotInformed, typeof _userIsNotInformed ) 291 | } 292 | //init for the first launch of the app 293 | if(_userIsNotInformed == undefined ) { 294 | this.state.userIsNotInformed = true; 295 | await storeData({name:"@userIsNotInformed",value:this.state.userIsNotInformed.toString()})//convert to string 296 | }else { 297 | _userIsNotInformed = (_userIsNotInformed === 'true');//convert to boolean 298 | await this.setState({ userIsNotInformed: _userIsNotInformed });//save in state like boolean 299 | } 300 | } 301 | 302 | handleStart = async () => { 303 | await this.setState({ userIsNotInformed: false });//save in temporary state like boolean 304 | storeData({name:"@userIsNotInformed",value:this.state.userIsNotInformed.toString()})//save in local data like string 305 | }; 306 | handleQuit = async () => { 307 | await this.setState({ userIsNotInformed: true });//save in temporary state like boolean 308 | storeData({name:"@userIsNotInformed",value:this.state.userIsNotInformed.toString()})//save in local data like string 309 | BackHandler.exitApp(); 310 | }; 311 | 312 | render() { 313 | const userIsNotInformed = this.state.userIsNotInformed; 314 | return (<> 315 | <>{ userIsNotInformed ? 316 | 317 | 318 | 319 | Use your location 320 | 321 | The app Overland collects location data to enable position tracking even when the app is closed or not in use. 322 | Location data is collected on your device and is not sent to a server. You can send location data to any server you choose. 323 | If you choose, in the next step, to send the location data collected by Overland to an Openhumans Foundation server, then you agree to the collection and use of the information in accordance with the policy described via this link. 324 | 325 | 326 | 327 | {Linking.openURL('http://openhumansfoundation.org/Overland_android/privacy_policy.html')}}> 329 | Access to privacy policy 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | : } 338 | 339 | 340 | ); 341 | } 342 | }; 343 | 344 | 345 | const App: () => React$Node = () => { 346 | return ( 347 | <> 348 | 349 | 350 | 351 | 352 | ); 353 | }; 354 | 355 | export default App; 356 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Nicolas Eberlé 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overland GPS Tracker for Android 2 | 3 | GPS logger for Android devices in React Native. You can **[download this app from the Google Play Store](https://play.google.com/store/apps/details?id=com.openhumans.app.overland)**. 4 | 5 | Overland will send the data to a server of your choice. We offer a simple way to do this: You can use [https://overland.openhumans.org/](https://overland.openhumans.org/) to set up an endpoint that you can send the data to and collect it right from *Overland*. The data is privately and securely stored in *Open Humans*. 6 | 7 | This app is based on the app Overland for iOS developped by Aaron Parecki https://github.com/aaronpk/Overland-iOS 8 | 9 | It is an experiment at gathering data from an Android device to test the Core Location API of Android and its various settings. 10 | 11 | The app tracks: 12 | 13 | * GPS location 14 | * Motion State (walking, running, driving, cycling, stationary) 15 | * Battery level 16 | * Wifi access point (only name) 17 | 18 | The app gathers data with no network connection and stores locally on the device. The data is sent to the server in a batch at an interval set by the user. 19 | 20 | There are many settings available in the settings tab which allow you to adjust properties of the Core Location API. 21 | 22 | ## Documentation 23 | 24 | React Native does not allow you to launch an application in the background (acquisition and fetch data), we use the react-native-background-location API to reach the Core Location API of Android. https://transistorsoft.github.io/react-native-background-geolocation/. 25 | 26 | ### Notification Screen 27 | 28 | 29 | ### Tracker Screen 30 | 31 | 32 | 33 | The Tracker screen is where you control whether the app is active, and shows you some basic stats of what the app is doing. This is also where you start and stop trips. 34 | 35 | * `On/Off` - This master switch enables and disables tracking. When it's set to off, the app stops requesting location updates, and won't record or send any more data. 36 | * Main Slider - This slider controls the interval at which the app sends data to the server. Using the network connection is a huge source of battery drain, so you can save battery by sending infrequently to the server. The slider's range is from 1 second to 30 minutes, and the rightmost option is "off" which disables sending. This is useful when you know you don't have a network connection such as during flights. Data is queued up and will be sent once you enable sending later. 37 | * `Queued` - This number indicates how many location points are stored in the application's internal database ready to be sent. 38 | * `Last Sent` - Indicates how long ago the last batch was successfully sent to the server. 39 | * `Send Now` - Tapping this button will send one batch to the server immediately. 40 | * `Age` - The age of the last location point that was reported by the OS. You can use this to get a sense of how much data you are recording. 41 | * `Speed` - The speed in mph of the last location update received. 42 | * `Location` - Shows the latitude/longitude, accuracy, and altitude of the last location update received. 43 | * `Icon` - This icon indicates the mode of transport that will be written for the trip record. 44 | * `Duration` - When a trip is active, indicates how long the trip has been going for. 45 | * `Distance` - When a trip is active, indicates how far has been traveled in this trip. 46 | * `Start/Stop` - Starts and stops a trip record. After stopping a trip, the trip record is written to the database and sent to the server along with the location points. 47 | 48 | ### Settings 49 | 50 | 51 | 52 | 53 | The Settings screen allows you to set the parameters of the iOS CoreLocation API, which gives you fine-grained control over how the tracker behaves. 54 | 55 | These controls all set various properties of the LocationManager object. It is worth reading the [Android documentation](https://developer.android.com/reference/kotlin/android/location/LocationManager?hl=en) for more details, but a summary of them is below. 56 | 57 | * `Receiver Endpoint` - Tap this line to set the endpoint that the app will send data to. You can also configure a device ID which will be included in each record, and an access token which will be sent in the HTTP Authorization header. 58 | * `Significant Location` 59 | * Setting to "enabled" will register for [significant location changes](https://developer.apple.com/reference/corelocation/cllocationmanager/1423531-startmonitoringsignificantlocati) along with the continuous updates requested. Significant change events are triggered for example when you move to a new cell tower or when your nearby visible wifi access points change. It's not an exact science, and may be triggered more or less often than you expect. 60 | * Setting to "significant only" will *only* register significant changes, and will not request continuous updates. This will use very little battery for tracking, but will not result in detailed lines showing your tracks. 61 | * `Activity Type` - this setting is not available on Android 62 | * `Desired Accuracy` - Sets the [desiredAccuracy](https://developer.android.com/reference#PRIORITY_BALANCED_POWER_ACCURACY) property of the location manager. This is only a request for the general level of accuracy, not a guarantee. Setting to "Best" will use the most battery but will get highest accuracy location updates. Setting to "3km" will save the most battery but will result in infrequent location updates. 63 | * `Defers Location Updates` - The maximum wait time in milliseconds for location updates to be delivered to your callback, when they will all be delivered in a batch. It is worth reading Android's documentation of [deferred Location updates](https://developer.apple.com/documentation/corelocation/cllocationmanager/1620547-allowdeferredlocationupdates) for more information. This can have an effect on improving battery life. Defaults to 0 (no defer) 64 | * `Points per Batch` - Controls the number of location updates that will be sent with each HTTP request. Setting this to 50 will mean more requests to the server are required to flush the queue, but each request will be smaller. Setting this to 1000 means you'll be able to flush the queue with fewer requests, but each request will be much larger. Each location point can be around 600 bytes when serialized as JSON, so sending 1000 points in a request will mean the request body may be around 600kb. Lower batch sizes are likely better for flaky network connections, and larger batch sizes are good when on a reliable connection. Note that this does not affect the frequency at which data is sent to the server. 65 | * `Pause Updates Automatically` - Enabling this will use the iOS API for automatically pausing location updates. When disabled, it will prevent the OS from pausing location updates. Pausing location updates automatically is a great way to save battery when you are not moving for extended periods of time, although it does not always pick up tracking again immediately when you start moving. In some initial testing, the automatic pause tends to trigger about 10 minutes after you've stopped moving. 66 | * `Resume with Geofence` - This is not an core API, but is an attempt at overcoming the automatic pausing limitations. Setting a radius here will register an "exit" geofence whenever location updates are paused at that location. This will attempt to get the app woken up when the user leaves the area again, and when triggered, will resume tracking with the previous settings. 67 | * `Enable notifications` - Toggle whether the app should send notifications about events such as when tracking has been automatically stopped and started. 68 | 69 | ### Logs 70 | 71 | 72 | 73 | The list of stored location points. 74 | 75 | #### Configuration by Custom URL 76 | 77 | (-->overland) 78 | 79 | 80 | #### High Resolution Tracking 81 | 82 | To get high resolution data, you should set the following: 83 | 84 | * Resume with Geofence: Off 85 | * Significant Location: Disabled 86 | * Desired Accuracy: Best 87 | * Defers Location Updates: Never 88 | 89 | While moving, you will receive up to one point per second. When you're not moving, such as when you're at your desk, etc, there may be several minutes between location updates received. This will use a lot of battery, but will result in data that can be used to generate a picture similar to this level of detail. 90 | 91 | 92 | #### Battery Saving / Low Resolution 93 | 94 | To use very little battery, you can still get enough location info to know what neighborhood you're in, and likely also when you leave and return home. 95 | 96 | * Resume with Geofence: 500m 97 | * Significant Location: Enabled 98 | * Desired Accuracy: 100m 99 | * Defers Location Updates: 5min 100 | 101 | This will use much less battery than high resolution, while still gathering enough data you can use to roughly geotag posts or know what neighborhood you're in. For even more battery savings, you can set Significant Location Only, which will drastically reduce the amount of data you log but will use almost no battery. 102 | 103 | ## API 104 | 105 | The app will post the location data to the configured endpoint. The POST request will be an array of GeoJSON objects inside a property called "locations". The batch size is 200 but can be set [in the configuration](https://github.com/aaronpk/Overland-iOS/blob/master/GPSLogger/GLManager.h#L40). This request may look like the following: 106 | 107 | ``` 108 | POST /api HTTP/1.1 109 | Authorization: Bearer xxxxxx 110 | Content-Type: application/json 111 | 112 | { 113 | "locations": [ 114 | { 115 | "type": "Feature", 116 | "geometry": { 117 | "type": "Point", 118 | "coordinates": [ 119 | -122.030581, 120 | 37.331800 121 | ] 122 | }, 123 | "properties": { 124 | "timestamp": "2015-10-01T08:00:00-0700", 125 | "altitude": 0, 126 | "speed": 4, 127 | "horizontal_accuracy": 30, 128 | "vertical_accuracy": -1, 129 | "motion": ["driving","stationary"], 130 | "pauses": false, 131 | "activity": "other_navigation", 132 | "desired_accuracy": 100, 133 | "deferred": 1000, 134 | "significant_change": "disabled", 135 | "locations_in_payload": 1, 136 | "battery_state": "charging", 137 | "battery_level": 0.89, 138 | "device_id": "", 139 | "wifi": "" 140 | } 141 | } 142 | ], 143 | "current": { ... }, (optional) 144 | "trip": { ... } (optional) 145 | } 146 | ``` 147 | 148 | The properties on the `location` objects are as follows: 149 | 150 | * `timestamp` - the ISO8601 timestamp of the `CLLocation` object recorded 151 | * `altitude` - the altitude of the location in meters 152 | * `speed` - meters per second 153 | * `horizontal_accuracy` - accuracy of the position in meters 154 | * `vertical_accuracy` - accuracy of the altitude in meters 155 | * `motion` - an array of motion states detected by the motion coprocessor. Possible values are: `driving`, `walking`, `running`, `cycling`, `stationary`. A common combination is `driving` and `stationary` when the phone is resting on the dashboard of a moving car. 156 | * `battery_state` - `unknown`, `charging`, `full`, `unplugged` 157 | * `battery_level` - a value from 0 to 1 indicating the percent battery remaining. 158 | * `wifi` - If the device is connected to a wifi hotspot, the name of the SSID will be included 159 | * `device_id` - The device ID configured in the settings, or an empty string 160 | 161 | The following properties are included only if the "include tracking stats" option is selected: 162 | 163 | * `pauses` - boolean, whether the "pause updates automatically" preference is checked 164 | * `activity` - a string denoting the type of activity as indicated by the setting. Possible values are `automotive_navigation`, `fitness`, `other_navigation` and `other`. This can be set on the settings screen. 165 | * `desired_accuracy` - the requested accuracy in meters as configured on the settings screen. 166 | * `deferred` - the distance in meters to defer location updates, configured on the settings screen. 167 | * `significant_change` - a string indicating the significant change mode, `disabled`, `enabled` or `exclusive`. 168 | * `locations_in_payload` - the number of locations that were sent in the batch along with this location 169 | 170 | 171 | ### Response 172 | 173 | Your server must reply with a JSON response containing: 174 | 175 | ```json 176 | { 177 | "result": "ok" 178 | } 179 | ``` 180 | 181 | ### Current Location 182 | 183 | To be done 184 | 185 | ### Current Trip 186 | 187 | If a trip is active, an object called `trip` will be included in the request as well, with information about the current trip. This object will contain the following properties: 188 | 189 | * `distance` - current trip distance in meters as calculated by the device 190 | * `mode` - the trip mode as a string 191 | * `current_location` - a `location` record that represents the most recent location of the device 192 | * `start_location` - a `location` record that represents the location at the start of the trip 193 | * `start` - an ISO8601 timestamp representing the time the trip was started. this may be slightly different from the timestamp in the start location. 194 | 195 | ## Installation 196 | 197 | Install packages react-native , expo and our packages 198 | 199 | ``` 200 | yarn add react-native 201 | 202 | npm install -g expo-cli 203 | 204 | npm install 205 | ``` 206 | 207 | ## First step : debug version 208 | 209 | Connect your smartphone via USB, 210 | 211 | * First Method (automatically) 212 | In a first terminal 213 | 214 | `react-native start` 215 | 216 | In a second terminal 217 | 218 | `npx react-native run-android` 219 | 220 | * Second Method (manually) 221 | 222 | `cd android && ENVFILE=.env ./gradlew assembleDebug` 223 | 224 | And load the apk in your device 225 | 226 | The React Native Background Location API from Transistorsoft is free in Debug. 227 | 228 | ## Next Step : release version 229 | 230 | To build a release version 231 | 232 | * Duplicate `.env` to a new file `.env.production` 233 | * Move in android/app `cd android/app` 234 | * Generate your keystore with your password : `keytool -genkey -v -keystore my-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000` 235 | * update in `.env.production` MYAPP_RELEASE_STORE_PASSWORD and MYAPP_RELEASE_KEY_PASSWORD 236 | * MYAPP_RELEASE_API_KEY is the API key that https://www.transistorsoft.com/ provides to use their API after buying a licence 237 | * Go back in the project root 238 | * Build your release version `cd android && ENVFILE=.env.production ./gradlew assembleRelease` 239 | 240 | 241 | ## Licence 242 | 243 | Contributions from 2020 onward are copyright by Nicolas Eberlé 244 | 245 | Based on Overland iOs UI developped by Aaron Parecki 246 | 247 | Licensed under the Apache License, Version 2.0 (the "License"); 248 | you may not use this file except in compliance with the License. 249 | You may obtain a copy of the License at 250 | 251 | http://www.apache.org/licenses/LICENSE-2.0 252 | 253 | Unless required by applicable law or agreed to in writing, software 254 | distributed under the License is distributed on an "AS IS" BASIS, 255 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 256 | See the License for the specific language governing permissions and 257 | limitations under the License. 258 | -------------------------------------------------------------------------------- /Screenshots/logsView.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/Screenshots/logsView.jpg -------------------------------------------------------------------------------- /Screenshots/notificationView.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/Screenshots/notificationView.jpg -------------------------------------------------------------------------------- /Screenshots/settingsView.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/Screenshots/settingsView.jpg -------------------------------------------------------------------------------- /Screenshots/settingsView2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/Screenshots/settingsView2.jpg -------------------------------------------------------------------------------- /Screenshots/trackerView.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/Screenshots/trackerView.jpg -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.overlandandroid", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.overlandandroid", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | project.ext.react = [ 81 | enableHermes: false, // clean and rebuild if changing 82 | ] 83 | 84 | apply from: "../../node_modules/react-native/react.gradle" 85 | Project background_geolocation = project(':react-native-background-geolocation') 86 | apply from: "${background_geolocation.projectDir}/app.gradle" 87 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" 88 | apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" 89 | 90 | /** 91 | * Set this to true to create two separate APKs instead of one: 92 | * - An APK that only works on ARM devices 93 | * - An APK that only works on x86 devices 94 | * The advantage is the size of the APK is reduced by about 4MB. 95 | * Upload all the APKs to the Play Store and people will download 96 | * the correct one based on the CPU architecture of their device. 97 | */ 98 | def enableSeparateBuildPerCPUArchitecture = false 99 | 100 | /** 101 | * Run Proguard to shrink the Java bytecode in release builds. 102 | */ 103 | def enableProguardInReleaseBuilds = false 104 | 105 | /** 106 | * The preferred build flavor of JavaScriptCore. 107 | * 108 | * For example, to use the international variant, you can use: 109 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 110 | * 111 | * The international variant includes ICU i18n library and necessary data 112 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 113 | * give correct results when using with locales other than en-US. Note that 114 | * this variant is about 6MiB larger per architecture than default. 115 | */ 116 | def jscFlavor = 'org.webkit:android-jsc:+' 117 | 118 | /** 119 | * Whether to enable the Hermes VM. 120 | * 121 | * This should be set on project.ext.react and mirrored here. If it is not set 122 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 123 | * and the benefits of using Hermes will therefore be sharply reduced. 124 | */ 125 | def enableHermes = project.ext.react.get("enableHermes", false); 126 | 127 | android { 128 | compileSdkVersion rootProject.ext.compileSdkVersion 129 | 130 | def versionPropsFile = file('version.properties') 131 | 132 | if (versionPropsFile.canRead()) { 133 | def Properties versionProps = new Properties() 134 | 135 | versionProps.load(new FileInputStream(versionPropsFile)) 136 | 137 | def code = versionProps['VERSION_CODE'].toInteger() + 1 138 | 139 | versionProps['VERSION_CODE']=code.toString() 140 | versionProps.store(versionPropsFile.newWriter(), null) 141 | 142 | defaultConfig { 143 | applicationId project.env.get("MYAPP_RELEASE_NAME") 144 | manifestPlaceholders = [applicationAPIKey: project.env.get("MYAPP_RELEASE_API_KEY") ] 145 | minSdkVersion rootProject.ext.minSdkVersion 146 | targetSdkVersion rootProject.ext.targetSdkVersion 147 | versionCode code 148 | versionName "0.1" 149 | multiDexEnabled true 150 | setProperty("archivesBaseName","overlandandroid-v0." + versionCode) 151 | } 152 | 153 | } 154 | else { 155 | defaultConfig { 156 | applicationId project.env.get("MYAPP_RELEASE_NAME") 157 | manifestPlaceholders = [applicationAPIKey: project.env.get("MYAPP_RELEASE_API_KEY") ] 158 | minSdkVersion rootProject.ext.minSdkVersion 159 | targetSdkVersion rootProject.ext.targetSdkVersion 160 | versionCode 1 161 | versionName "0.1" 162 | multiDexEnabled true 163 | setProperty("archivesBaseName","overlandandroid-v0." + versionCode) 164 | } 165 | } 166 | 167 | compileOptions { 168 | sourceCompatibility JavaVersion.VERSION_1_8 169 | targetCompatibility JavaVersion.VERSION_1_8 170 | } 171 | 172 | 173 | splits { 174 | abi { 175 | reset() 176 | enable enableSeparateBuildPerCPUArchitecture 177 | universalApk false // If true, also generate a universal APK 178 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 179 | } 180 | } 181 | signingConfigs { 182 | debug { 183 | storeFile file('debug.keystore') 184 | storePassword 'android' 185 | keyAlias 'androiddebugkey' 186 | keyPassword 'android' 187 | } 188 | release { 189 | storeFile file(project.env.get("MYAPP_RELEASE_STORE_FILE")) 190 | storePassword project.env.get("MYAPP_RELEASE_STORE_PASSWORD") 191 | keyAlias project.env.get("MYAPP_RELEASE_KEY_ALIAS") 192 | keyPassword project.env.get("MYAPP_RELEASE_KEY_PASSWORD") 193 | } 194 | } 195 | buildTypes { 196 | debug { 197 | signingConfig signingConfigs.debug 198 | versionNameSuffix "-DEBUG" 199 | } 200 | release { 201 | // Caution! In production, you need to generate your own keystore file. 202 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 203 | signingConfig signingConfigs.release 204 | minifyEnabled enableProguardInReleaseBuilds 205 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 206 | versionNameSuffix "-RELEASE" 207 | } 208 | } 209 | 210 | packagingOptions { 211 | pickFirst "lib/armeabi-v7a/libc++_shared.so" 212 | pickFirst "lib/arm64-v8a/libc++_shared.so" 213 | pickFirst "lib/x86/libc++_shared.so" 214 | pickFirst "lib/x86_64/libc++_shared.so" 215 | } 216 | 217 | // applicationVariants are e.g. debug, release 218 | applicationVariants.all { variant -> 219 | variant.outputs.each { output -> 220 | // For each separate APK per architecture, set a unique version code as described here: 221 | // https://developer.android.com/studio/build/configure-apk-splits.html 222 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 223 | def abi = output.getFilter(OutputFile.ABI) 224 | if (abi != null) { // null for the universal-debug, universal-release variants 225 | output.versionCodeOverride = 226 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 227 | } 228 | 229 | } 230 | } 231 | } 232 | 233 | dependencies { 234 | implementation 'com.android.support:multidex:1.0.3' 235 | implementation fileTree(dir: "libs", include: ["*.jar"]) 236 | //noinspection GradleDynamicVersion 237 | implementation "com.facebook.react:react-native:+" // From node_modules 238 | implementation "androidx.security:security-crypto:1.0.0-rc01" 239 | 240 | implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' 241 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 242 | 243 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 244 | exclude group:'com.facebook.fbjni' 245 | } 246 | 247 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 248 | exclude group:'com.facebook.flipper' 249 | } 250 | 251 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 252 | exclude group:'com.facebook.flipper' 253 | } 254 | 255 | if (enableHermes) { 256 | def hermesPath = "../../node_modules/hermes-engine/android/"; 257 | debugImplementation files(hermesPath + "hermes-debug.aar") 258 | releaseImplementation files(hermesPath + "hermes-release.aar") 259 | } else { 260 | implementation jscFlavor 261 | } 262 | } 263 | 264 | // Run this once to be able to run the application with BUCK 265 | // puts all compile dependencies into folder libs for BUCK to use 266 | task copyDownloadableDepsToLibs(type: Copy) { 267 | from configurations.compile 268 | into 'libs' 269 | } 270 | 271 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 272 | -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/debug.keystore -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/debug/java/com/overlandandroid/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.overlandandroid; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/overlandandroid/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.overlandandroid; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "OverlandAndroid"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/overlandandroid/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.overlandandroid; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.lugg.ReactNativeConfig.ReactNativeConfigPackage; 8 | import com.facebook.react.ReactInstanceManager; 9 | import com.facebook.react.ReactNativeHost; 10 | import com.facebook.react.ReactPackage; 11 | import com.facebook.soloader.SoLoader; 12 | import java.lang.reflect.InvocationTargetException; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = 18 | new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | @SuppressWarnings("UnnecessaryLocalVariable") 27 | List packages = new PackageList(this).getPackages(); 28 | // Packages that cannot be autolinked yet can be added manually here, for example: 29 | // packages.add(new MyReactNativePackage()); 30 | return packages; 31 | } 32 | 33 | @Override 34 | protected String getJSMainModuleName() { 35 | return "index"; 36 | } 37 | }; 38 | 39 | @Override 40 | public ReactNativeHost getReactNativeHost() { 41 | return mReactNativeHost; 42 | } 43 | 44 | @Override 45 | public void onCreate() { 46 | super.onCreate(); 47 | SoLoader.init(this, /* native exopackage */ false); 48 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 49 | } 50 | 51 | /** 52 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 53 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 54 | * 55 | * @param context 56 | * @param reactInstanceManager 57 | */ 58 | private static void initializeFlipper( 59 | Context context, ReactInstanceManager reactInstanceManager) { 60 | if (BuildConfig.DEBUG) { 61 | try { 62 | /* 63 | We use reflection here to pick up the class that initializes Flipper, 64 | since Flipper library is not available in release mode 65 | */ 66 | Class aClass = Class.forName("com.overlandandroid.ReactNativeFlipper"); 67 | aClass 68 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 69 | .invoke(null, context, reactInstanceManager); 70 | } catch (ClassNotFoundException e) { 71 | e.printStackTrace(); 72 | } catch (NoSuchMethodException e) { 73 | e.printStackTrace(); 74 | } catch (IllegalAccessException e) { 75 | e.printStackTrace(); 76 | } catch (InvocationTargetException e) { 77 | e.printStackTrace(); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Overland 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/version.properties: -------------------------------------------------------------------------------- 1 | #Tue Jun 22 23:52:42 CEST 2021 2 | VERSION_CODE=100 3 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | googlePlayServicesLocationVersion = "17.0.0" 6 | buildToolsVersion = "28.0.3" 7 | minSdkVersion = 23 8 | compileSdkVersion = 29 9 | targetSdkVersion = 29 10 | appCompatVersion = "1.0.2" 11 | } 12 | repositories { 13 | google() 14 | jcenter() 15 | } 16 | dependencies { 17 | classpath("com.android.tools.build:gradle:3.5.2") 18 | 19 | // NOTE: Do not place your application dependencies here; they belong 20 | // in the individual module build.gradle files 21 | } 22 | } 23 | 24 | allprojects { 25 | repositories { 26 | mavenLocal() 27 | maven { 28 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 29 | url("$rootDir/../node_modules/react-native/android") 30 | } 31 | maven { 32 | // Android JSC is installed from npm 33 | url("$rootDir/../node_modules/jsc-android/dist") 34 | } 35 | 36 | google() 37 | jcenter() 38 | maven { url 'https://www.jitpack.io' } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.33.1 29 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'OverlandAndroid' 2 | include ':react-native-config' 3 | project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android') 4 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 5 | include ':app' 6 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OverlandAndroid", 3 | "displayName": "OverlandAndroid" 4 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /ios/OverlandAndroid-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/OverlandAndroid-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/OverlandAndroid.xcodeproj/xcshareddata/xcschemes/OverlandAndroid-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ios/OverlandAndroid.xcodeproj/xcshareddata/xcschemes/OverlandAndroid.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #if DEBUG 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | 15 | static void InitializeFlipper(UIApplication *application) { 16 | FlipperClient *client = [FlipperClient sharedClient]; 17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 20 | [client addPlugin:[FlipperKitReactPlugin new]]; 21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 22 | [client start]; 23 | } 24 | #endif 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | #if DEBUG 31 | InitializeFlipper(application); 32 | #endif 33 | 34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 36 | moduleName:@"OverlandAndroid" 37 | initialProperties:nil]; 38 | 39 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 40 | 41 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 42 | UIViewController *rootViewController = [UIViewController new]; 43 | rootViewController.view = rootView; 44 | self.window.rootViewController = rootViewController; 45 | [self.window makeKeyAndVisible]; 46 | return YES; 47 | } 48 | 49 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 50 | { 51 | #if DEBUG 52 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 53 | #else 54 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 55 | #endif 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/OverlandAndroid/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | OverlandAndroid 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ios/OverlandAndroid/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ios/OverlandAndroidTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/OverlandAndroidTests/OverlandAndroidTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface OverlandAndroidTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation OverlandAndroidTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | def add_flipper_pods! 5 | version = '~> 0.33.1' 6 | pod 'FlipperKit', version, :configuration => 'Debug' 7 | pod 'FlipperKit/FlipperKitLayoutPlugin', version, :configuration => 'Debug' 8 | pod 'FlipperKit/SKIOSNetworkPlugin', version, :configuration => 'Debug' 9 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', version, :configuration => 'Debug' 10 | pod 'FlipperKit/FlipperKitReactPlugin', version, :configuration => 'Debug' 11 | end 12 | 13 | # Post Install processing for Flipper 14 | def flipper_post_install(installer) 15 | installer.pods_project.targets.each do |target| 16 | if target.name == 'YogaKit' 17 | target.build_configurations.each do |config| 18 | config.build_settings['SWIFT_VERSION'] = '4.1' 19 | end 20 | end 21 | end 22 | end 23 | 24 | target 'OverlandAndroid' do 25 | # Pods for OverlandAndroid 26 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 27 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 28 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 29 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 30 | pod 'React', :path => '../node_modules/react-native/' 31 | pod 'React-Core', :path => '../node_modules/react-native/' 32 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 33 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 34 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 35 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 36 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 37 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 38 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 39 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 40 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 41 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 42 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 43 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 44 | 45 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 46 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 47 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 48 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 49 | pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 50 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 51 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true 52 | 53 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 54 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 55 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 56 | 57 | pod 'react-native-config', :path => '../node_modules/react-native-config' 58 | 59 | target 'OverlandAndroidTests' do 60 | inherit! :complete 61 | # Pods for testing 62 | end 63 | 64 | use_native_modules! 65 | 66 | # Enables Flipper. 67 | # 68 | # Note that if you have use_frameworks! enabled, Flipper will not work and 69 | # you should disable these next few lines. 70 | add_flipper_pods! 71 | post_install do |installer| 72 | flipper_post_install(installer) 73 | end 74 | end 75 | 76 | target 'OverlandAndroid-tvOS' do 77 | # Pods for OverlandAndroid-tvOS 78 | 79 | target 'OverlandAndroid-tvOSTests' do 80 | inherit! :search_paths 81 | # Pods for testing 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OverlandAndroid", 3 | "version": "1.0.4", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint .", 11 | "clean": "react-native-clean-project" 12 | }, 13 | "dependencies": { 14 | "@fortawesome/fontawesome-svg-core": "^1.2.27", 15 | "@fortawesome/free-regular-svg-icons": "^5.12.1", 16 | "@fortawesome/free-solid-svg-icons": "^5.12.1", 17 | "@fortawesome/react-native-fontawesome": "^0.2.2", 18 | "@react-native-community/async-storage": "^1.8.1", 19 | "@react-native-community/geolocation": "^2.0.2", 20 | "@react-native-community/netinfo": "^5.6.2", 21 | "@react-native-community/slider": "^2.0.8", 22 | "@react-navigation/bottom-tabs": "^5.1.1", 23 | "@react-navigation/native": "^5.0.9", 24 | "axios": "^0.19.2", 25 | "geolib": "^3.2.1", 26 | "native-base": "^2.13.12", 27 | "react": "16.11.0", 28 | "react-native": "0.62.0", 29 | "react-native-background-fetch": "^3.0.4", 30 | "react-native-background-geolocation": "^3.4.2", 31 | "react-native-config": "^1.0.0", 32 | "react-native-dialog": "^5.6.0", 33 | "react-native-eject": "^0.1.2", 34 | "react-native-elements": "^1.2.7", 35 | "react-native-gesture-handler": "^1.6.0", 36 | "react-native-modalbox": "^2.0.0", 37 | "react-native-reanimated": "^1.7.0", 38 | "react-native-safe-area-context": "^0.7.3", 39 | "react-native-screens": "^2.2.0", 40 | "react-native-svg": "^11.0.1", 41 | "react-native-vector-icons": "^6.6.0" 42 | }, 43 | "devDependencies": { 44 | "@babel/core": "^7.9.0", 45 | "@babel/runtime": "^7.9.2", 46 | "@react-native-community/eslint-config": "^0.0.7", 47 | "babel-jest": "^25.2.1", 48 | "eslint": "^6.8.0", 49 | "eslint-config-airbnb": "^18.0.1", 50 | "eslint-config-prettier": "^6.10.0", 51 | "jest": "^25.2.1", 52 | "metro-react-native-babel-preset": "0.56.4", 53 | "prettier": "^1.19.1", 54 | "react-native-clean-project": "^3.3.0", 55 | "react-test-renderer": "16.9.0" 56 | }, 57 | "jest": { 58 | "preset": "react-native" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /privacy_policy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Privacy Policy

4 |

The Center for Research & Interdisciplinarity (CRI) (8bis Rue Charles V 75004 Paris, France) built the Overland app as an open sourceapp. This SERVICE is provided by CRI at no cost and is intended 5 | for use as is.

6 |

This page is used to inform website visitors regarding our policies with the collection, use, and 7 | disclosure of Personal Information if anyone decided to use our Service.

8 |

If you choose to use our Service, then you agree to the collection and use of information in 9 | relation with this policy. The Personal Information that we collect are used for providing and 10 | improving the Service. We will not use or share your information with anyone except as described 11 | in this Privacy Policy.

12 |

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, 13 | which is accessible at Overland, unless otherwise defined in this Privacy Policy.

14 | 15 |

Information Collection and Use

16 |

For a better experience while using our Service, we may require you to provide us with certain 17 | personally identifiable information, limited to your location. 18 | The information that we request is retained on your device and is not 19 | collected by us in any way.

20 |

The app does use not third party services that could collect information used to identify you. 21 | 22 |

Log Data

23 |

We want to inform you that our Service does not collect any data or information called Log Data (e.g. your devices’s Internet Protocol (“IP”) address, device name, 24 | operating system version, configuration of the app when utilising our Service, the time and date of your use of the Service, and other statistics.

25 | 26 |

Cookies

27 |

Cookies are files with small amount of data that is commonly used an anonymous unique identifier. 28 | These are sent to your browser from the website that you visit and are stored on your devices’s 29 | internal memory.

30 |

This Services does not uses these “cookies” explicitly. However, the app may use third party code 31 | and libraries that use “cookies” to collection information and to improve their services.

32 | 33 |

Security

34 |

We value your trust in providing us your Personal Information, thus we are striving to use 35 | commercially acceptable means of protecting it. But remember that no method of transmission over 36 | the internet, or method of electronic storage is 100% secure and reliable, and we cannot 37 | guarantee its absolute security.

38 | 39 |

Links to Other Sites

40 |

This Service may contain links to other sites. If you click on a third-party link, you will be 41 | directed to that site. Note that these external sites are not operated by us. Therefore, I 42 | strongly advise you to review the Privacy Policy of these websites. I have no control over, and 43 | assume no responsibility for the content, privacy policies, or practices of any third-party 44 | sites or services.

45 | 46 |

Children’s Privacy

47 |

This Services do not address anyone under the age of 13. We do not knowingly collect personal 48 | identifiable information from children under 13. In the case we discover that a child under 13 49 | has provided us with personal information, we immediately delete this from our servers. If you 50 | are a parent or guardian and you are aware that your child has provided us with personal 51 | information, please contact us so that we will be able to do necessary actions.

52 | 53 |

Changes to This Privacy Policy

54 |

We may update our Privacy Policy from time to time. Thus, you are advised to review this page 55 | periodically for any changes. We will notify you of any changes by posting the new Privacy Policy 56 | on this page. These changes are effective immediately, after they are posted on this page.

57 | 58 |

Contact Us

59 |

If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact 60 | us via email at support@openhumans.org or via post to Center for Research & Interdisciplinarity, 8bis Rue Charles V 75004 Paris, France.

61 |

This Privacy Policy page was created at privacypolicytemplate.net.

63 | 64 | 65 | -------------------------------------------------------------------------------- /privacy_policy.md: -------------------------------------------------------------------------------- 1 | Overland is a free & open source app to collect geolocation data that is developed at the Center for Research & Interdisciplinarity (CRI) that is based at 8bis Rue Charles V 75004 Paris, France. 2 | 3 | Overland allows you to collect your own geolocation data in regular intervals and stores these data privately on your phone. Through the Overland settings you can choose how often and how accurately your location data will be collected. By default your geolocation data will not be transmitted off your phone to any external services and CRI is not using, collecting, or selling your private geo location data. 4 | 5 | Overland gives you to option to setup an endpoint of your choice to which you can your private geo-location data can be transmitted in regular intervals. A variety of these services exist for either self-hosting or through third party providers. If you make use of such a service the privacy policies of those third parties apply to your data. 6 | -------------------------------------------------------------------------------- /src/assets/.blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/src/assets/.blank -------------------------------------------------------------------------------- /src/components/.blank: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHumans/Overland_android/26bf721b8cdfeda89ea66f361b1b782311378f07/src/components/.blank -------------------------------------------------------------------------------- /src/components/app-navigation/components/tab-icon/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {StyleSheet} from 'react-native'; 3 | import { library } from '@fortawesome/fontawesome-svg-core'; 4 | import { fas } from '@fortawesome/free-solid-svg-icons'; 5 | import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'; 6 | 7 | library.add(fas); 8 | 9 | const TabIcon = ({ ...others }) => { 10 | return ; 11 | }; 12 | 13 | export default TabIcon; 14 | -------------------------------------------------------------------------------- /src/components/app-navigation/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; 3 | import TabIcon from './components/tab-icon'; 4 | import Tracker from '../../scenes/tracker'; 5 | import Settings from '../../scenes/settings'; 6 | import Logs from '../../scenes/logs'; 7 | 8 | const Tab = createBottomTabNavigator(); 9 | 10 | 11 | 12 | const AppNavigation = () => { 13 | return ( 14 | 15 | ( 20 | 21 | 22 | ), 23 | }} 24 | /> 25 | ( 30 | 31 | ), 32 | }} 33 | /> 34 | ( 39 | 40 | ), 41 | }} 42 | /> 43 | 44 | ); 45 | }; 46 | 47 | export default AppNavigation; 48 | -------------------------------------------------------------------------------- /src/components/container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View } from 'react-native'; 3 | 4 | const Container = props => { 5 | return {props.children}; 6 | }; 7 | 8 | export default Container; 9 | -------------------------------------------------------------------------------- /src/scenes/logs/index.js: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import { StyleSheet, InteractionManager, Alert, View, FlatList , YellowBox} from 'react-native'; 3 | import { 4 | Container, 5 | Header, 6 | Title, 7 | Content, 8 | Footer, 9 | FooterTab, 10 | Left, 11 | Body, 12 | Right, 13 | List, 14 | ListItem, 15 | Text, 16 | Button, 17 | Icon, 18 | Spinner 19 | } from 'native-base'; 20 | import BackgroundGeolocation from "react-native-background-geolocation"; 21 | 22 | YellowBox.ignoreWarnings([ 23 | 'VirtualizedLists should never be nested', // TODO: Remove when fixed 24 | ]) 25 | 26 | 27 | const styles = StyleSheet.create({ 28 | iconStyle: { 29 | color: '#0A69FE' 30 | } 31 | }); 32 | 33 | const LogItem = ({ 34 | id, 35 | geometry, 36 | properties 37 | }) => { 38 | 39 | return ( 40 | 41 | {id} 42 | 43 | 44 | {`lat: ${geometry.coordinates[0]}`} 45 | {`long: ${geometry.coordinates[1]}`} 46 | {`time: ${properties.timestamp}`} 47 | 48 | 49 | 50 | 51 | ); 52 | }; 53 | 54 | class AllLocationsScene extends PureComponent { 55 | static navigationOptions = { 56 | title: 'All Locations', 57 | header: null, 58 | }; 59 | 60 | constructor(props) { 61 | super(props); 62 | this.state = {locations: null, selectedLocationId: -1, isReady: false }; 63 | this.refresh = this.refresh.bind(this); 64 | } 65 | 66 | componentDidMount() { 67 | InteractionManager.runAfterInteractions(() => { 68 | this.refresh(); 69 | }); 70 | } 71 | 72 | async refresh() { 73 | this.setState({ selectedLocationId: -1, isReady: false }); 74 | let locations = await BackgroundGeolocation.getLocations(); 75 | console.log(locations) 76 | this.setState({locations, isReady: true }); 77 | } 78 | delete() { 79 | 80 | Alert.alert( 81 | 'Delete all data ?', 82 | '', 83 | [ 84 | {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, 85 | {text: 'Yes', onPress:async () => { 86 | await BackgroundGeolocation.destroyLocations().then(()=>this.refresh()); 87 | 88 | } 89 | }, 90 | ], 91 | { cancelable: false } 92 | ) 93 | } 94 | 95 | _keyExtractor = (item, index) => item.id=index+1; 96 | _getItemLayout = (data, index) => ({length: data.length, offset: data.length * index, index}); 97 | 98 | render() { 99 | const { locations, isReady } = this.state; 100 | return ( 101 | 102 |
103 | 104 | 107 | 108 | 109 | All Locations 110 | 111 | 112 | 115 | 118 | 119 |
120 | 121 | {( () => { 122 | if (!isReady) { 123 | return ; 124 | } 125 | return ( 126 | { 131 | const date = item.timestamp; 132 | return ( 133 | 136 | ); 137 | }} 138 | /> 139 | ); 140 | } ) ()} 141 | 142 |
143 | ); 144 | } 145 | } 146 | 147 | export default AllLocationsScene; 148 | -------------------------------------------------------------------------------- /src/scenes/settings/components/activity-type/components/activity-type-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const ActivityTypeContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default ActivityTypeContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/activity-type/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import ActivityTypeContainer from './components/activity-type-container' 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | 7 | var {Platform} = React; 8 | 9 | class ActivityType extends React.Component { 10 | 11 | constructor (props) { 12 | super(props) 13 | this.buttons = ['Auto', 'Fitness', 'Automotive', 'Other Nav'] 14 | this.state = { 15 | selectedIndex: 0 16 | } 17 | this.disabledButtonGroup = (Platform.OS === 'ios') ? false : true; 18 | this.updateIndex = this.updateIndex.bind(this) 19 | } 20 | 21 | convActivityToIndex(activity) { 22 | let current_index = 0; 23 | switch(activity) { 24 | case BackgroundGeolocation.ACTIVITY_TYPE_OTHER: 25 | // Other 26 | current_index = 0; 27 | break; 28 | case BackgroundGeolocation.ACTIVITY_TYPE_FITNESS: 29 | // Fitness 30 | current_index = 1; 31 | break; 32 | case BackgroundGeolocation.ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION: 33 | // Automotive 34 | current_index = 2; 35 | break; 36 | case BackgroundGeolocation.ACTIVITY_TYPE_OTHER_NAVIGATION: 37 | // Automotive 38 | current_index = 3; 39 | break; 40 | default: 41 | current_index = 0; 42 | // other 43 | } 44 | return current_index; 45 | } 46 | 47 | updateIndex (selectedIndex) { 48 | let current_activity = BackgroundGeolocation.ACTIVITY_TYPE_OTHER; 49 | switch(selectedIndex) { 50 | case 0: 51 | // Other 52 | current_activity = BackgroundGeolocation.ACTIVITY_TYPE_OTHER; 53 | break; 54 | case 1: 55 | // Fitness 56 | current_activity = BackgroundGeolocation.ACTIVITY_TYPE_FITNESS; 57 | break; 58 | case 2: 59 | // Automotive 60 | current_activity = BackgroundGeolocation.ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION; 61 | break; 62 | case 3: 63 | // Automotive 64 | current_activity = BackgroundGeolocation.ACTIVITY_TYPE_OTHER_NAVIGATION; 65 | break; 66 | default: 67 | current_activity = BackgroundGeolocation.ACTIVITY_TYPE_OTHER; 68 | // other 69 | } 70 | BackgroundGeolocation.setConfig({ 71 | activityType: current_activity 72 | }); 73 | 74 | this.setState({selectedIndex}) 75 | 76 | } 77 | 78 | render() { 79 | 80 | const { selectedIndex } = this.state 81 | 82 | return ( 83 | 84 | Activity Type 85 | 92 | 93 | ); 94 | } 95 | } 96 | 97 | export default ActivityType; 98 | -------------------------------------------------------------------------------- /src/scenes/settings/components/defer-location-updates/components/defer-location-updates-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const DeferLocUpdatesContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default DeferLocUpdatesContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/defer-location-updates/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import DeferLocUpdatesContainer from './components/defer-location-updates-container'; 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class DeferLocUpdates extends React.Component { 9 | 10 | constructor (props) { 11 | super(props) 12 | let _index = this.convDeferTimeToIndex(this.props.deferTime) 13 | this.state = { 14 | selectedIndex: _index 15 | } 16 | this.updateIndex = this.updateIndex.bind(this) 17 | } 18 | 19 | updateIndex (selectedIndex) { 20 | let _deferTime; 21 | this.setState({selectedIndex}) 22 | switch (selectedIndex) { 23 | case 0: 24 | _deferTime = 0; 25 | break; 26 | case 1: 27 | _deferTime = 60000; 28 | break; 29 | case 2: 30 | _deferTime = 300000; 31 | break; 32 | case 3: 33 | _deferTime = 3000000; 34 | break; 35 | case 4: 36 | _deferTime = 6000000; 37 | break; 38 | default: 39 | _deferTime = 0; 40 | } 41 | BackgroundGeolocation.ready({ 42 | deferTime: _deferTime 43 | },()=>{ 44 | this.updateLocationTemplate() 45 | }); 46 | storeData({name:"@deferTime",value:String(_deferTime)}) 47 | } 48 | 49 | updateLocationTemplate(){ 50 | BackgroundGeolocation.ready({}, (state) => { 51 | let _templateSignificantChangesOnly = state.useSignificantChangesOnly; 52 | let _deferTime = state.deferTime; 53 | let _deviceIdSync = state.device_id; 54 | let _desiredAccuracy = Number(state.desiredAccuracy)<0?0:Number(state.desiredAccuracy); 55 | let _wifiInfo = global.wifiInfo.ssid; 56 | if(!_wifiInfo) _wifiInfo = ""; 57 | let _template = '{\ 58 | "type": "Feature", \ 59 | "geometry": { \ 60 | "type": "Point", \ 61 | "coordinates": [ <%=longitude%>, <%=latitude%> ] },\ 62 | "properties": { \ 63 | "timestamp": "<%= timestamp %>", \ 64 | "battery_level": <%=battery.level%>, \ 65 | "speed": <%=speed%>, \ 66 | "altitude": <%=altitude%>,\ 67 | "horizontal_accuracy": <%=accuracy%>,\ 68 | "vertical_accuracy": <%=altitude_accuracy%>,\ 69 | "significant_change": \"'+_templateSignificantChangesOnly+'\" ,\ 70 | "locations_in_payload": 1,\ 71 | "battery_state": <%=battery.is_charging%>,\ 72 | "device_id": \"'+ _deviceIdSync +'\" ,\ 73 | "wifi": \"'+ _wifiInfo +'\" ,\ 74 | "deferred": \"'+_deferTime+'\",\ 75 | "desired_accuracy": \"'+ _desiredAccuracy +'\",\ 76 | "activity": "other",\ 77 | "pauses": <%=is_moving%>,\ 78 | "motion": ["<%=activity.type%>"]\ 79 | }\ 80 | }'; 81 | BackgroundGeolocation.setConfig({locationTemplate:_template}) 82 | }) 83 | }; 84 | 85 | convDeferTimeToIndex(time){ 86 | let _index; 87 | switch (time) { 88 | case 0: 89 | _index = 0; 90 | break; 91 | case 60000: 92 | _index = 1; 93 | break; 94 | case 300000: 95 | _index = 2; 96 | break; 97 | case 3000000: 98 | _index = 3; 99 | break; 100 | case 6000000: 101 | _index = 4; 102 | break; 103 | default: 104 | _index = 0; 105 | } 106 | return _index; 107 | } 108 | 109 | render() { 110 | const buttons = ['Never', '1 min', '5 min', '10 min', '20 min'] 111 | const { selectedIndex } = this.state 112 | 113 | return ( 114 | 115 | Defer Location Updates 116 | 122 | 123 | ); 124 | } 125 | } 126 | 127 | export default DeferLocUpdates; 128 | -------------------------------------------------------------------------------- /src/scenes/settings/components/desired-accuracy/components/desired-accuracy-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const DesiredAccuracyContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default DesiredAccuracyContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/desired-accuracy/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import DesiredAccuracyContainer from './components/desired-accuracy-container'; 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class DesiredAccuracy extends React.Component { 9 | 10 | constructor (props) { 11 | super(props) 12 | console.log("DesiredAccuracy::constructor::",this.props.desiredAccuracy) 13 | this.buttons = ['Nav', 'Best', '10m', '100m', '1km', '3km'] 14 | const _index = this.convBGIndexToUIIndex(this.props.desiredAccuracy); 15 | this.state = { 16 | selectedIndex: _index 17 | } 18 | this.updateIndex = this.updateIndex.bind(this) 19 | } 20 | 21 | convBGIndexToUIIndex(bgIndex) { 22 | let _index; 23 | switch (bgIndex) { 24 | case -2: 25 | _index = 0; 26 | break; 27 | case -1: 28 | _index = 1; 29 | break; 30 | case 10: 31 | _index = 2; 32 | break; 33 | case 100: 34 | _index = 3; 35 | break; 36 | case 1000: 37 | _index = 4; 38 | break; 39 | case 3000: 40 | _index = 5; 41 | break; 42 | default: 43 | _index = 1; 44 | } 45 | return _index; 46 | } 47 | 48 | updateIndex (selectedIndex) { 49 | 50 | let selectedAccuracy; 51 | switch (selectedIndex) { 52 | case 0: 53 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION; 54 | break; 55 | case 1: 56 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_HIGH; 57 | break; 58 | case 2: 59 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_MEDIUM; 60 | break; 61 | case 3: 62 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_LOW; 63 | break; 64 | case 4: 65 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_VERY_LOW; 66 | break; 67 | case 5: 68 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_LOWEST; 69 | break; 70 | default: 71 | selectedAccuracy = BackgroundGeolocation.DESIRED_ACCURACY_HIGH; 72 | } 73 | BackgroundGeolocation.ready({ 74 | desiredAccuracy: selectedAccuracy 75 | },()=>{this.updateLocationTemplate()}); 76 | this.setState({selectedIndex}) 77 | storeData({name:"@desiredAccuracy",value:String(selectedAccuracy)}) 78 | } 79 | 80 | updateLocationTemplate(){ 81 | BackgroundGeolocation.ready({}, (state) => { 82 | let _templateSignificantChangesOnly = state.useSignificantChangesOnly; 83 | let _deferTime = state.deferTime 84 | let _deviceIdSync = state.device_id 85 | let _desiredAccuracy = Number(state.desiredAccuracy)<0?0:Number(state.desiredAccuracy); 86 | let _wifiInfo = global.wifiInfo.ssid; 87 | if(!_wifiInfo) _wifiInfo = ""; 88 | let _template = '{\ 89 | "type": "Feature", \ 90 | "geometry": { \ 91 | "type": "Point", \ 92 | "coordinates": [ <%=longitude%>, <%=latitude%> ] },\ 93 | "properties": { \ 94 | "timestamp": "<%= timestamp %>", \ 95 | "battery_level": <%=battery.level%>, \ 96 | "speed": <%=speed%>, \ 97 | "altitude": <%=altitude%>,\ 98 | "horizontal_accuracy": <%=accuracy%>,\ 99 | "vertical_accuracy": <%=altitude_accuracy%>,\ 100 | "significant_change": \"'+_templateSignificantChangesOnly+'\" ,\ 101 | "locations_in_payload": 1,\ 102 | "battery_state": <%=battery.is_charging%>,\ 103 | "device_id": \"'+ _deviceIdSync +'\" ,\ 104 | "wifi": \"'+ _wifiInfo +'\" ,\ 105 | "deferred": \"'+_deferTime+'\",\ 106 | "desired_accuracy": \"'+ _desiredAccuracy +'\",\ 107 | "activity": "other",\ 108 | "pauses": <%=is_moving%>,\ 109 | "motion": ["<%=activity.type%>"]\ 110 | }\ 111 | }'; 112 | BackgroundGeolocation.setConfig({locationTemplate:_template}) 113 | }) 114 | }; 115 | 116 | convAccuracyToIndex(nb) { 117 | return this.buttons.indexOf(nb); 118 | } 119 | 120 | render() { 121 | const { selectedIndex } = this.state 122 | 123 | return ( 124 | 125 | Desired Accuracy 126 | 132 | 133 | ); 134 | } 135 | } 136 | 137 | export default DesiredAccuracy; 138 | -------------------------------------------------------------------------------- /src/scenes/settings/components/notifications-switch/components/notif-switch-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const NotifSwitchContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingTop: 10, 12 | marginLeft: 10, 13 | paddingRight: 30, 14 | flexDirection: 'row', 15 | justifyContent: 'space-between', 16 | width: "100%" 17 | }, 18 | }); 19 | 20 | export default NotifSwitchContainer; 21 | -------------------------------------------------------------------------------- /src/scenes/settings/components/notifications-switch/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { Switch } from 'react-native-gesture-handler'; 4 | import NotifSwitchContainer from './components/notif-switch-container'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class NotificationsSwitch extends React.Component { 9 | constructor(props) { 10 | super(props); 11 | this.state = { 12 | toggleSwitch: false, 13 | }; 14 | this.onSwitchValueChange = this.onSwitchValueChange.bind(this); 15 | } 16 | componentDidMount(){ 17 | BackgroundGeolocation.ready({}, (state) => { 18 | this.onSwitchValueChange(state.debug) 19 | }); 20 | } 21 | 22 | onSwitchValueChange(e) { 23 | this.setState({ 24 | toggleSwitch: e, 25 | }); 26 | BackgroundGeolocation.setConfig({debug:e}); 27 | storeData({name:"@debugNotification",value:e==true?'True':'False'}) 28 | 29 | } 30 | 31 | render() { 32 | const { toggleSwitch } = this.state; 33 | return ( 34 | 35 | Enable audio notifications 36 | 37 | 38 | ); 39 | } 40 | } 41 | 42 | 43 | export default NotificationsSwitch; 44 | -------------------------------------------------------------------------------- /src/scenes/settings/components/point-per-batch/components/point-per-batch-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const PtsPerBatchContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default PtsPerBatchContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/point-per-batch/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import PtsPerBatchContainer from './components/point-per-batch-container'; 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class PointPerBatch extends React.Component { 9 | 10 | constructor (props) { 11 | super(props) 12 | this.buttons = ['50', '100', '200', '500', '1000']; 13 | const _index = this.convNbToIndex(String(this.props.ptsPerBatch)); 14 | this.state = { 15 | selectedIndex: _index 16 | }; 17 | this.updatePtPerBatch = this.updatePtPerBatch.bind(this); 18 | } 19 | async componentDidMount(){ 20 | 21 | } 22 | convNbToIndex(nb) { 23 | if (__DEV__) { 24 | console.log("convNbToIndex :: ", nb, this.buttons.indexOf(nb)) 25 | } 26 | return this.buttons.indexOf(nb); 27 | } 28 | 29 | updatePtPerBatch (selectedIndex) { 30 | BackgroundGeolocation.setConfig({ 31 | autoSyncThreshold: Number(this.buttons[selectedIndex]) 32 | }); 33 | if (__DEV__) { 34 | console.log("PTS PER BATCH ===>",this.buttons[selectedIndex]) 35 | } 36 | this.setState({selectedIndex}) 37 | storeData({name:"@autoSyncThreshold",value:this.buttons[selectedIndex]}) 38 | } 39 | 40 | render() { 41 | const { selectedIndex } = this.state 42 | 43 | return ( 44 | 45 | Point per Batch 46 | 52 | 53 | ); 54 | } 55 | } 56 | 57 | export default PointPerBatch; 58 | -------------------------------------------------------------------------------- /src/scenes/settings/components/receiver-endpoint/components/receiver-endpoint-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const ReceiverEndpointContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingTop: 10, 12 | marginLeft: 10, 13 | paddingRight: 30, 14 | flexDirection: 'column', 15 | justifyContent: 'space-between', 16 | width: "100%" 17 | }, 18 | }); 19 | 20 | export default ReceiverEndpointContainer; 21 | -------------------------------------------------------------------------------- /src/scenes/settings/components/receiver-endpoint/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, View , TextInput, Button, StyleSheet, TouchableOpacity} from 'react-native'; 3 | import ReceiverEndpointContainer from './components/receiver-endpoint-container'; 4 | import BackgroundGeolocation from 'react-native-background-geolocation'; 5 | import {storeData} from '../../../../utils/store'; 6 | import Dialog from "react-native-dialog"; 7 | 8 | class ReceiverEndpoint extends React.Component { 9 | constructor(props) { 10 | super(props); 11 | this.state = {url: this.props.url,device_id: this.props.id,dialogVisible: false}; 12 | } 13 | 14 | componentDidMount() { 15 | this.setState({url: this.props.url}); 16 | this.setState({device_id: this.props.id}); 17 | } 18 | 19 | showDialog = () => { 20 | this.setState({ dialogVisible: true }); 21 | }; 22 | 23 | handleCancel = () => { 24 | this.setState({ dialogVisible: false }); 25 | }; 26 | 27 | handleSave = () => { 28 | // The user has pressed the "Delete" button, so here you can do your own logic. 29 | // ...Your logic 30 | this.setState({ dialogVisible: false }); 31 | BackgroundGeolocation.setConfig({ 32 | url: this.state.url 33 | }); 34 | storeData({name:"@url",value:this.state.url}) 35 | storeData({name:"@device_id",value:this.state.device_id}) 36 | }; 37 | 38 | render() { 39 | return ( 40 | 41 | 42 | 44 | Set Receiver Endpoint (& device ID) 45 | 46 | This app can send its location data to a server of your choosing. Either a URL above and the app will send its data here. 47 | 48 | 49 | 50 | Server URL endpoint (required) 51 | 52 | 53 | this.setState({url: text})} 56 | value={this.state.url} 57 | /> 58 | 59 | 60 | 61 | 62 | Device ID (not mandatory) 63 | 64 | this.setState({device_id: text})} 67 | value={this.state.device_id} 68 | /> 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Receiver Endpoint (& Device ID) 77 | 78 | 83 | 84 | 85 | Edit 86 | 87 | 88 | 89 | 90 | ); 91 | } 92 | } 93 | 94 | 95 | export default ReceiverEndpoint; 96 | 97 | const styles = { 98 | textStyle: { 99 | alignSelf: 'center', 100 | color: '#fff', 101 | fontSize: 16, 102 | paddingTop: 10 103 | }, 104 | buttonStyle: { 105 | flex:1, 106 | backgroundColor: '#1f8adc', 107 | paddingLeft:20, 108 | paddingRight: 20, 109 | alignItems: 'center' , 110 | height: 48, 111 | width: 48 112 | } 113 | }; 114 | 115 | const theme = { 116 | colors: { 117 | primary: 'blue', 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/scenes/settings/components/resume-geofence/components/resume-geofence-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const ResumeGeofenceContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default ResumeGeofenceContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/resume-geofence/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import ResumeGeofenceContainer from './components/resume-geofence-container'; 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class ResumeGeofence extends React.Component { 9 | 10 | constructor (props) { 11 | super(props) 12 | this.buttons = ['Off', '100m', '200m', '500m', '1km', '2km']; 13 | let _index = this.convRadiusToIndex(this.props.geofenceProximityRadius) 14 | console.log("ResumeGeofence::",_index); 15 | if(!_index) _index=0; 16 | this.state = { 17 | selectedIndex: _index 18 | } 19 | this.updateIndex = this.updateIndex.bind(this) 20 | } 21 | convRadiusToIndex(radius){ 22 | switch (radius) { 23 | case '100': 24 | this.setState({selectedIndex:1}); 25 | break; 26 | case '200': 27 | this.setState({selectedIndex:2}); 28 | break; 29 | case '500': 30 | this.setState({selectedIndex:3}); 31 | break; 32 | case '1000': 33 | this.setState({selectedIndex:4}); 34 | break; 35 | case '2000': 36 | this.setState({selectedIndex:5}); 37 | break; 38 | default: 39 | this.setState({selectedIndex:0}); 40 | } 41 | } 42 | updateIndex (selectedIndex) { 43 | let _geofenceProximityRadius=1000; 44 | switch (selectedIndex) { 45 | case 1: 46 | _geofenceProximityRadius = '100'; 47 | BackgroundGeolocation.setConfig({geofenceProximityRadius:100}); 48 | break; 49 | case 2: 50 | _geofenceProximityRadius = '200'; 51 | BackgroundGeolocation.setConfig({geofenceProximityRadius:200}); 52 | break; 53 | case 3: 54 | _geofenceProximityRadius = '500'; 55 | BackgroundGeolocation.setConfig({geofenceProximityRadius:500}); 56 | break; 57 | case 4: 58 | _geofenceProximityRadius = '1000'; 59 | BackgroundGeolocation.setConfig({geofenceProximityRadius:1000}); 60 | break; 61 | case 5: 62 | _geofenceProximityRadius = '1000'; 63 | BackgroundGeolocation.setConfig({geofenceProximityRadius:2000}); 64 | break; 65 | default: 66 | _geofenceProximityRadius = 'off'; 67 | BackgroundGeolocation.setConfig({geofenceProximityRadius:1000}); 68 | 69 | } 70 | 71 | this.setState({selectedIndex}) 72 | storeData({name:"@geofenceProximityRadius",value:_geofenceProximityRadius}) 73 | } 74 | 75 | 76 | render() { 77 | 78 | const { selectedIndex } = this.state 79 | 80 | return ( 81 | 82 | Resume with Geofence 83 | 89 | 90 | ); 91 | } 92 | } 93 | 94 | export default ResumeGeofence; 95 | -------------------------------------------------------------------------------- /src/scenes/settings/components/settings-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../components/container'; 4 | 5 | const SettingsContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | flex: 1, 12 | flexDirection: 'column', 13 | alignItems: 'center', 14 | justifyContent: 'flex-start' 15 | }, 16 | }); 17 | 18 | export default SettingsContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/significant-location/components/significant-location-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const SignificantLocationContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | marginTop:10, 12 | marginLeft:20, 13 | marginRight:10, 14 | width:"100%" 15 | }, 16 | }); 17 | 18 | export default SignificantLocationContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/settings/components/significant-location/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, View } from 'react-native'; 3 | import SignificantLocationContainer from './components/significant-location-container' 4 | import { ButtonGroup } from 'react-native-elements'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class SignificantLocation extends React.Component { 9 | 10 | constructor (props) { 11 | super(props) 12 | this.state = { 13 | selectedIndex: this.props.useSignificantChangesOnly?1:0 14 | } 15 | this.updateIndex = this.updateIndex.bind(this) 16 | } 17 | 18 | updateIndex (selectedIndex) { 19 | let _useSignificantChangesOnly = false; 20 | if(selectedIndex==0){ 21 | _useSignificantChangesOnly = false; 22 | }else{ 23 | _useSignificantChangesOnly = true; 24 | } 25 | let templateSignificantChangesOnly = _useSignificantChangesOnly ==='True' ? "enabled":"disabled"; 26 | this.setState({selectedIndex}) 27 | BackgroundGeolocation.ready({ 28 | useSignificantChangesOnly:_useSignificantChangesOnly 29 | },()=>{this.updateLocationTemplate()}); 30 | storeData({name:"@useSignificantChangesOnly",value:_useSignificantChangesOnly?'True':'False'}) 31 | } 32 | 33 | updateLocationTemplate(){ 34 | BackgroundGeolocation.ready({}, (state) => { 35 | let _templateSignificantChangesOnly = state.useSignificantChangesOnly; 36 | let _deferTime = state.deferTime; 37 | let _deviceIdSync = state.device_id; 38 | let _desiredAccuracy = Number(state.desiredAccuracy)<0?0:Number(state.desiredAccuracy); 39 | let _wifiInfo = global.wifiInfo.ssid; 40 | if(!_wifiInfo) _wifiInfo = ""; 41 | let _template = '{\ 42 | "type": "Feature", \ 43 | "geometry": { \ 44 | "type": "Point", \ 45 | "coordinates": [ <%=longitude%>, <%=latitude%> ] },\ 46 | "properties": { \ 47 | "timestamp": "<%= timestamp %>", \ 48 | "battery_level": <%=battery.level%>, \ 49 | "speed": <%=speed%>, \ 50 | "altitude": <%=altitude%>,\ 51 | "horizontal_accuracy": <%=accuracy%>,\ 52 | "vertical_accuracy": <%=altitude_accuracy%>,\ 53 | "significant_change": \"'+_templateSignificantChangesOnly+'\" ,\ 54 | "locations_in_payload": 1,\ 55 | "battery_state": <%=battery.is_charging%>,\ 56 | "device_id": \"'+ _deviceIdSync +'\" ,\ 57 | "wifi": \"'+ _wifiInfo +'\" ,\ 58 | "deferred": \"'+_deferTime+'\",\ 59 | "desired_accuracy": \"'+ _desiredAccuracy +'\",\ 60 | "activity": "other",\ 61 | "pauses": <%=is_moving%>,\ 62 | "motion": ["<%=activity.type%>"]\ 63 | }\ 64 | }'; 65 | BackgroundGeolocation.setConfig({locationTemplate:_template}) 66 | }) 67 | }; 68 | 69 | render() { 70 | const buttons = ['Disabled', 'Enabled'] 71 | const { selectedIndex } = this.state 72 | 73 | return ( 74 | 75 | Significant Location 76 | 82 | 83 | ); 84 | } 85 | } 86 | 87 | export default SignificantLocation; 88 | -------------------------------------------------------------------------------- /src/scenes/settings/components/update-switch/components/update-switch-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const UpdateSwitchContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingTop: 10, 12 | marginLeft: 10, 13 | paddingRight: 30, 14 | flexDirection: 'row', 15 | justifyContent: 'space-between', 16 | width: "100%" 17 | }, 18 | }); 19 | 20 | export default UpdateSwitchContainer; 21 | -------------------------------------------------------------------------------- /src/scenes/settings/components/update-switch/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { Switch } from 'react-native-gesture-handler'; 4 | import UpdateSwitchContainer from './components/update-switch-container'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData} from '../../../../utils/store'; 7 | 8 | class UpdateSwitch extends React.Component { 9 | constructor(props) { 10 | super(props); 11 | this.state = { 12 | stopOnStationary: this.props.stopOnStationary, 13 | }; 14 | this.onSwitchValueChange = this.onSwitchValueChange.bind(this); 15 | } 16 | 17 | onSwitchValueChange(e) { 18 | this.setState({ 19 | stopOnStationary: e, 20 | }); 21 | BackgroundGeolocation.setConfig({ 22 | stopOnStationary: e 23 | }); 24 | let s_stopOnStationary = e ? 'True':'False'; 25 | storeData({name:"@stopOnStationary",value:s_stopOnStationary}) 26 | 27 | } 28 | 29 | render() { 30 | const { stopOnStationary } = this.state; 31 | return ( 32 | 33 | Stop Tracking Automatically 34 | 36 | 37 | ); 38 | } 39 | } 40 | 41 | 42 | export default UpdateSwitch; 43 | -------------------------------------------------------------------------------- /src/scenes/settings/index.js: -------------------------------------------------------------------------------- 1 | import React, { PureComponent } from 'react'; 2 | import { Text,StyleSheet,View, ScrollView, Content, Linking } from 'react-native'; 3 | import SettingsContainer from './components/settings-container'; 4 | import SignificantLocation from './components/significant-location'; 5 | import ActivityType from './components/activity-type'; 6 | import DesiredAccuracy from './components/desired-accuracy'; 7 | import DeferLocUpdates from './components/defer-location-updates'; 8 | import PtsPerBatch from './components/point-per-batch'; 9 | import UpdateSwitch from './components/update-switch'; 10 | import ResumeGeofence from './components/resume-geofence'; 11 | import NotificationsSwitch from './components/notifications-switch'; 12 | import ReceiverEndpoint from './components/receiver-endpoint'; 13 | import BackgroundGeolocation from "react-native-background-geolocation"; 14 | import {Spinner} from 'native-base'; 15 | 16 | class Settings extends PureComponent { 17 | constructor () { 18 | super() 19 | this.state = {url:'http://',activity:'',deferTime:0,stopOnStationary:"True",geofenceProximityRadius:'1000',useSignificantChangesOnly: false, desiredAccuracy:5,autoSyncThreshold:100,loading:true} 20 | } 21 | componentDidMount() { 22 | BackgroundGeolocation.ready({},(state)=> { 23 | console.log("Settings---------->",state.autoSyncThreshold) 24 | this.setState({ 25 | url: state.url, 26 | device_id: state.device_id, 27 | useSignificantChangesOnly: state.useSignificantChangesOnly, 28 | desiredAccuracy:state.desiredAccuracy, 29 | activity: state.activityType, 30 | autoSyncThreshold: state.autoSyncThreshold, 31 | geofenceProximityRadius: state.geofenceProximityRadius, 32 | stopOnStationary: state.stopOnStationary, 33 | deferTime: state.deferTime, 34 | loading:false 35 | }) 36 | }); 37 | 38 | } 39 | 40 | render() { 41 | const isLoading = this.state.loading; 42 | 43 | return ( 44 | <> 45 | {isLoading?: 46 | 47 | 48 | 49 | SETTINGS 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | (Enable audio notifications of app event such as when the tracking acquires a new position) 61 | 62 | (The plugin automatically stops tracking after 10 minutes of non-activity - Not recommended to activate it) 63 | {Linking.openURL('http://openhumansfoundation.org/Overland_android/privacy_policy.html')}} 66 | > 67 | Access to privacy policy 68 | 69 | 70 | 71 | } 72 | 73 | ); 74 | 75 | } 76 | } 77 | 78 | const styles = StyleSheet.create({ 79 | 80 | header: { 81 | marginTop: 10 82 | }, 83 | headerContent: { 84 | fontSize:16 85 | } 86 | 87 | }); 88 | 89 | export default Settings; 90 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../components/container'; 4 | 5 | const TrackerContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | flex: 1, 12 | flexDirection: 'column', 13 | alignItems: 'center', 14 | justifyContent: 'flex-start' 15 | }, 16 | }); 17 | 18 | export default TrackerContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-interval/components/tracker-interval-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const TrackerIntervalContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingTop: 10, 12 | display: 'flex', 13 | flexDirection: 'column', 14 | alignItems: 'center', 15 | }, 16 | }); 17 | 18 | export default TrackerIntervalContainer; 19 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-interval/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet } from 'react-native'; 3 | import TrackerIntervalContainer from './components/tracker-interval-container'; 4 | import Slider from '@react-native-community/slider'; 5 | import BackgroundGeolocation from "react-native-background-geolocation"; 6 | import {storeData,fetchData} from '../../../../utils/store'; 7 | 8 | class TrackerInterval extends React.Component { 9 | constructor() { 10 | super() 11 | this.state = { 12 | interval: 60 13 | }; 14 | this.onIntervalChange = this.onIntervalChange.bind(this); 15 | } 16 | async componentDidMount(){ 17 | let _httpTimeout = await fetchData("httpTimeout"); 18 | if(_httpTimeout){ 19 | this.setState({interval:Math.floor(_httpTimeout/1000)}) 20 | } 21 | } 22 | onIntervalChange(value) { 23 | const num = parseInt(value, 10); 24 | console.log('====>', num); 25 | this.setState({ 26 | interval: num, 27 | }); 28 | BackgroundGeolocation.setConfig({httpTimeout:num*1000}) 29 | storeData({name:"@httpTimeout",value:String(num*1000)}) 30 | } 31 | 32 | render() { 33 | const interval = this.state.interval; 34 | 35 | return ( 36 | 37 | SEND INTERVAL 38 | 39 | {interval > 60 40 | ? `${parseInt(interval / 60, 10)} minutes` 41 | : `${interval} secondes`} 42 | 43 | 52 | 53 | ); 54 | } 55 | } 56 | 57 | const styles = StyleSheet.create({ 58 | slider: { 59 | width: 300, 60 | height: 48, 61 | }, 62 | }); 63 | 64 | export default TrackerInterval; 65 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/components/gps-element/components/gps-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../components/container'; 4 | 5 | const GPSContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingHorizontal: 5, 12 | paddingVertical: 5, 13 | flex: 1, 14 | flexDirection: 'column', 15 | alignItems:'center' 16 | }, 17 | }); 18 | 19 | export default GPSContainer; 20 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/components/gps-element/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet } from 'react-native'; 3 | import GPSContainer from './components/gps-container'; 4 | import {scale} from '../../../../../../utils/scaling' 5 | 6 | const GPSElement = ({ title, valueX, valueY, description }) => { 7 | return ( 8 | 9 | {title} 10 | {valueX} 11 | {valueY} 12 | {description} 13 | 14 | ); 15 | }; 16 | 17 | export default GPSElement; 18 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/components/location-element/components/location-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../components/container'; 4 | 5 | const LocationContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingHorizontal: 5, 12 | paddingVertical: 5, 13 | flex:1, 14 | flexDirection: 'column', 15 | alignItems:'center' 16 | }, 17 | }); 18 | 19 | export default LocationContainer; 20 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/components/location-element/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet,PixelRatio } from 'react-native'; 3 | import LocationContainer from './components/location-container'; 4 | import {scale} from '../../../../../../utils/scaling' 5 | 6 | const LocationElement = ({ title, value, description }) => { 7 | return ( 8 | 9 | {title} 10 | {value} 11 | {description} 12 | 13 | ); 14 | }; 15 | 16 | export default LocationElement; 17 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/components/tracker-location-display-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const TrackerLocationDisplayContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | // TODO HANDLE MARGIN BETWEEN 12 | marginRight: 20, 13 | marginLeft: 20, 14 | //display: 'flex', 15 | flexDirection: 'row', 16 | flexWrap: 'wrap', 17 | }, 18 | }); 19 | 20 | export default TrackerLocationDisplayContainer; 21 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-location-display/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, Button, View, StyleSheet, TouchableHighlight, InteractionManager } from 'react-native'; 3 | import TrackerLocationDisplayContainer from './components/tracker-location-display-container'; 4 | import LocationElement from './components/location-element'; 5 | import GPSElement from './components/gps-element'; 6 | import BackgroundGeolocation from "react-native-background-geolocation"; 7 | import NetInfo from "@react-native-community/netinfo"; 8 | import {scale} from '../../../../utils/scaling'; 9 | 10 | function AlertHttp(props){ 11 | if(props.displayMessage){ 12 | return ( 13 | 23 | Invalid url, go in settings to modify it 24 | ); 25 | }else{ 26 | return null; 27 | } 28 | } 29 | 30 | 31 | class TrackerLocationDisplay extends React.Component { 32 | constructor(props) { 33 | super(props); 34 | this.state = {syncAvailable:global.isConnected,displayMessage:false,queueSize: '0' ,lastSent: '-', diffDateLastLocation: '-',speed: '-',latitude: '--',longitude: '--', accuracy: '--', selectedLocationId: -1, isReady: false }; 35 | this.refresh = this.refresh.bind(this); 36 | } 37 | 38 | componentDidMount() { 39 | this.timerID = setInterval( 40 | () => this.tick(), 41 | 1000 42 | ); 43 | InteractionManager.runAfterInteractions(() => { 44 | this.refresh(); 45 | }); 46 | BackgroundGeolocation.onHttp(httpEvent => { 47 | if (httpEvent.success==false) { 48 | if (httpEvent.status!=200){ 49 | this.setState({syncAvailable:false,displayMessage:true}) 50 | }else { 51 | this.setState({syncAvailable:false,displayMessage:false}) 52 | } 53 | } else { 54 | this.setState({syncAvailable:true,displayMessage:false}) 55 | } 56 | }); 57 | NetInfo.addEventListener(state => { 58 | this.setState({syncAvailable:state.isConnected}) 59 | this.submitSuggestion() 60 | }); 61 | } 62 | 63 | componentWillUnmount() { 64 | clearInterval(this.timerID); 65 | } 66 | 67 | tick() { 68 | this.refresh(); 69 | } 70 | zeroPad (num, places) { 71 | return String(num).padStart(places, '0') 72 | } 73 | async refresh() { 74 | try{ 75 | let locations = await BackgroundGeolocation.getLocations(); 76 | let queueSize = locations.length; 77 | if (queueSize>=1) { 78 | let last_location = locations[queueSize - 1]; 79 | let last_timestamp = new Date(locations[queueSize - 1].properties.timestamp); 80 | let first_location = locations[0]; 81 | let first_timestamp = new Date(locations[0].properties.timestamp); 82 | let current_timestamp = new Date(); 83 | let diffDateLastLocation = current_timestamp - last_timestamp; 84 | let diffDateFirstLocation = current_timestamp - first_timestamp; 85 | let l_diffHour = Math.floor(diffDateLastLocation/(60*60*1000) % 24); 86 | let l_diffMinute = Math.floor(diffDateLastLocation/(60*1000) % 60); 87 | let l_diffSeconde = Math.floor(diffDateLastLocation/(1000) % 60); 88 | let f_diffMinute = Math.floor(diffDateFirstLocation/(60*1000) % 60); 89 | let f_diffSeconde = Math.floor(diffDateFirstLocation/(1000) % 60); 90 | let s_diffDateFirstLocation = this.zeroPad(f_diffMinute,2)+':'+this.zeroPad(f_diffSeconde,2); 91 | 92 | let s_diffDateLastLocation = this.zeroPad(l_diffHour,2) +':'+this.zeroPad(l_diffMinute,2)+':'+this.zeroPad(l_diffSeconde,2); 93 | if(diffDateLastLocation > 60*60*1000*24 ){ 94 | s_diffDateLastLocation = '> 1day' 95 | } 96 | if(diffDateFirstLocation > 60*1000*24 ){ 97 | s_diffDateFirstLocation = '> 1h' 98 | } 99 | let speed = Math.floor(last_location.properties.speed) 100 | if(speed==='NaN') { 101 | let speed = '-' 102 | } 103 | await this.setState({ lastSent: String(s_diffDateFirstLocation), queueSize: String(queueSize), diffDateLastLocation: s_diffDateLastLocation, speed: String(speed), latitude: String(last_location.geometry.coordinates[0]),longitude: String(last_location.geometry.coordinates[1]),accuracy:Math.floor(last_location.properties.horizontal_accuracy), isReady: true }); 104 | } else { 105 | await this.setState({lastSent: '-', queueSize: '0' ,diffDateLastLocation: '-',speed: '-',latitude: '--',longitude: '--',accuracy: '--', selectedLocationId: -1, isReady: false }); 106 | } 107 | } 108 | catch{ 109 | await this.setState({lastSent: '-', queueSize: '0' ,diffDateLastLocation: '-',speed: '-',latitude: '--',longitude: '--',accuracy: '--', selectedLocationId: -1, isReady: false }); 110 | } 111 | } 112 | 113 | async submitSuggestion() { 114 | /*const res = await BackgroundGeolocation.forceSync()*/ 115 | try{ 116 | BackgroundGeolocation.sync((records) => { 117 | console.log("[sync] success: ", records); 118 | //let current_timestamp = new Date(); 119 | //let diffDateLastLocation = current_timestamp - last_timestamp; 120 | this.setState({syncAvailable:true}) 121 | }).catch((error) => { 122 | console.log("[sync] FAILURE: ", error); 123 | this.setState({syncAvailable:false}) 124 | }); 125 | }catch{ 126 | console.log("[sync] BAD CATCH - FAILURE: "); 127 | this.setState({syncAvailable:false}) 128 | } 129 | 130 | 131 | } 132 | 133 | notAvailable(){ 134 | 135 | } 136 | 137 | 138 | render() { 139 | let syncAvailable = this.state.syncAvailable; 140 | let displayMessage = this.state.displayMessage; 141 | return ( 142 | 143 | 144 | 150 | 151 | 1h' ? ' ' : 'minutes ago'} 155 | /> 156 | syncAvailable?this.submitSuggestion():this.notAvailable()} 159 | underlayColor='#fff'> 160 | Send now 161 | 162 | 163 | 164 | 171 | 176 | 177 | 183 | 184 | 185 | ); 186 | } 187 | } 188 | 189 | const styles = StyleSheet.create({ 190 | submit:{ 191 | backgroundColor:'#5bce84', 192 | borderRadius:5, 193 | borderWidth: 1, 194 | borderColor: '#5bce84', 195 | flex: 1, 196 | justifyContent: 'center', 197 | alignItems: 'center' 198 | 199 | }, 200 | notSubmit:{ 201 | backgroundColor:'#969696', 202 | borderRadius:5, 203 | borderWidth: 1, 204 | borderColor: '#969696', 205 | flex: 1, 206 | justifyContent: 'center', 207 | alignItems: 'center' 208 | }, 209 | submitText:{ 210 | color:'#fff', 211 | fontSize: scale(14) 212 | } 213 | }); 214 | 215 | export default TrackerLocationDisplay; 216 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-switch/components/tracker-switch-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const TrackerSwitchContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingTop: 5, 12 | paddingLeft: 15, 13 | paddingRight: 16, 14 | flexDirection: 'row', 15 | justifyContent: 'space-between', 16 | width: "100%" 17 | }, 18 | }); 19 | 20 | export default TrackerSwitchContainer; 21 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/tracker-switch/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { Switch } from 'react-native-gesture-handler'; 4 | import TrackerSwitchContainer from './components/tracker-switch-container'; 5 | import { ButtonGroup } from 'react-native-elements'; 6 | import BackgroundGeolocation from "react-native-background-geolocation"; 7 | 8 | class TrackerSwitch extends React.Component { 9 | constructor(props) { 10 | super(props) 11 | this.state = { 12 | selectedIndex: 0 13 | } 14 | this.updateIndex = this.updateIndex.bind(this) 15 | } 16 | 17 | 18 | updateIndex (selectedIndex) { 19 | this.setState({selectedIndex}) 20 | if (selectedIndex==0){ 21 | BackgroundGeolocation.start() 22 | }else { 23 | BackgroundGeolocation.stop() 24 | } 25 | } 26 | 27 | 28 | render() { 29 | 30 | const buttons = ['ON', 'OFF'] 31 | const { selectedIndex } = this.state 32 | 33 | return ( 34 | 35 | 41 | 42 | ); 43 | } 44 | } 45 | 46 | 47 | export default TrackerSwitch; 48 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/icon-element/components/icon-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../components/container'; 4 | 5 | const IconContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingHorizontal: 5, 12 | paddingVertical: 5, 13 | flex:0.5, 14 | flexDirection: 'column', 15 | alignItems:'center', 16 | justifyContent: 'flex-end' 17 | 18 | }, 19 | }); 20 | 21 | export default IconContainer; 22 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/icon-element/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet } from 'react-native'; 3 | import IconContainer from './components/icon-container'; 4 | import Ionicons from 'react-native-vector-icons/Ionicons'; 5 | import AFicons from 'react-native-vector-icons/FontAwesome'; 6 | import AFicons5 from 'react-native-vector-icons/FontAwesome5'; 7 | import {scale} from '../../../../../../utils/scaling' 8 | 9 | const IconElement = ({mobilityType }) => { 10 | let iconName = 'bicycle' 11 | let awesomIcon = false; 12 | 13 | switch(mobilityType) { 14 | case 'cycling': 15 | awesomIcon = false; 16 | iconName = 'bicycle'; 17 | break; 18 | case 'walking': 19 | awesomIcon = false; 20 | iconName = 'walking' 21 | break; 22 | case 'running': 23 | awesomIcon = false; 24 | iconName = 'running' 25 | break; 26 | case 'ship': 27 | awesomIcon = true; 28 | iconName = 'ship'; 29 | break; 30 | case 'driving': 31 | awesomIcon = false; 32 | iconName = 'car' 33 | break; 34 | case 'taxi': 35 | awesomIcon = true; 36 | iconName = 'taxi' 37 | break; 38 | case 'bus': 39 | awesomIcon = true; 40 | iconName = 'bus' 41 | break; 42 | case 'train': 43 | awesomIcon = true; 44 | iconName = 'train' 45 | break; 46 | case 'plane': 47 | awesomIcon = true; 48 | iconName = 'plane' 49 | break; 50 | default: 51 | iconName = '' 52 | } 53 | return ( 54 | 55 | {awesomIcon?:} 56 | {mobilityType} 57 | 58 | ); 59 | }; 60 | 61 | export default IconElement; 62 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/location-element/components/location-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../components/container'; 4 | 5 | const LocationContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingHorizontal: 5, 12 | paddingVertical: 5, 13 | flex:0.66, 14 | flexDirection: 'column', 15 | alignItems:'center' 16 | }, 17 | }); 18 | 19 | export default LocationContainer; 20 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/location-element/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet } from 'react-native'; 3 | import LocationContainer from './components/location-container'; 4 | import {scale} from '../../../../../../utils/scaling' 5 | 6 | const LocationElement = ({ title, value, description }) => { 7 | return ( 8 | 9 | {title} 10 | {value} 11 | {description} 12 | 13 | ); 14 | }; 15 | 16 | export default LocationElement; 17 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/trip-display-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../components/container'; 4 | 5 | const TrackerLocationDisplayContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | containerNoTrip: { 11 | // TODO HANDLE MARGIN BETWEEN 12 | paddingTop: 0, 13 | marginLeft:15, 14 | marginRight:15, 15 | //display: 'flex', 16 | flexDirection: 'row', 17 | backgroundColor: '#e3e3e3'//'#c3eac1' 18 | }, 19 | containerTrip: { 20 | // TODO HANDLE MARGIN BETWEEN 21 | paddingTop: 0, 22 | marginLeft:15, 23 | marginRight:15, 24 | //display: 'flex', 25 | flexDirection: 'row', 26 | backgroundColor: '#c3eac1' 27 | }, 28 | }); 29 | 30 | export default TrackerLocationDisplayContainer; 31 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/trip-mode/components/icon-element/components/icon-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../../../components/container'; 4 | 5 | const IconContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | paddingHorizontal: 5, 12 | paddingVertical: 5, 13 | flex:1, 14 | display: 'flex', 15 | flexDirection: 'column', 16 | alignItems:'center', 17 | justifyContent: 'flex-end' 18 | 19 | }, 20 | }); 21 | 22 | export default IconContainer; 23 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/trip-mode/components/icon-element/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet } from 'react-native'; 3 | import IconContainer from './components/icon-container'; 4 | import Ionicons from 'react-native-vector-icons/Ionicons'; 5 | import AFicons from 'react-native-vector-icons/FontAwesome'; 6 | import AFicons5 from 'react-native-vector-icons/FontAwesome5'; 7 | import {scale} from '../../../../../../../../utils/scaling'; 8 | 9 | const IconElement = ({mobilityType }) => { 10 | let iconName = 'bicycle' 11 | let awesomIcon = false; 12 | 13 | switch(mobilityType) { 14 | case 'cycling': 15 | awesomIcon = false; 16 | iconName = 'bicycle'; 17 | break; 18 | case 'walking': 19 | awesomIcon = false; 20 | iconName = 'walking' 21 | break; 22 | case 'running': 23 | awesomIcon = false; 24 | iconName = 'running' 25 | break; 26 | case 'ship': 27 | awesomIcon = true; 28 | iconName = 'ship'; 29 | break; 30 | case 'driving': 31 | awesomIcon = false; 32 | iconName = 'car' 33 | break; 34 | case 'taxi': 35 | awesomIcon = true; 36 | iconName = 'taxi' 37 | break; 38 | case 'bus': 39 | awesomIcon = true; 40 | iconName = 'bus' 41 | break; 42 | case 'train': 43 | awesomIcon = true; 44 | iconName = 'train' 45 | break; 46 | case 'plane': 47 | awesomIcon = true; 48 | iconName = 'plane' 49 | break; 50 | default: 51 | iconName = '' 52 | } 53 | return ( 54 | 55 | {awesomIcon?:} 56 | {mobilityType} 57 | 58 | ); 59 | }; 60 | 61 | export default IconElement; 62 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/trip-mode/components/trip-mode-container/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import Container from '../../../../../../../../components/container'; 4 | 5 | const TripModeContainer = props => { 6 | return {props.children}; 7 | }; 8 | 9 | const styles = StyleSheet.create({ 10 | container: { 11 | 12 | }, 13 | }); 14 | 15 | export default TripModeContainer; 16 | -------------------------------------------------------------------------------- /src/scenes/tracker/components/trip-display/components/trip-mode/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Text, StyleSheet, DeviceEventEmitter } from 'react-native'; 3 | import { Button } from 'react-native-elements'; 4 | import TripModeContainer from './components/trip-mode-container'; 5 | 6 | import IconElement from './components/icon-element'; 7 | import {scale} from '../../../../../../utils/scaling'; 8 | 9 | import {Dimensions, View} from 'react-native' 10 | const DeviceWidth = Dimensions.get('window').width 11 | 12 | const TripMode = ({ }) => { 13 | return ( 14 | 15 | 20 | TRIP MODE 21 | (click on one of them) 22 | 25 | 26 | 27 |