fix: write timeseries directly when wheel's write_activity silently skips it
Diagnosed via on-device debug: build_timeseries produces 3271 points correctly, but the installed wheel's write_activity has a silent exception path that skips writing the timeseries file. The workaround calls build_timeseries directly and writes the file if missing. Also moves useTheme import to @/ThemeContext across all tab screens.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Tabs } from 'expo-router';
|
import { Tabs } from 'expo-router';
|
||||||
import { useTheme } from '@/theme';
|
import { useTheme } from '@/ThemeContext';
|
||||||
|
|
||||||
export default function TabLayout() {
|
export default function TabLayout() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|||||||
import { insertActivity } from '@/db/queries';
|
import { insertActivity } from '@/db/queries';
|
||||||
import { PyodideWebView } from '@/extraction/PyodideWebView';
|
import { PyodideWebView } from '@/extraction/PyodideWebView';
|
||||||
import { extractFile } from '@/extraction/extractActivity';
|
import { extractFile } from '@/extraction/extractActivity';
|
||||||
import { useTheme } from '@/theme';
|
import { useTheme } from '@/ThemeContext';
|
||||||
|
|
||||||
const FIT_EXTENSIONS = ['.fit', '.fit.gz'];
|
const FIT_EXTENSIONS = ['.fit', '.fit.gz'];
|
||||||
const OTHER_EXTENSIONS = ['.gpx', '.tcx', '.gpx.gz', '.tcx.gz'];
|
const OTHER_EXTENSIONS = ['.gpx', '.tcx', '.gpx.gz', '.tcx.gz'];
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useCallback, useState } from 'react';
|
|||||||
import { Alert, FlatList, Pressable, RefreshControl, StyleSheet, Text, View } from 'react-native';
|
import { Alert, FlatList, Pressable, RefreshControl, StyleSheet, Text, View } from 'react-native';
|
||||||
import { deleteActivities, useActivities, type ActivitySummary } from '@/db/queries';
|
import { deleteActivities, useActivities, type ActivitySummary } from '@/db/queries';
|
||||||
import { syncFeed } from '@/db/sync';
|
import { syncFeed } from '@/db/sync';
|
||||||
import { useTheme } from '@/theme';
|
import { useTheme } from '@/ThemeContext';
|
||||||
|
|
||||||
export default function FeedScreen() {
|
export default function FeedScreen() {
|
||||||
const db = useSQLiteContext();
|
const db = useSQLiteContext();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ActivityIndicator, Alert, Modal, Pressable, ScrollView, StyleSheet, Tex
|
|||||||
import Svg, { Defs, LinearGradient, Path, Stop } from 'react-native-svg';
|
import Svg, { Defs, LinearGradient, Path, Stop } from 'react-native-svg';
|
||||||
import { useSQLiteContext } from 'expo-sqlite';
|
import { useSQLiteContext } from 'expo-sqlite';
|
||||||
import { deleteActivity, useActivity, useSetting } from '@/db/queries';
|
import { deleteActivity, useActivity, useSetting } from '@/db/queries';
|
||||||
import { useTheme } from '@/theme';
|
import { useTheme } from '@/ThemeContext';
|
||||||
|
|
||||||
const MAP_STYLE = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';
|
const MAP_STYLE = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,13 @@ const PY_EXTRACT = [
|
|||||||
'ts_path = outdir / "activities" / (act_id + ".timeseries.json")',
|
'ts_path = outdir / "activities" / (act_id + ".timeseries.json")',
|
||||||
'geojson_path = outdir / "activities" / (act_id + ".geojson")',
|
'geojson_path = outdir / "activities" / (act_id + ".geojson")',
|
||||||
'',
|
'',
|
||||||
|
'# write_activity in the installed wheel silently skips timeseries — write it directly.',
|
||||||
|
'if not ts_path.exists():',
|
||||||
|
' from bincio.extract.timeseries import build_timeseries as _bts',
|
||||||
|
' _ts = _bts(activity.points, activity.started_at, "public")',
|
||||||
|
' if _ts.get("t"):',
|
||||||
|
' ts_path.write_text(json.dumps(_ts))',
|
||||||
|
'',
|
||||||
'json.dumps({',
|
'json.dumps({',
|
||||||
' "id": act_id,',
|
' "id": act_id,',
|
||||||
' "detail": json.loads(detail_path.read_text()),',
|
' "detail": json.loads(detail_path.read_text()),',
|
||||||
|
|||||||
Reference in New Issue
Block a user