Compare commits

...

33 Commits

Author SHA1 Message Date
RenJuan 4a72a9f591 Update README.md 2023-12-23 09:26:10 +00:00
RenJuan 80e788679d Update README.md 2023-12-23 09:24:49 +00:00
RenJuan 6eec607abf Update README.md 2023-12-23 09:24:16 +00:00
RenJuan 28b6b0e06d Update README.md 2023-12-23 09:23:01 +00:00
RenJuan da86eb0253 Update README.md 2023-12-23 09:22:45 +00:00
RenJuan eb977a1f24 Update README.md 2023-12-23 09:22:24 +00:00
RenJuan 1e2f85fe1d Update README.md 2023-12-23 09:21:45 +00:00
RenJuan a370c26775 Update README.md 2023-12-23 09:21:23 +00:00
RenJuan 4d6eaa522b Update README.md 2023-12-23 09:18:27 +00:00
仁 人 卷 1e27fdd969
Update README.md 2023-10-01 18:37:36 +00:00
仁 人 卷 a88aaf0f00
Update README.md 2023-10-01 18:28:57 +00:00
仁 人 卷 91371b8380
Update README.md 2023-08-28 11:27:12 +00:00
仁 人 卷 09910f6122
Update README.md 2023-07-30 10:08:09 +00:00
仁 人 卷 09ceba1725
Update README.md 2023-07-13 09:33:49 +00:00
仁 人 卷 d989221fe4
Update README.md 2023-07-13 08:10:59 +00:00
仁 人 卷 5c84a09ded
Update README.md
*
2023-07-13 08:03:45 +00:00
仁 人 卷 25ec007581
Update README.md
*
2023-07-07 00:59:32 +00:00
仁 人 卷 c7d41f77e0
Update README.md
*
2023-07-07 00:57:27 +00:00
仁 人 卷 eaf073c066
Update README.md
*
2023-07-07 00:50:30 +00:00
仁 人 卷 b02724d556
Update README.md 2022-12-11 03:26:56 +00:00
仁 人 卷 e3189433a4
Update README.md 2022-12-11 03:26:11 +00:00
仁 人 卷 2daa815af4
Update README.md 2022-12-03 15:06:04 +00:00
仁 人 卷 bcee5e706a
Update README.md 2022-12-03 15:02:48 +00:00
Ren Juan b64c6a93f6 * 2022-08-20 02:41:18 +00:00
Ren Juan ca3899e331 * 2022-05-26 04:18:56 +00:00
Ren Juan bc2bf366d0 * 2022-05-26 04:13:54 +00:00
Ren Juan e5bbc64b9b * 2022-03-14 05:51:28 +00:00
Ren Juan 05a7e20d4d * 2021-09-25 15:30:38 +00:00
Ren Juan 47341586bd * 2021-09-02 06:58:19 +00:00
Ren Juan faf3aec937 * 2021-08-30 21:07:58 +00:00
Ren Juan a8bd22c0a3 * 2021-08-30 21:05:06 +00:00
Ren Juan a763ef9d5f * 2021-08-30 10:02:06 +00:00
Ren Juan ecbc1f2260 * 2021-08-30 00:56:54 +00:00
7 changed files with 3318 additions and 4147 deletions

83
Ejectable/BGEO.js Normal file
View File

@ -0,0 +1,83 @@
import React from 'react';
import { useState } from 'react';
import { StyleSheet } from 'react-native';
import { Alert, 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 { bgOps, Trips, setBgOps } from './GT2';
const BACKGROUND_LOCATION_TRACKER = 'BACKGROUND_LOCATION_TRACKER'
const getUpdates = async () => {
await Location.startLocationUpdatesAsync(BACKGROUND_LOCATION_TRACKER , {
accuracy: Location.Accuracy.Highest
});
};
export default function PermissionsButton() {
const [fuBgOps, setfuBgOps] = useState(0);
const requestPermissions = async () => {
const { status } = await Location.requestBackgroundPermissionsAsync();
setBgOps((status === 'granted'));
setfuBgOps(fuBgOps => fuBgOps + 1);
};
if (!bgOps)
return(
<View style={styles.container} lightColor="lime" darkColor="forestgreen">
<Pressable style={styles.button}
onPressIn={requestPermissions }>
<Text style={styles.text}>{'Enable background operations'}</Text>
<Text style={styles.text2}>{' (Only used during a trip)'}</Text>
</Pressable>
</View>);
else
return(
<View style={styles.container} lightColor="lime" darkColor="forestgreen">
<Text style={styles.text}>{'Trips can run in background.'}</Text>
</View>);
}
TaskManager.defineTask(BACKGROUND_LOCATION_TRACKER , async ({ data, error }) => {
if (error) {
// Error occurred - check `error.message` for more details.
console.log(error.message);
return;
}
if (data) {
const { location } = data;
Trips.deltaLoc( location );
}
});
const styles = StyleSheet.create({
container: {
marginVertical: 2,
marginTop: -20,
marginBottom: 15,
alignItems: 'center',
},
button: {
fontSize: 10,
backgroundColor: 'lime',
},
text: {
fontSize: 14,
fontWeight: 'bold',
color: "blue",
},
text2: {
fontSize: 10,
color: "navy",
}
});

View File

@ -35,7 +35,8 @@
"permissions": [ "permissions": [
"ACCESS_COARSE_LOCATION", "ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION", "ACCESS_FINE_LOCATION",
"FOREGROUND_SERVICE" "FOREGROUND_SERVICE",
"ACCESS_BACKGROUND_LOCATION"
], ],
"adaptiveIcon": { "adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png", "foregroundImage": "./assets/images/adaptive-icon.png",

View File

@ -2,8 +2,7 @@ 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 { bgOps, ver } from '../GT2'; import { ver } from '../GT2';
import PermissionsButton from '../BGEO';
export default function ScreenInfo() { export default function ScreenInfo() {
return ( return (
@ -56,7 +55,6 @@ export function ScreenInfo5() {
} }
export function ScreenInfo3() { export function ScreenInfo3() {
if (bgOps)
return ( return (
<View style={styles.splashContainer}> <View style={styles.splashContainer}>
<Text <Text
@ -79,30 +77,6 @@ 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({

File diff suppressed because it is too large Load Diff

View File

@ -12,38 +12,40 @@
"preset": "jest-expo" "preset": "jest-expo"
}, },
"dependencies": { "dependencies": {
"@expo/vector-icons": "^12.0.0", "@expo/vector-icons": "^13.0.0",
"@expo/webpack-config": "^0.17.0",
"@react-navigation/bottom-tabs": "^6.0.5", "@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/native": "^6.0.2", "@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0", "@react-navigation/native-stack": "^6.1.0",
"@react-navigation/stack": "^6.0.7", "@react-navigation/stack": "^6.0.7",
"expo": "~42.0.1", "expo": "~46.0.0",
"expo-asset": "~8.3.2", "expo-asset": "~8.6.1",
"expo-constants": "~11.0.1", "expo-constants": "~13.2.3",
"expo-device": "^3.3.0", "expo-device": "~4.3.0",
"expo-font": "~9.2.1", "expo-font": "~10.2.0",
"expo-linking": "~2.3.1", "expo-linking": "~3.2.2",
"expo-location": "~12.1.2", "expo-location": "~14.3.0",
"expo-splash-screen": "~0.11.2", "expo-modules-core": "^0.11.4",
"expo-status-bar": "~1.0.4", "expo-splash-screen": "~0.16.1",
"expo-task-manager": "~9.2.2", "expo-status-bar": "~1.4.0",
"expo-web-browser": "~9.2.0", "expo-task-manager": "~10.3.0",
"expo-web-browser": "~11.0.0",
"geolib": "^3.3.1", "geolib": "^3.3.1",
"react": "16.13.1", "react": "18.0",
"react-dom": "16.13.1", "react-dom": "18.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz", "react-native": "0.69.4",
"react-native-gesture-handler": "~1.10.2", "react-native-gesture-handler": "~2.5.0",
"react-native-reanimated": "~2.2.0", "react-native-reanimated": "~2.9.1",
"react-native-safe-area-context": "3.2.0", "react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.4.0", "react-native-screens": "~3.15.0",
"react-native-web": "~0.13.12" "react-native-web": "^0.18.7"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@types/react": "~16.9.35", "@types/react": "~18.0",
"@types/react-native": "~0.63.2", "@types/react-native": "~0.69.4",
"jest-expo": "~41.0.0-beta.0", "jest-expo": "~41.0.0-beta.0",
"typescript": "~4.0.0" "typescript": "~4.7.0"
}, },
"private": true "private": true
} }

View File

@ -6,6 +6,7 @@ import { ScreenInfo2 } from '../components/ScreenInfo';
import { bgOps, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2'; import { bgOps, TripDisplay, LastTrip, Trips, setEndIsLast } from '../GT2';
import { RootTabScreenProps } from '../types'; import { RootTabScreenProps } from '../types';
import * as Device from 'expo-device'; import * as Device from 'expo-device';
import PermissionsButton from '../BGEO';
var debug:number = 0; var debug:number = 0;
@ -55,16 +56,18 @@ function pauseTrip() {
} }
function endTrip() { Trips.end(); } function endTrip() { Trips.end(); }
export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>) { export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>) {
const [sButtonText, setSButtonText] = useState("Start"); const [sButtonText, setSButtonText] = useState("Start");
const [pButtonText, setPButtonText] = useState("Pause"); const [pButtonText, setPButtonText] = useState("Pause");
if (Trips.nTrips < 1) if (Trips.nTrips < 1)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<PermissionsButton />
<Text style={styles.title}>Trip Control</Text> <Text style={styles.title}>Trip Control</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" /> <View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<ScreenInfo2 /> <ScreenInfo2 />
@ -91,6 +94,7 @@ export default function TripScreen( { navigation }: RootTabScreenProps<'Trip'>)
else else
return ( return (
<View style={styles.container}> <View style={styles.container}>
<PermissionsButton />
<Text style={styles.title}>Trip Control</Text> <Text style={styles.title}>Trip Control</Text>
<View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" /> <View style={styles.separator} lightColor="#eee" darkColor="rgba(255,255,255,0.1)" />
<ScreenInfo2 /> <ScreenInfo2 />

View File

@ -1,37 +1,44 @@
# GT2 [greentravel.app](https://greentravel.app/doc) # Personal Carbon App
<span style="font-size: 12px">Originally Green Travel Carbon Calculator</span> ## [greentravel.app](https://greentravel.app/doc)
#### Originally Green Travel Carbon Calculator
## 2.0.0 ## 2.0.0
- An Expo version of the same functionality as the original 2011 app but a completed and x-platform app - An Expo version of the same functionality as the original 2011 app but a completed [x-platform](https://apps.apple.com/ao/app/gt2-green-travel-carbon-app/id1583117880) app
that actually reports trip carbon impact accurately. that actually reports trip distance and time and thus carbon impact accurately.
The 2.0.n series is a replacement on google and first version on apple and will be maintained The 2.0.n series is a replacement on google and first version on apple and will be maintained
separate from the subsequent production line which will use the [common mechanism](https://sameboat.live/sb-app) separate from the subsequent production line which will use the [common mechanism](https://devops1.sameboat.network/sb-app)
for delivery of my apps from 2.1 forward. for delivery of my apps from 2.1 forward.
2.0.7 was feature complete at the end of August 2011. 2.0.8 will be the stable baseline of same thing 2.0.7 was feature complete at the end of August 2021.
with background operation, maintained with stack and platform major version increments.
## 2.n.m 2.0.8 the stable baseline of same thing but with background operation, with subsequent change only for stack maintenance was complete in Sept 2023.
- Roadmap for regular production Personal Carbon Accounting domain ## 1.n.m (semantic reset)
- 2.1.0 1st embedded product line release PCA which is sold as Green Travel 2.n.m, n > 0 is a maintained instance of the [PMTA](https://sameboat.network/personaleco) generic base.
- 2.2.0 WatchOS extension on iOS
- 2.3.0 Maintain trip histories in cloud
- 2.4.0 Group Aggregation
- 2.5.0 Reporting
The product line version, unlike the standalone 2.0.n series will have an evolving domain model. It will also be free but with feature sets - Roadmap for regular production Personal Carbon Accounting domain, PCA 1
that are available to users at different levels of [entitlement](https://eg.meansofproduction.biz/index.php/AKPERSON) in my domains,
vended in in the common domain content mgt app. - 1.1.0 [Product baseline](https://devops1.sameboat.network/sb-app)
- 1.2.0 Wearable extension
- 1.3.0 Maintain trip histories in cloud
- 1.4.0 Group Aggregation
- 1.5.0 Reporting
The product line version, unlike the standalone 2.0.n series will be based on the Domain Space App and so the semantic numbering resets.
It will also be free but with feature sets at higher levels of [entitlement](https://eg.meansofproduction.biz/eg/index.php/AKPERSON), vended in-app.
The product line source app will greatly expand upon the cause for being of the 2011 app which was to demonstrate working GPS (see below).
Motion/travel tracking remains the core function but there will be additional reusable infra for a number of purposes, in particular
wearable extensions. PCA 1 is an application of this new code which is available to entitled users of git.meansofproduction.biz.
2011 Stub App 2011 Stub App
============= =============
Original was just Android (4) and a proof of GPS. It still works on older Android as of 2021-08-16 but Original was Android (4) and a proof of GPS. It still works on older Android as of 2021-08-16 but
will not work with Android 10 due to the app menu button and its backfill the overflow menu will not work with Android 10 due to the app menu button and its backfill the overflow menu
button being completely removed. The latter is the three dots on the nav bar. It was button being completely removed. The latter is the three dots on the nav bar. It was
removed but was still accessible up to 9 either standardly or by a gesture, If you can't get to this removed but was still accessible up to 9 either standardly or by a gesture, If you can't get to this
@ -44,6 +51,6 @@
Note: going over the sources there are references to a PDF. This refers to the origins of the project. Note: going over the sources there are references to a PDF. This refers to the origins of the project.
An individual had taken on the task of making an application for NRDC Boston and got stuck on the GPS. An individual had taken on the task of making an application for NRDC Boston and got stuck on the GPS.
The PDF was what that app was supposed to do. I completed it up doing the basic thing it was supposed The PDF was what that app was supposed to do. I completed it up to doing the basic thing it was supposed
to do. to do.