Cleanup - removed old files
This commit is contained in:
parent
2d56390808
commit
3679f652ad
65
App.js
65
App.js
|
@ -3,16 +3,37 @@ import { AppLoading } from 'expo';
|
|||
import { Ionicons } from '@expo/vector-icons';
|
||||
import * as Font from 'expo-font';
|
||||
|
||||
// Redux
|
||||
// Redux + Storage
|
||||
import swimtrackerReducer from './state/Reducer';
|
||||
import { createStore } from 'redux';
|
||||
import { DeviceReduxCoupling } from './state/DeviceReduxCoupling';
|
||||
import { Provider } from 'react-redux';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import { persistStore, persistReducer } from 'redux-persist'
|
||||
import hardSet from 'redux-persist/lib/stateReconciler/hardSet'
|
||||
import { PersistGate } from 'redux-persist/integration/react'
|
||||
|
||||
import ThemedStackNavigation from './components/ThemedStackNavigation';
|
||||
import NewAppMain from "./components/NewAppMain";
|
||||
// Navigation
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
|
||||
const store = createStore(swimtrackerReducer);
|
||||
// Own views
|
||||
import MainMenuView from "./views/MainMenuView";
|
||||
import SettingsView from "./views/SettingsView";
|
||||
import TrainingView from "./views/TrainingView";
|
||||
import LastSessionsView from "./views/LastSessionsView";
|
||||
|
||||
|
||||
const persistConfig = {
|
||||
key: 'root',
|
||||
storage: AsyncStorage,
|
||||
stateReconciler: hardSet,
|
||||
};
|
||||
|
||||
const persistedReducer = persistReducer(persistConfig, swimtrackerReducer)
|
||||
const store = createStore(persistedReducer);
|
||||
const persistor = persistStore(store);
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
export default class App extends React.Component {
|
||||
constructor(props) {
|
||||
|
@ -36,15 +57,37 @@ export default class App extends React.Component {
|
|||
if (!this.state.isReady) {
|
||||
return <AppLoading />;
|
||||
}
|
||||
/*
|
||||
const screenOptions = {
|
||||
headerShown: false,
|
||||
};
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<ThemedStackNavigation />
|
||||
</Provider>
|
||||
);*/
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<NewAppMain />
|
||||
<PersistGate loading={<AppLoading />} persistor={persistor}>
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="Home">
|
||||
<Stack.Screen
|
||||
name="Home"
|
||||
component={MainMenuView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Settings"
|
||||
component={SettingsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Training"
|
||||
component={TrainingView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="LastSessions"
|
||||
component={LastSessionsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
</PersistGate>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
import React from 'react';
|
||||
import { Content, Card, CardItem, Body, Text, Button } from 'native-base';
|
||||
import { Image, ScrollView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { ConnState, startSession } from '../state/DeviceReduxCoupling';
|
||||
|
||||
function HomeView(props) {
|
||||
const buttonText = props.running ? "View Swim Session" : "Start swimming";
|
||||
|
||||
const onButtonPress = () => {
|
||||
if(!props.running) {
|
||||
props.dispatch(startSession());
|
||||
}
|
||||
props.navigation.navigate('Training')
|
||||
};
|
||||
|
||||
return (
|
||||
<Content padder contentContainerStyle={{ justifyContent: 'space-around', flex: 1, marginTop: 70 }}>
|
||||
<ScrollView styles={{ marginHorizontal: 20, paddingTop: 100 }} alwaysBounceHorizontal={true} alwaysBounceVertical={true}>
|
||||
<Card style={{ backgroundColor: "transparent" }}>
|
||||
<CardItem cardBody>
|
||||
<Image source={require('../assets/pool-water.jpg')} style={{ height: 100, width: null, flex: 1 }} />
|
||||
</CardItem>
|
||||
|
||||
<CardItem style={{backgroundColor: 'rgba(255, 255, 255, 0.6)'}}>
|
||||
<Body>
|
||||
<Button block onPress={onButtonPress}>
|
||||
<Text>{buttonText}</Text>
|
||||
</Button>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</Card>
|
||||
|
||||
<Card style={{ backgroundColor: "transparent" }}>
|
||||
<CardItem cardBody>
|
||||
<Image source={require('../assets/blue-water-background.jpg')} style={{ height: 100, width: null, flex: 1 }} />
|
||||
</CardItem>
|
||||
|
||||
<CardItem style={{backgroundColor: 'rgba(255, 255, 255, 0.6)'}}>
|
||||
<Body>
|
||||
<Button block >
|
||||
<Text>Settings</Text>
|
||||
</Button>
|
||||
</Body>
|
||||
</CardItem>
|
||||
</Card>
|
||||
</ScrollView>
|
||||
</Content>
|
||||
);
|
||||
}
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return { running: state.deviceState.connState === ConnState.CONNECTED_RUNNING };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(HomeView);
|
|
@ -1,82 +0,0 @@
|
|||
import React, { useRef, useState } from 'react';
|
||||
import { StyleSheet, Animated } from 'react-native';
|
||||
import { Button, Content, Text, View } from 'native-base';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import IconCard from './IconCard';
|
||||
import Graph from './Graph';
|
||||
import { connect } from 'react-redux';
|
||||
import backgroundColors from './Themes';
|
||||
import { useKeepAwake } from 'expo-keep-awake';
|
||||
import { stopSession } from '../state/DeviceReduxCoupling';
|
||||
import CycleView from './CycleView';
|
||||
|
||||
|
||||
function LiveTrainingView(props) {
|
||||
const analysis = props.session.analysis;
|
||||
const onStopClick = () => {
|
||||
props.dispatch(stopSession());
|
||||
props.navigation.navigate('Home');
|
||||
};
|
||||
const laps = (analysis.peaks.size / props.peaksPerLap).toFixed(1);
|
||||
const totalMomentum = Math.trunc(analysis.totalMomentum * props.kgFactor / 10 / 60);
|
||||
|
||||
const toTimeStr = seconds => {
|
||||
let minuteStr = String(Math.floor(seconds / 60));
|
||||
if(minuteStr.length < 2)
|
||||
minuteStr = "0" + minuteStr;
|
||||
let secondStr = String(Math.floor(seconds % 60));
|
||||
if(secondStr.length < 2)
|
||||
secondStr = "0" + secondStr;
|
||||
return minuteStr + ":" + secondStr;
|
||||
}
|
||||
console.log("Active", analysis.activeTime);
|
||||
useKeepAwake();
|
||||
|
||||
return (
|
||||
<LinearGradient
|
||||
colors={backgroundColors[props.theme]}
|
||||
start={[0, 0]}
|
||||
end={[0.5, 1]}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<Content padder contentContainerStyle={{ justifyContent: 'space-around', flex: 1, paddingTop: 60 }}>
|
||||
|
||||
<CycleView>
|
||||
<IconCard label="BAHNEN" value={laps} iconName="retweet" iconType="AntDesign" />
|
||||
<IconCard label="ZÜGE" value={analysis.peaks.size} iconName="dashboard" iconType="AntDesign" />
|
||||
</CycleView>
|
||||
|
||||
<CycleView>
|
||||
<IconCard label="DAUER" value={toTimeStr(analysis.totalTime)} iconName="clock" iconType="FontAwesome5" />
|
||||
<IconCard label="AKTIVE DAUER" value={toTimeStr(analysis.activeTime)} iconName="stopwatch" iconType="FontAwesome5" />
|
||||
</CycleView>
|
||||
<IconCard label="KRAFT" value={totalMomentum} iconName="ruler" iconType="Entypo" />
|
||||
|
||||
<Graph></Graph>
|
||||
<Button block secondary onPress={onStopClick}><Text>Stop</Text></Button>
|
||||
</Content>
|
||||
</LinearGradient>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
card: {
|
||||
flexDirection: 'row',
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
||||
margin: 5,
|
||||
padding: 5,
|
||||
borderRadius: 3,
|
||||
justifyContent: 'space-between',
|
||||
}
|
||||
});
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
session: state.deviceState,
|
||||
peaksPerLap: state.settings.analysis.peaksPerLap,
|
||||
theme: state.settings.theme,
|
||||
kgFactor: state.settings.analysis.kgFactor,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(LiveTrainingView);
|
|
@ -1,46 +0,0 @@
|
|||
import React from 'react';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
|
||||
// Own views
|
||||
import MainMenuView from "../views/MainMenuView";
|
||||
import SettingsView from "../views/SettingsView";
|
||||
import TrainingView from "../views/TrainingView";
|
||||
import LastSessionsView from "../views/LastSessionsView";
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
function NewAppMain(props) {
|
||||
|
||||
const screenOptions = {
|
||||
headerShown: false,
|
||||
}
|
||||
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="Home">
|
||||
<Stack.Screen
|
||||
name="Home"
|
||||
component={MainMenuView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Settings"
|
||||
component={SettingsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Training"
|
||||
component={TrainingView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="LastSessions"
|
||||
component={LastSessionsView}
|
||||
options={screenOptions}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
)
|
||||
};
|
||||
|
||||
export default NewAppMain;
|
|
@ -1,70 +0,0 @@
|
|||
import React from 'react';
|
||||
import { LinearGradient } from 'expo-linear-gradient';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import backgroundColors from './Themes';
|
||||
|
||||
// Own views
|
||||
import LiveTrainingView from './LiveTrainingView';
|
||||
import HomeView from './HomeView';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
|
||||
function ThemedStackNavigation(props) {
|
||||
|
||||
const screenOptions = {
|
||||
cardStyle: {
|
||||
backgroundColor: "transparent",
|
||||
opacity: 1
|
||||
},
|
||||
headerTransparent: "true",
|
||||
headerTitleStyle: {
|
||||
color: 'white',
|
||||
fontWeight: 'bold',
|
||||
fontSize: 20,
|
||||
},
|
||||
headerTintColor: "white",
|
||||
headerBackground: () => (
|
||||
<BlurView
|
||||
tint="dark"
|
||||
intensity={30}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
return (
|
||||
<LinearGradient
|
||||
colors={backgroundColors[props.themeName]}
|
||||
start={[0, 0]}
|
||||
end={[0.5, 1]}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator initialRouteName="Home">
|
||||
<Stack.Screen
|
||||
name="Home"
|
||||
component={HomeView}
|
||||
options={{ ...screenOptions, headerTitle: "SwimTracker" }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="Training"
|
||||
component={LiveTrainingView}
|
||||
options={{ ...screenOptions, headerTitle: "Training" }}
|
||||
/>
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
</LinearGradient>
|
||||
)
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return { themeName: state.settings.theme };
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(ThemedStackNavigation);
|
|
@ -1,10 +0,0 @@
|
|||
|
||||
const backgroundColors = {
|
||||
'hot': ['#830e5f', '#fd5139'],
|
||||
'darkBlue': ['#4265a3', '#cfada7'],
|
||||
//'lightBlue': ['#50a4db', '#74bbe2'],
|
||||
'lightBlue': ['#24acdc ', '#65fae6'],
|
||||
'foggy': ['#bc8db8', '#5d5e90'],
|
||||
};
|
||||
|
||||
export default backgroundColors;
|
|
@ -1603,6 +1603,14 @@
|
|||
"@types/yargs": "^13.0.0"
|
||||
}
|
||||
},
|
||||
"@react-native-community/async-storage": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/async-storage/-/async-storage-1.12.0.tgz",
|
||||
"integrity": "sha512-y3zVxuVyiOxI8TXrvajmYfDbIt2vFNxzV5MiA28v15DQTxDk6uJH3rpc9my+la7u2Tiwt3PpdU2+59ZgZ4h7wA==",
|
||||
"requires": {
|
||||
"deep-assign": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@react-native-community/cli-debugger-ui": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-3.0.0.tgz",
|
||||
|
@ -8241,6 +8249,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"redux-persist": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-6.0.0.tgz",
|
||||
"integrity": "sha512-71LLMbUq2r02ng2We9S215LtPu3fY0KgaGE0k8WRgl6RkqxtGfl7HUozz1Dftwsb0D/5mZ8dwAaPbtnzfvbEwQ=="
|
||||
},
|
||||
"regenerate": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/async-storage": "^1.12.0",
|
||||
"@react-native-community/masked-view": "0.1.6",
|
||||
"@react-navigation/native": "^5.4.2",
|
||||
"@react-navigation/stack": "^5.3.9",
|
||||
|
@ -44,7 +45,8 @@
|
|||
"react-redux": "^7.2.0",
|
||||
"react-xml-parser": "^1.1.6",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"redux": "^4.0.5"
|
||||
"redux": "^4.0.5",
|
||||
"redux-persist": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-expo": "^8.1.0",
|
||||
|
|
|
@ -8,11 +8,11 @@ import {
|
|||
TouchableOpacity,
|
||||
RefreshControl,
|
||||
} from "react-native";
|
||||
import themeColors from './themeColors';
|
||||
import themeColors from '../components/themeColors';
|
||||
import EntypoIcon from "react-native-vector-icons/Entypo";
|
||||
import AntDesignIcon from "react-native-vector-icons/AntDesign";
|
||||
import FaIcon from "react-native-vector-icons/FontAwesome5";
|
||||
import ImageHeader from "./ImageHeader";
|
||||
import ImageHeader from "../components/ImageHeader";
|
||||
import { SwipeListView } from 'react-native-swipe-list-view';
|
||||
import { connect } from 'react-redux';
|
||||
import request from '../utility/PromiseRequest';
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
Text,
|
||||
TouchableOpacity,
|
||||
} from "react-native";
|
||||
import themeColors from './themeColors';
|
||||
import themeColors from '../components/themeColors';
|
||||
import MaterialIcon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import EntypoIcon from "react-native-vector-icons/Entypo";
|
||||
|
||||
|
|
|
@ -4,17 +4,14 @@ import {
|
|||
View,
|
||||
StatusBar,
|
||||
TextInput,
|
||||
ImageBackground,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
SafeAreaView,
|
||||
Slider,
|
||||
Switch,
|
||||
} from "react-native";
|
||||
import themeColors from './themeColors';
|
||||
import themeColors from '../components/themeColors';
|
||||
import MaterialIcon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import EntypoIcon from "react-native-vector-icons/Entypo";
|
||||
import ImageHeader from "./ImageHeader";
|
||||
import ImageHeader from "../components/ImageHeader";
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import React, { Component } from "react";
|
||||
import React from "react";
|
||||
import {
|
||||
StyleSheet,
|
||||
View,
|
||||
StatusBar,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
SafeAreaView
|
||||
TouchableOpacity
|
||||
} from "react-native";
|
||||
import themeColors from './themeColors';
|
||||
import themeColors from '../components/themeColors';
|
||||
import EntypoIcon from "react-native-vector-icons/Entypo";
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
|
|
Loading…
Reference in New Issue