Cleanup.
This commit is contained in:
parent
2376d4daba
commit
330b4bb721
|
@ -39,7 +39,7 @@ const GpxExport: React.FC<{ gpx: any }> = (props: { gpx: any }) => {
|
|||
const filenameToTest =
|
||||
i === 0 ? `${filename}.${extension}` : `${filename}(${i}).${extension}`;
|
||||
try {
|
||||
const statResult = await Filesystem.stat({
|
||||
await Filesystem.stat({
|
||||
path: filenameToTest,
|
||||
directory: Directory.Documents,
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Fragment, useEffect, useRef, useState } from 'react';
|
||||
import React, { Fragment, useRef, useState } from 'react';
|
||||
|
||||
import { useDB, useFind } from 'react-pouchdb';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Fragment, useEffect, useRef, useState } from 'react';
|
||||
import React, { Fragment, useEffect, useRef } from 'react';
|
||||
|
||||
import { useDB } from 'react-pouchdb';
|
||||
|
||||
|
@ -16,7 +16,7 @@ import {
|
|||
IonTitle,
|
||||
IonToolbar,
|
||||
} from '@ionic/react';
|
||||
import { options, text } from 'ionicons/icons';
|
||||
import { options } from 'ionicons/icons';
|
||||
import { enterAnimation, leaveAnimation } from '../../lib/animation';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { settingsActions, SettingsState } from '../../store/settings';
|
||||
|
@ -38,7 +38,7 @@ const Settings: React.FC<{}> = () => {
|
|||
} catch {}
|
||||
};
|
||||
initFromDb();
|
||||
}, []);
|
||||
}, [db, dispatch]);
|
||||
|
||||
const settingsState = useSelector(
|
||||
(state: { settings: SettingsState }) => state.settings
|
||||
|
@ -65,7 +65,7 @@ const Settings: React.FC<{}> = () => {
|
|||
};
|
||||
settingsFromRedux();
|
||||
}
|
||||
}, [settingsState]);
|
||||
}, [db, settingsState]);
|
||||
|
||||
const pseudo = useRef<HTMLIonInputElement>(null);
|
||||
const minTimeInterval = useRef<HTMLIonInputElement>(null);
|
||||
|
|
|
@ -10,12 +10,11 @@ import {
|
|||
IonItem,
|
||||
IonList,
|
||||
IonModal,
|
||||
IonSpinner,
|
||||
IonTitle,
|
||||
IonToolbar,
|
||||
} from '@ionic/react';
|
||||
import { trash } from 'ionicons/icons';
|
||||
import React, { Fragment, Suspense, useRef } from 'react';
|
||||
import React, { Fragment, useRef } from 'react';
|
||||
import { useFind, useDB } from 'react-pouchdb';
|
||||
import { deleteGps } from '../../db/gpx';
|
||||
import { enterAnimation, leaveAnimation } from '../../lib/animation';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Suspense } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import { useFind } from 'react-pouchdb';
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import TileServerChooserDialog from './TileServerChooserDialog';
|
|||
import TrackBrowser from './TracksBrowser';
|
||||
import Settings from './Settings';
|
||||
|
||||
const Map: react.FC<{}> = (props: {}) => {
|
||||
const Map: react.FC<{}> = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const resizeHandler = () => {
|
||||
|
|
|
@ -49,13 +49,11 @@ export const pushGpx = async (db: any, payload: any) => {
|
|||
for (var point in points) {
|
||||
const docPoint = { type: 'trkpt', gpx: _id, trkpt: points[point] };
|
||||
console.log(JSON.stringify(docPoint));
|
||||
const response = await db.post(docPoint);
|
||||
await db.post(docPoint);
|
||||
console.log(JSON.stringify(docPoint));
|
||||
}
|
||||
};
|
||||
|
||||
const CURRENT_GPX = '---current gpx---';
|
||||
|
||||
const initialGpx = {
|
||||
type: 'gpx',
|
||||
subtype: 'current',
|
||||
|
@ -187,6 +185,7 @@ export const getGpx = async (db: any, gpxId: string) => {
|
|||
);
|
||||
trkpts.map((trkptDoc: any) => {
|
||||
gpx.trk[0].trkseg[0].trkpt.push(trkptDoc.trkpt);
|
||||
return undefined;
|
||||
});
|
||||
return gpx;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import _, { constant } from 'lodash';
|
||||
import _ from 'lodash';
|
||||
import uri from '../lib/ids';
|
||||
|
||||
const dbDefinitionId = uri('dbdef', {});
|
||||
|
@ -74,7 +74,7 @@ export const initDb = async (db: any, setDbReady: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
for (var index of requiredIndexes) {
|
||||
for (index of requiredIndexes) {
|
||||
if (!findIndex(existingIndexes, index)) {
|
||||
// console.log(`db.createIndex(${JSON.stringify(index)})`);
|
||||
await db.createIndex({ name: index.name, ...index.def });
|
||||
|
|
Loading…
Reference in New Issue