diff --git a/SwimTracker/utility/TimeUtils.js b/SwimTracker/utility/TimeUtils.js
index cb34b27..328e1fd 100644
--- a/SwimTracker/utility/TimeUtils.js
+++ b/SwimTracker/utility/TimeUtils.js
@@ -1,9 +1,10 @@
import moment from 'moment/min/moment-with-locales';
+import {i18n} from './i18n';
-function timeSince(timeStamp, lang = 'de') {
- moment.locale(lang);
+function timeSince(timeStamp) {
+ moment.locale(i18n.locale);
const now = Math.floor((new Date()).getTime() / 1000);
const secondsPast = now - timeStamp;
@@ -23,7 +24,7 @@ function timeSince(timeStamp, lang = 'de') {
else if (timeStampDate.getDate() + 1 == dateNow.getDate())
dateStr = "Gestern, " + timeStampMoment.format("HH:mm");
else {
- dateStr = timeStampMoment.format("ddd, DD.MM.YY um HH:mm");
+ dateStr = timeStampMoment.format("llll");
}
return dateStr;
}
diff --git a/SwimTracker/utility/i18n.js b/SwimTracker/utility/i18n.js
index f16c998..b0d61b1 100644
--- a/SwimTracker/utility/i18n.js
+++ b/SwimTracker/utility/i18n.js
@@ -11,7 +11,8 @@ const translation_store = {
settings: "Settings",
lastSessions: "Last Sessions",
mainMenu_social: "Social",
- mainMenu_swimNow: "Swim now"
+ mainMenu_swimNow: "Swim now",
+ delete_session_button: "Delete",
},
de : {
connecting: "Verbindung aufbauen",
@@ -23,6 +24,7 @@ const translation_store = {
lastSessions: "Letzte Sessions",
mainMenu_social: "Freunde",
mainMenu_swimNow: "Jetzt schwimmen",
+ delete_session_button: "Löschen",
}
}
diff --git a/SwimTracker/views/LastSessionsView.js b/SwimTracker/views/LastSessionsView.js
index 522fa31..92829ab 100644
--- a/SwimTracker/views/LastSessionsView.js
+++ b/SwimTracker/views/LastSessionsView.js
@@ -55,7 +55,7 @@ function SessionCardBehindSwipe(props) {
style={sessionCardStyles.deleteButton}
onPress={props.onDelete}
>
- Löschen
+ {i18n.t('delete_session_button')}
);
@@ -137,9 +137,6 @@ function parsePropfind(text) {
const parser = new XMLParser();
const xmlDoc = parser.parseFromString(text);
- //const parser = new DOMParser();
- //const xmlDoc = parser.parseFromString(text, "text/xml");
-
const responses = xmlDoc.getElementsByTagName("D:response");
let result = [];
for (let i = 0; i < responses.length; ++i) {
@@ -183,6 +180,7 @@ async function getFullData(swimTrackerHost, analysisSettings) {
const da = new DataAnalysis();
e.analysis = da.analyze(analysisSettings, e.startTime, e.values);
}
+ console.log("full data", parsed);
return parsed;
}
@@ -203,9 +201,14 @@ class LastSessionsView extends React.Component {
render() {
const deleteSession = async sessionFileName => {
- this.setState({ sessions: null });
- await request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" });
- this.setState({ sessions: await getFullData(this.props.swimTrackerHost, this.props.analysisSettings) });
+ const filteredSession = this.state.sessions.filter((element) => element.name != sessionFileName);
+ this.setState({ sessions: filteredSession });
+ request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" })
+ .then((value) => console.log("Successfully deleted", sessionFileName, value))
+ .catch((err) => console.error("Failed to delete", sessionFileName, err));
+ //this.setState({ sessions: null });
+ //await request({ url: "http://" + this.props.swimTrackerHost + "/webdav/" + sessionFileName, method: "DELETE" });
+ //this.setState({ sessions: await getFullData(this.props.swimTrackerHost, this.props.analysisSettings) });
};
const onRefresh = async () => {
diff --git a/doc/environment-setup.md b/doc/environment-setup.md
index 08fa264..51ba062 100644
--- a/doc/environment-setup.md
+++ b/doc/environment-setup.md
@@ -21,7 +21,12 @@ as of 2023-09
`npx expo install react-native-web react-dom @expo/webpack-config`
-3. Install Dependencies
+3. Run
+------
+npx expo start -w
+
+
+4. Install Dependencies
-----------------------
use `npx expo install` instead of `yarn add` !
@@ -56,3 +61,8 @@ react-xml-parser
# Graph
react-native-svg
+# Time since
+
+
+# to be replaced
+react-native-swipe-list-view