This commit is contained in:
Ren Juan 2021-08-28 10:27:48 +00:00
parent ef315a96c5
commit f3b3883a8a
5 changed files with 14 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import 'react-native-gesture-handler'; import 'react-native-gesture-handler';
import { StatusBar } from 'expo-status-bar'; import { StatusBar } from 'expo-status-bar';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Text } from 'react-native'; import { Alert, Text } from 'react-native';
import * as Location from 'expo-location'; import * as Location from 'expo-location';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
@ -31,12 +31,15 @@ export default function App() {
if (status !== 'granted') { if (status !== 'granted') {
setErrorMsg('Permission to access location was denied'); setErrorMsg('Permission to access location was denied');
Trips.setLocEnabled(false); Trips.setLocEnabled(false);
Alert.alert("Permission to access location was denied, this app requires it.");
return; return;
} else Trips.setLocEnabled(true); } else Trips.setLocEnabled(true);
if (debug) {
let location = await Location.getCurrentPositionAsync({}); let location = await Location.getCurrentPositionAsync({});
setLocation(location); setLocation(location);
Trips.deltaLoc(location); Trips.deltaLoc(location);
}
})(); })();
}, []); }, []);

View File

@ -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.4", "version": "2.0.5",
"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",
@ -29,6 +29,11 @@
} }
}, },
"android": { "android": {
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"FOREGROUND_SERVICE"
],
"adaptiveIcon": { "adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png", "foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff" "backgroundColor": "#ffffff"

View File

@ -45,11 +45,12 @@ function handleHelpPress() {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
summaryContainer: { summaryContainer: {
marginVertical: -9,
alignItems: 'center', alignItems: 'center',
marginHorizontal: 50, marginHorizontal: 50,
}, },
helpContainer: { helpContainer: {
marginTop: 15, marginTop: 10,
marginHorizontal: 20, marginHorizontal: 20,
alignItems: 'center', alignItems: 'center',
}, },

View File

@ -36,7 +36,7 @@ const styles = StyleSheet.create({
fontWeight: 'bold', fontWeight: 'bold',
}, },
separator: { separator: {
marginVertical: 10, marginVertical: 5,
height: 1, height: 1,
width: '80%', width: '80%',
}, },

View File

@ -71,7 +71,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
title={sButtonText} title={sButtonText}
onPress={() => { onPress={() => {
if (!getAdvised()) { if (!getAdvised()) {
Alert.alert("GT2 2.0.n doesn't runs in background."); Alert.alert("Note: GT2 2.0.n doesn't run in background.");
setAdvised(); setAdvised();
} }
if (!Trips.inProgress) {startTrip(); if (!Trips.inProgress) {startTrip();