stub 2.0.8
This commit is contained in:
parent
8ae9271414
commit
470c231695
|
@ -20,8 +20,11 @@ export function setAdvised() : void { advised = true; }
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const isLoadingComplete = useCachedResources();
|
const isLoadingComplete = useCachedResources();
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
|
|
||||||
const [isKM, setIsKM] = useState(false);
|
const [isKM, setIsKM] = useState(false);
|
||||||
const toggleUnits = () => setIsKM(previousState => !previousState);
|
const toggleUnits = () => setIsKM(previousState => !previousState);
|
||||||
|
|
||||||
|
|
||||||
const [location, setLocation] = useState(Object);
|
const [location, setLocation] = useState(Object);
|
||||||
const [errorMsg, setErrorMsg] = useState("");
|
const [errorMsg, setErrorMsg] = useState("");
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { Text, View } from './components/Themed';
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
import * as geolib from 'geolib';
|
import * as geolib from 'geolib';
|
||||||
|
|
||||||
export const ver:string = "2.0.7"
|
export const ver:string = "2.0.8"
|
||||||
var debug:number = 0;
|
var debug:number = 0;
|
||||||
var endIsNigh:boolean = false;
|
var endIsNigh:boolean = false;
|
||||||
var testCount = 0;
|
var testCount = 0;
|
||||||
var bgEnabled:boolean = false;
|
export var bgOps:boolean = false;
|
||||||
var expoGeoState:any = null;
|
var expoGeoState:any = null;
|
||||||
export var locEnabled:boolean = false;
|
export var locEnabled:boolean = false;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ export var locEnabled:boolean = false;
|
||||||
const minExpoAccuracy:number = 5;
|
const minExpoAccuracy:number = 5;
|
||||||
|
|
||||||
export function getEndIsLast() : boolean { return endIsNigh; }
|
export function getEndIsLast() : boolean { return endIsNigh; }
|
||||||
|
export function setBgOps(value:boolean) { bgOps = value; }
|
||||||
export function setEndIsLast(value:boolean) { endIsNigh = value; }
|
export function setEndIsLast(value:boolean) { endIsNigh = value; }
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
@ -133,7 +134,7 @@ class Trip {
|
||||||
}
|
}
|
||||||
|
|
||||||
public start() { this.interval = setInterval(() => this.tick(), heartbeat);
|
public start() { this.interval = setInterval(() => this.tick(), heartbeat);
|
||||||
if (!bgEnabled) startTracking(this);
|
if (!bgOps) startTracking(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public resume() { this.lastFix.mLatitude = 0.0;
|
public resume() { this.lastFix.mLatitude = 0.0;
|
||||||
|
@ -143,7 +144,7 @@ class Trip {
|
||||||
public stop() { Trips.distance += this.ds;
|
public stop() { Trips.distance += this.ds;
|
||||||
this.ds = 0.0;
|
this.ds = 0.0;
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
if (!bgEnabled) stopTracking(this);
|
if (!bgOps) stopTracking(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "GT2 Green Travel Carbon App",
|
"name": "GT2 Green Travel Carbon App",
|
||||||
"slug": "GT2standalone",
|
"slug": "GT2standalone",
|
||||||
"version": "2.0.7",
|
"version": "2.0.8",
|
||||||
"orientation": "default",
|
"orientation": "default",
|
||||||
"description": "Travel Carbon Footprint (simplified version)",
|
"description": "Travel Carbon Footprint (simplified version)",
|
||||||
"icon": "./assets/images/icon.png",
|
"icon": "./assets/images/icon.png",
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "app.greentravel.gt2",
|
"bundleIdentifier": "app.greentravel.gt2",
|
||||||
"buildNumber": "3",
|
"buildNumber": "4",
|
||||||
"infoPlist": {
|
"infoPlist": {
|
||||||
"UIBackgroundModes": [
|
"UIBackgroundModes": [
|
||||||
"location",
|
"location",
|
||||||
|
|
|
@ -2,7 +2,8 @@ import React from 'react';
|
||||||
import { StyleSheet, TouchableOpacity } from 'react-native';
|
import { StyleSheet, TouchableOpacity } from 'react-native';
|
||||||
import { Text, View } from './Themed';
|
import { Text, View } from './Themed';
|
||||||
import * as Device from 'expo-device';
|
import * as Device from 'expo-device';
|
||||||
import { ver } from '../GT2';
|
import { bgOps, ver } from '../GT2';
|
||||||
|
import PermissionsButton from '../BGEO';
|
||||||
|
|
||||||
export default function ScreenInfo() {
|
export default function ScreenInfo() {
|
||||||
return (
|
return (
|
||||||
|
@ -55,6 +56,7 @@ export function ScreenInfo5() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ScreenInfo3() {
|
export function ScreenInfo3() {
|
||||||
|
if (bgOps)
|
||||||
return (
|
return (
|
||||||
<View style={styles.splashContainer}>
|
<View style={styles.splashContainer}>
|
||||||
<Text
|
<Text
|
||||||
|
@ -77,6 +79,30 @@ export function ScreenInfo3() {
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
else
|
||||||
|
return (
|
||||||
|
<View style={styles.splashContainer}>
|
||||||
|
<Text
|
||||||
|
style={styles.titleText}
|
||||||
|
lightColor="rgba(0,0,0,0.8)"
|
||||||
|
darkColor="rgba(255,255,255,0.8)">
|
||||||
|
{'Green Travel Calculator v. ' + ver }
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={styles.versionText}
|
||||||
|
lightColor="rgba(0,0,0,0.8)"
|
||||||
|
darkColor="rgba(255,255,255,0.8)">
|
||||||
|
expo {Device.osName == 'iOS' ? 'iOS ' : 'android '} version
|
||||||
|
</Text>
|
||||||
|
<PermissionsButton />
|
||||||
|
<Text
|
||||||
|
style={styles.cautionText}
|
||||||
|
lightColor="rgba(0,0,0,0.8)"
|
||||||
|
darkColor="rgba(255,255,255,0.8)">
|
||||||
|
{'\nNote: accuracy depends on sensitivity setting, your device, and carrier.'}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Alert, BackHandler, Button, StyleSheet } from 'react-native';
|
import { Alert, Button, StyleSheet } from 'react-native';
|
||||||
import { Text, View } from '../components/Themed';
|
import { Text, View } from '../components/Themed';
|
||||||
import { ScreenInfo2 } from '../components/ScreenInfo';
|
import { ScreenInfo2 } from '../components/ScreenInfo';
|
||||||
import { ver, locEnabled, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2';
|
import { bgOps, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2';
|
||||||
import { RootTabScreenProps } from '../types';
|
import { RootTabScreenProps } from '../types';
|
||||||
import { getAdvised, setAdvised } from './ModalScreen';
|
import * as Device from 'expo-device';
|
||||||
|
|
||||||
var debug:number = 0;
|
var debug:number = 0;
|
||||||
|
|
||||||
|
@ -34,9 +34,10 @@ const styles = StyleSheet.create({
|
||||||
|
|
||||||
function startTrip() {
|
function startTrip() {
|
||||||
|
|
||||||
if (!locEnabled) {
|
if (!bgOps) {
|
||||||
Alert.alert("Location services unavailable can't start trip.");
|
if (Device.osName === 'iOS')
|
||||||
return;
|
Alert.alert("Background location not enabled. Must be in foreground and awake during trip!");
|
||||||
|
else Alert.alert('Stay in foreground, awake during trip!');
|
||||||
}
|
}
|
||||||
|
|
||||||
Trips.start();
|
Trips.start();
|
||||||
|
@ -71,10 +72,6 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
|
||||||
<Button
|
<Button
|
||||||
title={sButtonText}
|
title={sButtonText}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!getAdvised()) {
|
|
||||||
Alert.alert("Note: " + ver + " doesn't run while in background or sleeping.");
|
|
||||||
setAdvised();
|
|
||||||
}
|
|
||||||
if (!Trips.inProgress) {startTrip();
|
if (!Trips.inProgress) {startTrip();
|
||||||
if (Trips.inProgress) { setSButtonText("End"); setPButtonText('Pause');}}
|
if (Trips.inProgress) { setSButtonText("End"); setPButtonText('Pause');}}
|
||||||
else {setSButtonText('Start'); LastTrip.from(Trips); endTrip(); navigation.push('Modal'); }}
|
else {setSButtonText('Start'); LastTrip.from(Trips); endTrip(); navigation.push('Modal'); }}
|
||||||
|
@ -101,10 +98,6 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
|
||||||
<Button
|
<Button
|
||||||
title={sButtonText}
|
title={sButtonText}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!getAdvised()) {
|
|
||||||
Alert.alert("Note: GT2" + ver + " doesn't run while in background or sleeping.");
|
|
||||||
setAdvised();
|
|
||||||
}
|
|
||||||
if (!Trips.inProgress) {startTrip();
|
if (!Trips.inProgress) {startTrip();
|
||||||
if (Trips.inProgress) { setSButtonText("End"); setPButtonText('Pause');}}
|
if (Trips.inProgress) { setSButtonText("End"); setPButtonText('Pause');}}
|
||||||
else {setSButtonText('Start'); endTrip(); LastTrip.from(Trips); navigation.push('Modal'); }}
|
else {setSButtonText('Start'); endTrip(); LastTrip.from(Trips); navigation.push('Modal'); }}
|
||||||
|
|
Loading…
Reference in New Issue