Colota - Android GPS Location tracker
Add Nextcloud PhoneTrack API template
Max Dietrichb8f1e7ed3619
diff --git a/apps/mobile/src/screens/ApiSettingsScreen.tsx b/apps/mobile/src/screens/ApiSettingsScreen.tsxindex 9c6a6fa9..dadac4df 100644--- a/apps/mobile/src/screens/ApiSettingsScreen.tsx+++ b/apps/mobile/src/screens/ApiSettingsScreen.tsx@@ -29,6 +29,7 @@ const TEMPLATE_OPTIONS: { value: ApiTemplateName; label: string }[] = [{ value: "custom", label: "Custom" },{ value: "dawarich", label: "Dawarich" },{ value: "owntracks", label: "OwnTracks" },+ { value: "phonetrack", label: "PhoneTrack" },{ value: "reitti", label: "Reitti" }]diff --git a/apps/mobile/src/types/__tests__/defaults.test.ts b/apps/mobile/src/types/__tests__/defaults.test.tsindex 19ffbcb5..3301d662 100644--- a/apps/mobile/src/types/__tests__/defaults.test.ts+++ b/apps/mobile/src/types/__tests__/defaults.test.ts@@ -118,7 +118,7 @@ describe("TRACKING_PRESETS", () => {})describe("API_TEMPLATES", () => {- const templateNames = ["dawarich", "owntracks", "reitti"] as const+ const templateNames = ["dawarich", "owntracks", "phonetrack", "reitti"] as constit.each(templateNames)("%s has valid fieldMap with required keys", (name) => {const template = API_TEMPLATES[name]@@ -151,4 +151,11 @@ describe("API_TEMPLATES", () => {it("reitti uses 'bear' for bearing", () => {expect(API_TEMPLATES.reitti.fieldMap.bear).toBe("bear")})++ it("phonetrack remaps fields for Nextcloud PhoneTrack", () => {+ expect(API_TEMPLATES.phonetrack.fieldMap.vel).toBe("speed")+ expect(API_TEMPLATES.phonetrack.fieldMap.batt).toBe("bat")+ expect(API_TEMPLATES.phonetrack.fieldMap.tst).toBe("timestamp")+ expect(API_TEMPLATES.phonetrack.fieldMap.bear).toBe("bearing")+ })})diff --git a/apps/mobile/src/types/global.ts b/apps/mobile/src/types/global.tsindex 3b58a405..eb3c52dd 100644--- a/apps/mobile/src/types/global.ts+++ b/apps/mobile/src/types/global.ts@@ -93,7 +93,7 @@ export interface CustomField {value: string}-export type ApiTemplateName = "custom" | "dawarich" | "owntracks" | "reitti"+export type ApiTemplateName = "custom" | "dawarich" | "owntracks" | "phonetrack" | "reitti"export interface ApiTemplate {name: ApiTemplateName@@ -141,6 +141,23 @@ export const API_TEMPLATES: Record<Exclude<ApiTemplateName, "custom">, ApiTempla{ key: "tid", value: "AA" }]},+ phonetrack: {+ name: "phonetrack",+ label: "Nextcloud PhoneTrack",+ description: "Nextcloud PhoneTrack logging format",+ fieldMap: {+ lat: "lat",+ lon: "lon",+ acc: "acc",+ alt: "alt",+ vel: "speed",+ batt: "bat",+ bs: "bs",+ tst: "timestamp",+ bear: "bearing"+ },+ customFields: [{ key: "useragent", value: "Colota" }]+ },reitti: {name: "reitti",label: "Reitti",