diff --git a/Ejectable/BGEO.js b/Ejectable/BGEO.js index 1eeb4461..935e595d 100644 --- a/Ejectable/BGEO.js +++ b/Ejectable/BGEO.js @@ -4,7 +4,7 @@ import { Pressable } from 'react-native'; import { Text, View } from './components/Themed.tsx'; import * as TaskManager from 'expo-task-manager'; import * as Location from 'expo-location'; -import { Trips, setBgOps } from './GT2'; +import { bgOps, Trips, setBgOps } from './GT2'; const LOCATION_TASK_NAME = 'background-location-task'; @@ -26,12 +26,20 @@ const LOCATION_TASK_NAME = 'background-location-task'; }; export default function PermissionsButton() { + if (!bgOps) return( {'Enable background operations'} + {' (Only used during a trip)'} ); + else + return( + + {'Trips can run in background.'} + ); + } TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => { @@ -50,12 +58,20 @@ TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => { const styles = StyleSheet.create({ container: { - marginVertical: 20, - marginBottom: -30, + marginVertical: 2, + marginTop: -40, + marginBottom: 25, alignItems: 'center', }, button: { fontSize: 10, backgroundColor: 'lime', }, + text: { + color: "blue", + }, + text2: { + fontSize: 8, + color: "navy", + } }); diff --git a/Ejectable/app.json b/Ejectable/app.json index 762b8189..4b793aac 100644 --- a/Ejectable/app.json +++ b/Ejectable/app.json @@ -35,7 +35,8 @@ "permissions": [ "ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", - "FOREGROUND_SERVICE" + "FOREGROUND_SERVICE", + "ACCESS_BACKGROUND_LOCATION" ], "adaptiveIcon": { "foregroundImage": "./assets/images/adaptive-icon.png", diff --git a/Ejectable/components/ScreenInfo.tsx b/Ejectable/components/ScreenInfo.tsx index 02951de0..d3d52023 100644 --- a/Ejectable/components/ScreenInfo.tsx +++ b/Ejectable/components/ScreenInfo.tsx @@ -2,8 +2,7 @@ import React from 'react'; import { StyleSheet, TouchableOpacity } from 'react-native'; import { Text, View } from './Themed'; import * as Device from 'expo-device'; -import { bgOps, ver } from '../GT2'; -import PermissionsButton from '../BGEO'; +import { ver } from '../GT2'; export default function ScreenInfo() { return ( @@ -56,7 +55,6 @@ export function ScreenInfo5() { } export function ScreenInfo3() { - if (bgOps) return ( ); - else - return ( - - - {'Green Travel Calculator v. ' + ver } - - - expo {Device.osName == 'iOS' ? 'iOS ' : 'android '} version - - - - {'\nNote: accuracy depends on sensitivity setting, your device, and carrier.'} - - - ); } const styles = StyleSheet.create({ diff --git a/Ejectable/screens/TripScreen.tsx b/Ejectable/screens/TripScreen.tsx index 616e830b..4dcd5b32 100644 --- a/Ejectable/screens/TripScreen.tsx +++ b/Ejectable/screens/TripScreen.tsx @@ -6,6 +6,7 @@ import { ScreenInfo2 } from '../components/ScreenInfo'; import { bgOps, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2'; import { RootTabScreenProps } from '../types'; import * as Device from 'expo-device'; +import PermissionsButton from '../BGEO'; var debug:number = 0; @@ -65,6 +66,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>) if (Trips.nTrips < 1) return ( + Trip Control @@ -91,6 +93,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>) else return ( + Trip Control