Colota - Android GPS Location tracker
refactor(logging): turn the log file actions into rows and read the log oldest to newest (#873)
Max Dietrich41c11bdee580
diff --git a/apps/docs/docs/guides/troubleshooting.md b/apps/docs/docs/guides/troubleshooting.mdindex 283000cd..949baec8 100644--- a/apps/docs/docs/guides/troubleshooting.md+++ b/apps/docs/docs/guides/troubleshooting.md@@ -76,7 +76,7 @@ If **Test connection** reads **Not reachable**, the sentence under it points at1. Open **Settings > Logging** and turn on **Record a log file**2. Use the app until the problem happens again. Recording keeps going across restarts, so this can take days-3. Come back and tap **Save log file...** - pick a folder+3. Come back and tap **Save log file** - pick a folder4. Open a bug report at [github.com/dietrichmax/colota/issues](https://github.com/dietrichmax/colota/issues/new) and attach the saved `colota-log-*.txt`Step 2 is the one people skip. A log saved without reproducing the problem contains everything except the thing being reported.@@ -85,7 +85,7 @@ The saved file is one timeline: your app version, flavor and device at the top,### Reading it first-**Read the log** opens a preview of the most recent lines, newest first. Search filters on the message, and the chips set the lowest level shown, each carrying its own count so you can see there are four errors without selecting Errors.+**Read the log** opens a preview of the most recent lines. Search filters on the message, and the chips set the lowest level shown, each carrying its own count so you can see there are four errors without selecting Errors.The preview shows the recorded file while recording is on, and the system log's last few minutes while it is off. It shows the most recent lines only, so a long capture holds far more than you can read here.diff --git a/apps/mobile/src/screens/LogPreviewScreen.tsx b/apps/mobile/src/screens/LogPreviewScreen.tsxindex e4dbe24e..27a4d47f 100644--- a/apps/mobile/src/screens/LogPreviewScreen.tsx+++ b/apps/mobile/src/screens/LogPreviewScreen.tsx@@ -4,10 +4,21 @@*/import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react"-import { ActivityIndicator, FlatList, Pressable, StyleSheet, Text, TextInput, View } from "react-native"+import {+ ActivityIndicator,+ FlatList,+ Pressable,+ StyleSheet,+ Text,+ TextInput,+ View,+ type NativeScrollEvent,+ type NativeSyntheticEvent+} from "react-native"import { useFocusEffect } from "@react-navigation/native"-import { FileSearch, RefreshCw, Search, X } from "lucide-react-native"+import { ArrowDown, FileSearch, RefreshCw, Search, X } from "lucide-react-native"import { ChipGroup, Container, Divider, EmptyState, HeaderAction } from "../components"+import { MapActionButton } from "../components/features/map/MapActionButton"import { useTheme } from "../hooks/useTheme"import { useTimeout } from "../hooks/useTimeout"import NativeLocationService from "../services/NativeLocationService"@@ -71,6 +82,8 @@ export function LogPreviewScreen({ navigation }: ScreenProps) {const [floor, setFloor] = useState<LogFloor>(DEFAULT_LOG_FLOOR)const loadRef = useRef(false)+ const listRef = useRef<FlatList<MergedLogEntry>>(null)+ const [awayFromNewest, setAwayFromNewest] = useState(false)const load = useCallback(async () => {if (loadRef.current) return@@ -80,7 +93,7 @@ export function LogPreviewScreen({ navigation }: ScreenProps) {getMergedLogs(),NativeLocationService.getSetting("debugFileLoggingEnabled", "false")])- // Newest first: what the reporter just reproduced is what they came to read.+ // Newest first into an inverted list, which reads oldest to newest and opens on the newest line.setEntries(merged.slice().reverse())setFromFile(enabled === "true")} catch (err) {@@ -122,6 +135,14 @@ export function LogPreviewScreen({ navigation }: ScreenProps) {[debounce])+ const handleScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {+ setAwayFromNewest(event.nativeEvent.contentOffset.y > size.row)+ }, [])++ const jumpToNewest = useCallback(() => {+ listRef.current?.scrollToOffset({ offset: 0, animated: true })+ }, [])+const clear = useCallback(() => {debounce.clear()setText("")@@ -196,19 +217,40 @@ export function LogPreviewScreen({ navigation }: ScreenProps) {</View><Divider tight />- <FlatList- data={shown}- keyExtractor={(entry) => entry.id}- renderItem={({ item }) => <LogLine entry={item} />}- contentContainerStyle={styles.list}- initialNumToRender={30}- maxToRenderPerBatch={20}- windowSize={11}- showsVerticalScrollIndicator- ListEmptyComponent={- <EmptyState icon={FileSearch} title="No lines match" hint="Try a different word, or lower the level." />- }- />+ {shown.length === 0 ? (+ <EmptyState icon={FileSearch} title="No lines match" hint="Try a different word, or lower the level." />+ ) : (+ <View style={styles.listArea}>+ <FlatList+ ref={listRef}+ testID="log-list"+ data={shown}+ inverted+ keyExtractor={(entry) => entry.id}+ renderItem={({ item }) => <LogLine entry={item} />}+ contentContainerStyle={styles.list}+ initialNumToRender={30}+ maxToRenderPerBatch={20}+ windowSize={11}+ onScroll={handleScroll}+ scrollEventThrottle={100}+ showsVerticalScrollIndicator+ />+ {awayFromNewest ? (+ <View style={styles.jump}>+ <MapActionButton+ anchored={false}+ accessibilityRole="button"+ accessibilityLabel="Jump to the newest line"+ onPress={jumpToNewest}+ testID="jump-to-newest-btn"+ >+ <ArrowDown size={size.icon.md} color={colors.text} />+ </MapActionButton>+ </View>+ ) : null}+ </View>+ )}</Container>)}@@ -245,10 +287,18 @@ const styles = StyleSheet.create({fontVariant: ["tabular-nums"],paddingVertical: space.sm},+ listArea: {+ flex: 1+ },+ // Inverted, so the top padding is drawn under the newest line and keeps it clear of the jump button.list: {- paddingVertical: space.sm,- paddingBottom: space.xxl,- flexGrow: 1+ paddingTop: space.xxl,+ paddingBottom: space.sm+ },+ jump: {+ position: "absolute",+ end: space.lg,+ bottom: space.lg},line: {flexDirection: "row",diff --git a/apps/mobile/src/screens/LoggingScreen.tsx b/apps/mobile/src/screens/LoggingScreen.tsxindex 317ec468..fda91f57 100644--- a/apps/mobile/src/screens/LoggingScreen.tsx+++ b/apps/mobile/src/screens/LoggingScreen.tsx@@ -4,11 +4,10 @@*/import React, { useCallback, useRef, useState } from "react"-import { ScrollView, StyleSheet, Text, View } from "react-native"+import { ScrollView, StyleSheet, View } from "react-native"import { useFocusEffect } from "@react-navigation/native"-import { FileSearch, Save, Trash2 } from "lucide-react-native"+import { FileSearch, FileText, FileX, Trash2, Upload } from "lucide-react-native"import {- Button,Card,Container,Divider,@@ -16,6 +15,7 @@ import {ListItem,SectionTitle,SettingRow,+ SpinningLoader,StateLine,Toggle} from "../components"@@ -34,14 +34,11 @@ import {nextStepLine,previewRowSub} from "../utils/logCapture"-import { fonts, fontSizes, lineHeights } from "../styles/typography"import { LOG_SIZE_SETTLE_MS, space } from "../constants"import type { ScreenProps } from "../types/global"type Busy = "save" | "delete" | null-const INTRO = "Start recording, reproduce the problem, then save the log file and attach it to your report."-export function LoggingScreen({ navigation }: ScreenProps) {const { colors } = useTheme()const settle = useTimeout()@@ -158,8 +155,6 @@ export function LoggingScreen({ navigation }: ScreenProps) {return (<Container><ScrollView contentContainerStyle={styles.scrollContent}>- <Text style={[styles.intro, { color: colors.textSecondary }]}>{INTRO}</Text>-{!loaded ? null : (<><View style={styles.section}>@@ -196,29 +191,30 @@ export function LoggingScreen({ navigation }: ScreenProps) {{bytes > 0 ? (<View style={styles.section}><SectionTitle>The log file</SectionTitle>- <View>- <Button- icon={Save}- title="Save log file…"- testID="save-log-btn"- loading={busy === "save"}- disabled={busy !== null}+ <Card rows>+ <ListItem+ testID="save-log-row"+ icon={FileText}+ trailingIcon={busy === "save" ? SpinningLoader : Upload}+ label="Save log file"+ sub={busy === "save" ? "Saving…" : "To a folder you pick"}+ accessibilityHint="Asks you to confirm, then saves the file"+ disabled={busy === "save" ? false : busy !== null}onPress={handleSave}/>- <FieldMessage variant="warning">{LOG_CONTENTS_LINE}</FieldMessage>- </View>- <View>- <Button- icon={Trash2}- variant="danger"- title="Delete the log file"- testID="delete-log-btn"- loading={busy === "delete"}- disabled={busy !== null}+ <Divider tight inset />+ <ListItem+ testID="delete-log-row"+ icon={FileX}+ trailingIcon={busy === "delete" ? SpinningLoader : Trash2}+ label="Delete the log file"+ sub={busy === "delete" ? "Deleting…" : deleteSub(bytes, enabled)}+ subLines={2}+ accessibilityHint="Asks you to confirm, then deletes"+ disabled={busy === "delete" ? false : busy !== null}onPress={handleDelete}/>- <FieldMessage>{deleteSub(bytes, enabled)}</FieldMessage>- </View>+ </Card></View>) : null}</>@@ -234,12 +230,6 @@ const styles = StyleSheet.create({paddingTop: space.lg,paddingBottom: space.xxl},- intro: {- fontSize: fontSizes.body,- ...fonts.regular,- lineHeight: lineHeights.body,- marginBottom: space.lg- },section: {marginBottom: space.xl}diff --git a/apps/mobile/src/screens/OfflineMapsScreen.tsx b/apps/mobile/src/screens/OfflineMapsScreen.tsxindex f26993da..3dee4610 100644--- a/apps/mobile/src/screens/OfflineMapsScreen.tsx+++ b/apps/mobile/src/screens/OfflineMapsScreen.tsx@@ -4,7 +4,7 @@*/import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"-import { ActivityIndicator, ScrollView, StyleSheet, Text, useWindowDimensions, View } from "react-native"+import { ActivityIndicator, ScrollView, StyleSheet, useWindowDimensions, View } from "react-native"import type { NativeSyntheticEvent } from "react-native"import { GeoJSONSource, Layer, type PressEventWithFeatures } from "@maplibre/maplibre-react-native"import { useFocusEffect } from "@react-navigation/native"@@ -20,6 +20,7 @@ import {IconButton,ListItem,SectionTitle,+ StateLine,TextField} from "../components"import { ColotaMapView, type ColotaMapRef, type RegionChangePayload } from "../components/features/map/ColotaMapView"@@ -56,7 +57,6 @@ import {downloadConfirm,downloadLine,duplicateNameError,- INTRO_LINE,progressCaption,redownloadConfirm,ROW_HINT,@@ -65,7 +65,6 @@ import {type Estimate,type RowTone} from "../utils/offlineArea"-import { fonts, fontSizes, lineHeights } from "../styles/typography"import {DEFAULT_MAP_ZOOM,GEOFENCE_ZOOM_PADDING,@@ -530,8 +529,6 @@ export function OfflineMapsScreen({}: ScreenProps) {</View><ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">- <Text style={[styles.intro, { color: colors.textSecondary }]}>{INTRO_LINE}</Text>-<View style={styles.section}><SectionTitle>New area</SectionTitle><Card>@@ -557,22 +554,28 @@ export function OfflineMapsScreen({}: ScreenProps) {<FieldMessage variant={estimate?.large ? "warning" : "info"}>{downloadLine(estimate, name)}</FieldMessage></View>) : (- <View>- <View style={styles.progressHeader}>- <ActivityIndicator size="small" color={colors.primary} />- <Text style={[styles.progressLabel, { color: colors.text }]}>Downloading {download.name}</Text>- </View>- <View- testID="download-progress"- accessible- accessibilityRole="progressbar"- accessibilityLabel={`Downloading ${download.name}`}- accessibilityValue={{ min: 0, max: 100, now: Math.round(pct) }}- style={[styles.progressTrack, { backgroundColor: colors.well }]}- >- <View style={[styles.progressFill, { backgroundColor: colors.primary, width: `${pct}%` }]} />- </View>- <FieldMessage>{progressCaption(downloadProgress)}</FieldMessage>+ <>+ <Card rows style={styles.progressCard}>+ <StateLine+ icon={<ActivityIndicator size="small" color={colors.primary} />}+ iconColor={colors.primary}+ label={download.name}+ caption={progressCaption(downloadProgress)}+ testID="download-state"+ />+ <View style={styles.progressBody}>+ <View+ testID="download-progress"+ accessible+ accessibilityRole="progressbar"+ accessibilityLabel={`Downloading ${download.name}`}+ accessibilityValue={{ min: 0, max: 100, now: Math.round(pct) }}+ style={[styles.progressTrack, { backgroundColor: colors.well }]}+ >+ <View style={[styles.progressFill, { backgroundColor: colors.primary, width: `${pct}%` }]} />+ </View>+ </View>+ </Card><ButtontestID="cancel-download-btn"variant="ghost"@@ -583,7 +586,7 @@ export function OfflineMapsScreen({}: ScreenProps) {disabled={busy !== null}onPress={handleCancelDownload}/>- </View>+ </>)}</View>@@ -669,25 +672,14 @@ const styles = StyleSheet.create({paddingTop: space.lg,paddingBottom: space.xxl},- intro: {- fontSize: fontSizes.body,- ...fonts.regular,- lineHeight: lineHeights.body,- marginBottom: space.lg- },section: {marginBottom: space.xl},- progressHeader: {- flexDirection: "row",- alignItems: "center",- gap: space.md,- marginTop: space.lg,- marginBottom: space.md+ progressCard: {+ marginTop: space.md},- progressLabel: {- fontSize: fontSizes.body,- ...fonts.semiBold+ progressBody: {+ paddingBottom: space.lg},progressTrack: { height: 6, borderRadius: radius.pill, overflow: "hidden" },progressFill: { height: "100%" },diff --git a/apps/mobile/src/screens/__tests__/LogPreviewScreen.test.tsx b/apps/mobile/src/screens/__tests__/LogPreviewScreen.test.tsxindex 6db7942f..5edac16d 100644--- a/apps/mobile/src/screens/__tests__/LogPreviewScreen.test.tsx+++ b/apps/mobile/src/screens/__tests__/LogPreviewScreen.test.tsx@@ -1,5 +1,6 @@import React from "react"import { render, fireEvent, waitFor, act } from "@testing-library/react-native"+import { FlatList } from "react-native"jest.mock("@react-navigation/native", () => ({useFocusEffect: (cb: () => (() => void) | void) => {@@ -99,15 +100,28 @@ afterEach(() => {})describe("what the preview shows", () => {- // What the reporter just reproduced is what they came to read, and descending order needs no- // auto-stick, no scroll-to-end control and no measurement of variable-height rows.- it("puts the most recent line first", async () => {+ // The list is inverted over newest-first data, so it reads oldest to newest and opens on the newest line.+ it("reads oldest to newest and opens on the newest line", async () => {const api = renderScreen()await waitFor(() => expect(api.getByTestId("log-result-line")).toBeTruthy())- const messages = api.getAllByText(/SyncManager|NetworkManager/).map((n) => n.props.children)- expect(messages[0]).toBe("NetworkManager: connect timeout")- expect(messages[messages.length - 1]).toBe("SyncManager: periodic sync stopped")+ const list = api.UNSAFE_getByType(FlatList)+ expect(list.props.inverted).toBe(true)+ expect(list.props.data[0].message).toBe("NetworkManager: connect timeout")+ expect(list.props.data[list.props.data.length - 1].message).toBe("SyncManager: periodic sync stopped")+ })++ it("offers a jump to the newest line only once the reader has scrolled up", async () => {+ const scrollToOffset = jest.spyOn(FlatList.prototype, "scrollToOffset").mockImplementation(() => {})+ const api = renderScreen()+ await waitFor(() => expect(api.getByTestId("log-result-line")).toBeTruthy())+ expect(api.queryByTestId("jump-to-newest-btn")).toBeNull()++ fireEvent.scroll(api.UNSAFE_getByType(FlatList), { nativeEvent: { contentOffset: { x: 0, y: 800 } } })+ fireEvent.press(api.getByTestId("jump-to-newest-btn"))++ expect(scrollToOffset).toHaveBeenCalledWith({ offset: 0, animated: true })+ scrollToOffset.mockRestore()})// This previews what is being sent, so a default that hides most of the file misrepresents thediff --git a/apps/mobile/src/screens/__tests__/LoggingScreen.test.tsx b/apps/mobile/src/screens/__tests__/LoggingScreen.test.tsxindex c3b87c8d..99152584 100644--- a/apps/mobile/src/screens/__tests__/LoggingScreen.test.tsx+++ b/apps/mobile/src/screens/__tests__/LoggingScreen.test.tsx@@ -73,27 +73,22 @@ jest.mock("../../components", () => {R.createElement(Text, { accessibilityValue: { text: variant ?? "info" } }, children),SettingRow: ({ label, hint, children }: any) =>R.createElement(View, null, R.createElement(Text, null, label), R.createElement(Text, null, hint), children),- ListItem: ({ label, sub, onPress, testID }: any) =>- R.createElement(- Pressable,- { testID, onPress },- R.createElement(Text, null, label),- R.createElement(Text, null, sub)- ),- Toggle: ({ value, onValueChange, testID, accessibilityLabel }: any) =>- R.createElement(Pressable, { testID, accessibilityLabel, onPress: () => onValueChange(!value) }),- Button: ({ title, onPress, disabled, testID, loading, variant }: any) =>+ SpinningLoader: Object.assign(() => null, { displayName: "SpinningLoader" }),+ ListItem: ({ label, sub, onPress, testID, disabled, trailingIcon }: any) =>R.createElement(Pressable,{testID,onPress,disabled,- accessibilityState: { disabled: !!disabled, busy: !!loading },- accessibilityValue: { text: variant ?? "primary" }+ accessibilityState: { disabled: !!disabled },+ accessibilityValue: { text: trailingIcon?.displayName ?? "chevron" }},- R.createElement(Text, null, title)- )+ R.createElement(Text, null, label),+ R.createElement(Text, null, sub)+ ),+ Toggle: ({ value, onValueChange, testID, accessibilityLabel }: any) =>+ R.createElement(Pressable, { testID, accessibilityLabel, onPress: () => onValueChange(!value) })}})@@ -129,13 +124,6 @@ afterEach(() => {})describe("what the screen says on arrival", () => {- it("opens on the three steps, in the order a reporter does them", async () => {- const api = renderScreen()- await waitFor(() => expect(api.getByTestId("capture-state")).toBeTruthy())-- expect(api.getByText(/Start recording, reproduce the problem, then save the log file/)).toBeTruthy()- })-it("reports the capture and what it has written", async () => {const api = renderScreen()@@ -151,7 +139,7 @@ describe("what the screen says on arrival", () => {const api = renderScreen()expect(api.queryByTestId("capture-state")).toBeNull()- expect(api.queryByTestId("save-log-btn")).toBeNull()+ expect(api.queryByTestId("save-log-row")).toBeNull()})})@@ -163,17 +151,39 @@ describe("the actions", () => {const api = renderScreen()await waitFor(() => expect(api.getByTestId("capture-state")).toBeTruthy())- expect(api.queryByTestId("save-log-btn")).toBeNull()- expect(api.queryByTestId("delete-log-btn")).toBeNull()+ expect(api.queryByTestId("save-log-row")).toBeNull()+ expect(api.queryByTestId("delete-log-row")).toBeNull()expect(api.getByText(/Leave this on while you reproduce the problem/)).toBeTruthy()})+ it("spins the running row, keeps it enabled and locks the other one", async () => {+ mockExportFileLogToUri.mockReturnValue(new Promise(() => {}))+ const api = renderScreen()+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())++ await act(async () => {+ fireEvent.press(api.getByTestId("save-log-row"))+ })++ await waitFor(() => expect(api.getByText("Saving…")).toBeTruthy())+ const save = api.getByTestId("save-log-row")+ expect(save.props.accessibilityValue.text).toBe("SpinningLoader")+ expect(save.props.accessibilityState.disabled).toBe(false)+ expect(api.getByTestId("delete-log-row").props.accessibilityValue.text).toBe("Trash2")+ expect(api.getByTestId("delete-log-row").props.accessibilityState.disabled).toBe(true)++ await act(async () => {+ fireEvent.press(save)+ })+ expect(mockExportFileLogToUri).toHaveBeenCalledTimes(1)+ })+it("names what leaves the device before the folder picker opens", async () => {const api = renderScreen()- await waitFor(() => expect(api.getByTestId("save-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("save-log-btn"))+ fireEvent.press(api.getByTestId("save-log-row"))})expect(mockShowConfirm).toHaveBeenCalledWith(@@ -188,10 +198,10 @@ describe("the actions", () => {// the attached file carries no version, no flavor, no device and no JS line at all.it("hands native the header and the app log to merge in", async () => {const api = renderScreen()- await waitFor(() => expect(api.getByTestId("save-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("save-log-btn"))+ fireEvent.press(api.getByTestId("save-log-row"))})expect(mockExportFileLogToUri).toHaveBeenCalledWith("content://tree/logs", "HEADER\n", "APPLOG\n")@@ -201,10 +211,10 @@ describe("the actions", () => {it("does not report a save when the picker was dismissed", async () => {mockPickExportDirectory.mockResolvedValue(null)const api = renderScreen()- await waitFor(() => expect(api.getByTestId("save-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("save-log-btn"))+ fireEvent.press(api.getByTestId("save-log-row"))})expect(mockExportFileLogToUri).not.toHaveBeenCalled()@@ -214,10 +224,10 @@ describe("the actions", () => {it("says so when there was nothing recorded to write", async () => {mockExportFileLogToUri.mockResolvedValue(null)const api = renderScreen()- await waitFor(() => expect(api.getByTestId("save-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("save-log-btn"))+ fireEvent.press(api.getByTestId("save-log-row"))})expect(mockShowAlert).toHaveBeenCalledWith("Nothing to save", expect.any(String), "info")@@ -227,10 +237,10 @@ describe("the actions", () => {it("alerts when the save fails", async () => {mockExportFileLogToUri.mockRejectedValue(new Error("Could not create document"))const api = renderScreen()- await waitFor(() => expect(api.getByTestId("save-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("save-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("save-log-btn"))+ fireEvent.press(api.getByTestId("save-log-row"))})expect(mockShowAlert).toHaveBeenCalledWith("Could not save the log", "Could not create document", "error")@@ -238,10 +248,10 @@ describe("the actions", () => {it("names the size it is about to delete, and asks first", async () => {const api = renderScreen()- await waitFor(() => expect(api.getByTestId("delete-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("delete-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("delete-log-btn"))+ fireEvent.press(api.getByTestId("delete-log-row"))})expect(mockShowConfirm).toHaveBeenCalledWith(@@ -253,10 +263,10 @@ describe("the actions", () => {it("deletes nothing when the confirmation is dismissed", async () => {mockShowConfirm.mockResolvedValue(false)const api = renderScreen()- await waitFor(() => expect(api.getByTestId("delete-log-btn")).toBeTruthy())+ await waitFor(() => expect(api.getByTestId("delete-log-row")).toBeTruthy())await act(async () => {- fireEvent.press(api.getByTestId("delete-log-btn"))+ fireEvent.press(api.getByTestId("delete-log-row"))})expect(mockClearFileLog).not.toHaveBeenCalled()@@ -306,7 +316,7 @@ describe("the reader", () => {const api = renderScreen()await waitFor(() => expect(api.getByTestId("nav-log-preview")).toBeTruthy())- expect(api.getByText("The log file's most recent lines, newest first")).toBeTruthy()+ expect(api.getByText("The log file's most recent lines")).toBeTruthy()fireEvent.press(api.getByTestId("nav-log-preview"))expect(mockNavigation.navigate).toHaveBeenCalledWith("Log Preview")})@@ -316,6 +326,6 @@ describe("the reader", () => {const api = renderScreen()await waitFor(() => expect(api.getByTestId("nav-log-preview")).toBeTruthy())- expect(api.getByText("The system log's last few minutes, newest first")).toBeTruthy()+ expect(api.getByText("The system log's last few minutes")).toBeTruthy()})})diff --git a/apps/mobile/src/screens/__tests__/OfflineMapsScreen.test.tsx b/apps/mobile/src/screens/__tests__/OfflineMapsScreen.test.tsxindex d072fce7..9a49566d 100644--- a/apps/mobile/src/screens/__tests__/OfflineMapsScreen.test.tsx+++ b/apps/mobile/src/screens/__tests__/OfflineMapsScreen.test.tsx@@ -1,6 +1,6 @@import React from "react"import { Dimensions, StyleSheet } from "react-native"-import { render, fireEvent, waitFor, act } from "@testing-library/react-native"+import { render, fireEvent, waitFor, act, within } from "@testing-library/react-native"import { lightColors } from "@colota/shared"import { GEOFENCE_ZOOM_PADDING, MAP_ANIMATION_DURATION_MS } from "../../constants"@@ -140,6 +140,8 @@ jest.mock("../../components", () => {return {Container: ({ children }: any) => R.createElement(View, null, children),Card: ({ children }: any) => R.createElement(View, null, children),+ StateLine: ({ label, caption, testID }: any) =>+ R.createElement(View, { testID }, R.createElement(Text, null, label), R.createElement(Text, null, caption)),SectionTitle: ({ children }: any) => R.createElement(Text, null, children),Divider: () => null,TextField: stubs.TextFieldStub,@@ -390,8 +392,8 @@ describe("starting a download", () => {expect.any(Function),expect.any(Function))- expect(api.getByText("Downloading my park")).toBeTruthy()- expect(api.getByText("Starting…")).toBeTruthy()+ expect(within(api.getByTestId("download-state")).getByText("my park")).toBeTruthy()+ expect(api.getByText("Starting download…")).toBeTruthy()expect(mapBox(api).borderColor).toBe(lightColors.primary)await act(async () => finish())@@ -419,7 +421,7 @@ describe("starting a download", () => {await act(async () => progressOf()(status(42, { completedResourceSize: 5_347_737 })))expect(api.getByTestId("download-progress").props.accessibilityValue).toEqual({ min: 0, max: 100, now: 42 })- expect(api.getByText("42% · 5.1 MB so far")).toBeTruthy()+ expect(api.getByText("Downloading · 42% · 5.1 MB so far")).toBeTruthy()expect(api.queryByTestId("area-my park")).toBeNull()})@@ -442,7 +444,7 @@ describe("starting a download", () => {)expect(api.getByTestId("area-name-input").props.value).toBe("")expect(mockLoadOfflineAreas.mock.calls.length).toBeGreaterThan(reloads)- expect(api.queryByText(/Downloading my park/)).toBeNull()+ expect(api.queryByTestId("download-state")).toBeNull()})// A create that fails did not create a pack, so there is nothing to clean up and nothing to retry.@@ -542,8 +544,8 @@ describe("coming back to a download", () => {const api = await renderReady()expect(mockSubscribeOfflinePack).toHaveBeenCalledWith("trail", expect.any(Function), expect.any(Function))- expect(api.getByText("Downloading trail")).toBeTruthy()- expect(api.getByText("37% · 1.0 MB so far")).toBeTruthy()+ expect(within(api.getByTestId("download-state")).getByText("trail")).toBeTruthy()+ expect(api.getByText("Downloading · 37% · 1.0 MB so far")).toBeTruthy()expect(api.queryByTestId("area-trail")).toBeNull()})diff --git a/apps/mobile/src/utils/__tests__/offlineArea.test.ts b/apps/mobile/src/utils/__tests__/offlineArea.test.tsindex d09b94da..3cada410 100644--- a/apps/mobile/src/utils/__tests__/offlineArea.test.ts+++ b/apps/mobile/src/utils/__tests__/offlineArea.test.ts@@ -76,9 +76,9 @@ describe("downloadLine", () => {describe("progressCaption", () => {it("counts bytes only once some have landed", () => {- expect(progressCaption(null)).toBe("Starting…")- expect(progressCaption(status(42, 0))).toBe("42%")- expect(progressCaption(status(42, 5_347_737))).toBe("42% · 5.1 MB so far")+ expect(progressCaption(null)).toBe("Starting download…")+ expect(progressCaption(status(42, 0))).toBe("Downloading · 42%")+ expect(progressCaption(status(42, 5_347_737))).toBe("Downloading · 42% · 5.1 MB so far")})})diff --git a/apps/mobile/src/utils/logCapture.ts b/apps/mobile/src/utils/logCapture.tsindex 5bd36ea1..6b9bbf76 100644--- a/apps/mobile/src/utils/logCapture.ts+++ b/apps/mobile/src/utils/logCapture.ts@@ -69,7 +69,7 @@ export function describeCapture(enabled: boolean, bytes: number, startedAtMs: nu* bridge decides and nothing has ever said out loud.*/export function previewRowSub(enabled: boolean): string {- return enabled ? "The log file's most recent lines, newest first" : "The system log's last few minutes, newest first"+ return enabled ? "The log file's most recent lines" : "The system log's last few minutes"}/** The step that is missing from every bug report: leave it on while you reproduce the problem. */diff --git a/apps/mobile/src/utils/offlineArea.ts b/apps/mobile/src/utils/offlineArea.tsindex aa057fbe..b525207f 100644--- a/apps/mobile/src/utils/offlineArea.ts+++ b/apps/mobile/src/utils/offlineArea.ts@@ -30,9 +30,6 @@ export interface Estimate {large: boolean}-export const INTRO_LINE =- "Frame an area on the map, name it and download it. The size is an estimate from the area alone: dense cities take more, open country less."-export const ROW_HINT = "Shows it on the map"export function duplicateNameError(name: string, taken: readonly string[]): string | undefined {@@ -52,8 +49,8 @@ export function downloadLine(estimate: Estimate | null, name: string): string {}export function progressCaption(status: OfflinePackStatus | null): string {- if (!status) return "Starting…"- const pct = `${Math.round(status.percentage)}%`+ if (!status) return "Starting download…"+ const pct = `Downloading · ${Math.round(status.percentage)}%`return status.completedResourceSize > 0 ? `${pct} · ${formatBytes(status.completedResourceSize)} so far` : pct}