Colota - Android GPS Location tracker
chore: remove unused code, dead exports, and stale dependencies
Max Dietrichd60bbf9ac2fa
diff --git a/.bundle/config b/.bundle/configdeleted file mode 100644index 848943bb..00000000--- a/.bundle/config+++ /dev/null@@ -1,2 +0,0 @@-BUNDLE_PATH: "vendor/bundle"-BUNDLE_FORCE_RUBY_PLATFORM: 1diff --git a/.eslintrc.js b/.eslintrc.jsindex 0ef09a42..f299eacf 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -1,4 +1,4 @@module.exports = {root: true,- extends: "@react-native",-};+ extends: "@react-native"+}diff --git a/.gitignore b/.gitignoreindex a80bb3ef..999ac420 100644--- a/.gitignore+++ b/.gitignore@@ -1,29 +1,10 @@+# iOS (not used - Android only)+ios/+# OSX-#.DS_Store-# Xcode-#-build/-*.pbxuser-!default.pbxuser-*.mode1v3-!default.mode1v3-*.mode2v3-!default.mode2v3-*.perspectivev3-!default.perspectivev3-xcuserdata-*.xccheckout-*.moved-aside-DerivedData-*.hmap-*.ipa-*.xcuserstate-**/.xcode.env.local-# Android/IntelliJ-#build/.idea.gradle@@ -33,7 +14,6 @@ local.properties.cxx/android/gradle.propertiesandroid/local.properties-!debug.keystore.kotlin/# Android Keystores@@ -41,42 +21,28 @@ android/local.properties*.jkskeystore.propertieskey.properties--# Debug keystore-debug.keystore--# Release keystore location+!debug.keystore/android/app/release.keystore/android/keystores/-# node.js-#+# Node.jsnode_modules/npm-debug.logyarn-error.log-# fastlane-#-# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the-# screenshots whenever they are needed.-# For more information about the recommended setup visit:-# https://docs.fastlane.tools/best-practices/source-control/--**/fastlane/report.xml-**/fastlane/Preview.html-**/fastlane/screenshots-**/fastlane/test_output-# Bundle artifact-*.jsbundle--# Ruby / CocoaPods+# Ruby / CocoaPods (not used)+Gemfile+.bundle/**/Pods//vendor/bundle/-# Temporary files created by Metro to check the health of the file watcher+# Metro.metro-health-check*-# testing+# Bundle artifact+*.jsbundle++# Testing/coverage# Yarn@@ -87,5 +53,5 @@ yarn-error.log!.yarn/sdks!.yarn/versions-+# Misctesters\ No newline at end of filediff --git a/prettierrc.json b/.prettierrc.jsonsimilarity index 100%rename from prettierrc.jsonrename to .prettierrc.jsondiff --git a/App.tsx b/App.tsxindex fb11280f..a896f292 100644--- a/App.tsx+++ b/App.tsx@@ -2,14 +2,14 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useMemo } from "react";-import { NavigationContainer } from "@react-navigation/native";-import { createNativeStackNavigator } from "@react-navigation/native-stack";-import { SafeAreaProvider } from "react-native-safe-area-context";-import { StatusBar, Platform } from "react-native";-import { ThemeProvider, useTheme } from "./src/hooks/useTheme";-import { TrackingProvider } from "./src/contexts/TrackingProvider";-import ThemedErrorBoundary from "./src/components/ThemedErrorBoundary";+import React, { useMemo } from "react"+import { NavigationContainer } from "@react-navigation/native"+import { createNativeStackNavigator } from "@react-navigation/native-stack"+import { SafeAreaProvider } from "react-native-safe-area-context"+import { StatusBar, Platform } from "react-native"+import { ThemeProvider, useTheme } from "./src/hooks/useTheme"+import { TrackingProvider } from "./src/contexts/TrackingProvider"+import ThemedErrorBoundary from "./src/components/ThemedErrorBoundary"import {DashboardScreen,SettingsScreen,@@ -19,99 +19,96 @@ import {DataManagementScreen,LocationInspectorScreen,ExportDataScreen,- AboutScreen,-} from "./src/screens/";+ AboutScreen+} from "./src/screens/"-const Stack = createNativeStackNavigator();+const Stack = createNativeStackNavigator()const SCREEN_CONFIG = [{name: "Dashboard",component: DashboardScreen,- title: "Dashboard",+ title: "Dashboard"},{name: "Settings",component: SettingsScreen,- title: "Settings",+ title: "Settings"},{name: "API Config",component: ApiSettingsScreen,- title: "API Config",+ title: "API Config"},{name: "Auth Settings",component: AuthSettingsScreen,- title: "Auth Settings",+ title: "Auth Settings"},{name: "Geofences",component: GeofenceScreen,- title: "Geofences",+ title: "Geofences"},{name: "Locations Inspector",component: LocationInspectorScreen,- title: "Locations Inspector",+ title: "Locations Inspector"},{name: "Export Data",component: ExportDataScreen,- title: "Export Data",+ title: "Export Data"},{name: "Data Management",component: DataManagementScreen,- title: "Data Management",+ title: "Data Management"},{name: "About Colota",component: AboutScreen,- title: "About Colota",- },-] as const;+ title: "About Colota"+ }+] as constfunction AppNavigator() {- const { colors, isDark } = useTheme();+ const { colors, isDark } = useTheme()const screenOptions = useMemo(() => ({headerStyle: {backgroundColor: colors.background,elevation: 0,- shadowOpacity: 0,+ shadowOpacity: 0},headerTintColor: colors.text,headerTitleStyle: {fontWeight: "bold" as const,fontSize: 18,- color: colors.text,+ color: colors.text},headerTitleAlign: "left" as const,headerBackTitleVisible: false,...(Platform.OS === "android" && {- animation: "slide_from_right" as const,- }),+ animation: "slide_from_right" as const+ })}),[colors]- );+ )const statusBarConfig = useMemo(() => ({barStyle: isDark ? ("light-content" as const) : ("dark-content" as const),backgroundColor: colors.background,translucent: false,- animated: true,+ animated: true}),[colors.background, isDark]- );+ )return (<SafeAreaProvider><StatusBar {...statusBarConfig} /><NavigationContainer>- <Stack.Navigator- initialRouteName="Dashboard"- screenOptions={screenOptions}- >+ <Stack.Navigator initialRouteName="Dashboard" screenOptions={screenOptions}>{SCREEN_CONFIG.map((screen) => (<Stack.Screenkey={screen.name}@@ -123,7 +120,7 @@ function AppNavigator() {</Stack.Navigator></NavigationContainer></SafeAreaProvider>- );+ )}export default function App() {@@ -135,5 +132,5 @@ export default function App() {</TrackingProvider></ThemedErrorBoundary></ThemeProvider>- );+ )}diff --git a/Gemfile b/Gemfiledeleted file mode 100644index 6a4c5f17..00000000--- a/Gemfile+++ /dev/null@@ -1,16 +0,0 @@-source 'https://rubygems.org'--# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version-ruby ">= 2.6.10"--# Exclude problematic versions of cocoapods and activesupport that causes build failures.-gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'-gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'-gem 'xcodeproj', '< 1.26.0'-gem 'concurrent-ruby', '< 1.3.4'--# Ruby 3.4.0 has removed some libraries from the standard library.-gem 'bigdecimal'-gem 'logger'-gem 'benchmark'-gem 'mutex_m'diff --git a/README.md b/README.mdindex 0643d985..3c1f96cd 100644--- a/README.md+++ b/README.md@@ -1,10 +1,6 @@# Colota-[](https://www.gnu.org/licenses/agpl-3.0)--[](https://developer.android.com)-[](https://kotlinlang.org)-[](https://ko-fi.com/maxdietrich)+[](https://www.gnu.org/licenses/agpl-3.0)  [](https://developer.android.com) [](https://kotlinlang.org) [](https://ko-fi.com/maxdietrich)**Self-hosted GPS tracking app for Android**@@ -94,8 +90,7 @@ You can join the Google Group https://groups.google.com/g/colota-beta-testing/ a</tr></table>-**Dark Mode**-tbd+**Dark Mode** tbd<table><tr>diff --git a/android/app/build.gradle b/android/app/build.gradleindex 7d30d352..d353737a 100644--- a/android/app/build.gradle+++ b/android/app/build.gradle@@ -86,8 +86,8 @@ android {applicationId "com.Colota"minSdkVersion rootProject.ext.minSdkVersiontargetSdkVersion rootProject.ext.targetSdkVersion- versionCode 12- versionName "0.2.0"+ versionCode 13+ versionName "1.0.0"// Expose build config to the modulebuildConfigField "int", "MIN_SDK_VERSION", "${rootProject.ext.minSdkVersion}"diff --git a/android/app/src/main/java/com/colota/LocationForegroundService.kt b/android/app/src/main/java/com/colota/LocationForegroundService.ktindex de27a94d..b70c4216 100644--- a/android/app/src/main/java/com/colota/LocationForegroundService.kt+++ b/android/app/src/main/java/com/colota/LocationForegroundService.kt@@ -90,7 +90,7 @@ class LocationForegroundService : Service() {fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManagerdbHelper = DatabaseHelper.getInstance(this)- locationUtils = LocationUtils(this)+ locationUtils = LocationUtils()deviceInfoHelper = DeviceInfoHelper(this)networkManager = NetworkManager(this)geofenceHelper = GeofenceHelper(this)diff --git a/android/app/src/main/java/com/colota/LocationServiceModule.kt b/android/app/src/main/java/com/colota/LocationServiceModule.ktindex 33796d79..1bcf694c 100644--- a/android/app/src/main/java/com/colota/LocationServiceModule.kt+++ b/android/app/src/main/java/com/colota/LocationServiceModule.kt@@ -26,7 +26,7 @@ class LocationServiceModule(reactContext: ReactApplicationContext) :ReactContextBaseJavaModule(reactContext),LifecycleEventListener {- private val locationUtils = LocationUtils(reactContext)+ private val locationUtils = LocationUtils()private val dbHelper = DatabaseHelper.getInstance(reactContext)private val fileOps = FileOperations(reactContext)private val deviceInfo = DeviceInfoHelper(reactContext)diff --git a/android/app/src/main/java/com/colota/LocationsUtils.kt b/android/app/src/main/java/com/colota/LocationUtils.ktsimilarity index 50%rename from android/app/src/main/java/com/colota/LocationsUtils.ktrename to android/app/src/main/java/com/colota/LocationUtils.ktindex 74bd671a..39a264d1 100644--- a/android/app/src/main/java/com/colota/LocationsUtils.kt+++ b/android/app/src/main/java/com/colota/LocationUtils.kt@@ -5,102 +5,19 @@package com.Colota-import android.content.ContentValues-import android.content.Context-import android.content.Intent-import android.content.IntentFilterimport android.location.Location-import android.net.ConnectivityManager-import android.net.NetworkCapabilities-import android.os.BatteryManagerimport android.util.Log-import com.facebook.react.bridge.Argumentsimport com.facebook.react.bridge.ReadableMap-import com.facebook.react.bridge.WritableArray-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.withContextimport org.json.JSONObject-import java.net.URL-import javax.net.ssl.HttpsURLConnectionimport kotlin.math.*/**- * Utility class providing specialized logic for the Colota tracking engine.- * Maintains a reference to [Context] to handle system-level queries like battery and network.+ * Utility class for building and parsing location payloads.*/-class LocationUtils(private val context: Context) {+class LocationUtils {companion object {private const val TAG = "LocationUtils"- private const val EARTH_RADIUS_METERS = 6371000.0- private const val CONNECTION_TIMEOUT = 10000- private const val READ_TIMEOUT = 10000- }-- // Lazy initialization - only created when first accessed- private val dbHelper by lazy { DatabaseHelper.getInstance(context) }-- // Cache connectivity manager to avoid repeated getSystemService calls- private val connectivityManager: ConnectivityManager by lazy {- context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager- }-- @Volatile- private var cachedGeofences: List<CachedGeofence>? = null- private var lastGeofenceCacheTime: Long = 0- private val GEOFENCE_CACHE_MS = 30000L // 30 seconds-- data class CachedGeofence(- val name: String,- val lat: Double,- val lon: Double,- val radius: Double- )-- @Volatile- private var lastNetworkCheck: Boolean = true- private var lastNetworkCheckTime: Long = 0- private val NETWORK_CHECK_CACHE_MS = 5000L // 5 seconds-- // ========================================- // GEOMETRY- // ========================================-- /**- * Calculates the great-circle distance using Haversine formula.- * Optimized with cached radians conversion.- */- fun calculateDistance(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double {- val dLat = Math.toRadians(lat2 - lat1)- val dLon = Math.toRadians(lon2 - lon1)- val lat1Rad = Math.toRadians(lat1)- val lat2Rad = Math.toRadians(lat2)-- val a = sin(dLat / 2).pow(2) +- cos(lat1Rad) * cos(lat2Rad) * sin(dLon / 2).pow(2)-- return EARTH_RADIUS_METERS * 2 * atan2(sqrt(a), sqrt(1 - a))- }-- /**- * Fast distance check without square root for geofence detection.- * Returns true if within radius (cheaper than full Haversine).- */- fun isWithinRadius(lat1: Double, lon1: Double, lat2: Double, lon2: Double, radiusMeters: Double): Boolean {- // Quick rejection test using simple lat/lon differences- val latDiff = Math.abs(lat1 - lat2)- val lonDiff = Math.abs(lon1 - lon2)-- // Rough approximation: 1 degree ≈ 111km at equator- val maxDegreeDiff = radiusMeters / 111000.0-- // Quick rejection: if way outside bounding box, skip expensive calculation- if (latDiff > maxDegreeDiff || lonDiff > maxDegreeDiff) {- return false- }-- // Only do full Haversine if within rough bounding box- return calculateDistance(lat1, lon1, lat2, lon2) <= radiusMeters}// ========================================@@ -148,7 +65,7 @@ class LocationUtils(private val context: Context) {*/fun parseFieldMap(jsonString: String?): Map<String, String>? {if (jsonString.isNullOrBlank()) return null-+return try {val json = JSONObject(jsonString)json.keys().asSequence().associateWith { json.getString(it) }@@ -184,14 +101,14 @@ class LocationUtils(private val context: Context) {fun convertFieldMapToJson(fieldMap: ReadableMap): String {val json = JSONObject()val iterator = fieldMap.keySetIterator()-+while (iterator.hasNextKey()) {val key = iterator.nextKey()fieldMap.getString(key)?.let { value ->json.put(key, value)}}-+return json.toString()}diff --git a/babel.config.js b/babel.config.jsindex 3c25e5d9..f012c061 100644--- a/babel.config.js+++ b/babel.config.js@@ -1,3 +1,3 @@module.exports = {- presets: ["module:@react-native/babel-preset"],-};+ presets: ["module:@react-native/babel-preset"]+}diff --git a/index.js b/index.jsindex 70c068d5..285cb248 100644--- a/index.js+++ b/index.js@@ -10,9 +10,9 @@* Enhanced entry point with error handling, performance monitoring,* and development tools.*/-import { AppRegistry, LogBox, Platform } from "react-native";-import App from "./App";-import { name as appName } from "./app.json";+import { AppRegistry, LogBox, Platform } from "react-native"+import App from "./App"+import { name as appName } from "./app.json"/*** Development-only configuration@@ -21,17 +21,17 @@ if (__DEV__) {// Configure LogBox to ignore specific known warningsLogBox.ignoreLogs(["Non-serializable values were found in the navigation state",- "Require cycle:", // Common in large React Native projects+ "Require cycle:" // Common in large React Native projects// Add other warnings to ignore- ]);+ ])// Enable React Native performance monitoringif (Platform.OS === "android") {// Android-specific dev tools- console.log("[Dev] Android development mode enabled");+ console.log("[Dev] Android development mode enabled")} else if (Platform.OS === "ios") {// iOS-specific dev tools- console.log("[Dev] iOS development mode enabled");+ console.log("[Dev] iOS development mode enabled")}}@@ -41,20 +41,20 @@ if (__DEV__) {*/const errorHandler = (error, isFatal) => {if (isFatal) {- console.error("[Fatal Error]", error);+ console.error("[Fatal Error]", error)// In production, you might want to:// - Send error to crash reporting service (Sentry, Crashlytics)// - Show user-friendly error screen// - Log to analytics} else {- console.warn("[Error]", error);+ console.warn("[Error]", error)}-};+}// Set global error handler (only in production)if (!__DEV__) {- ErrorUtils.setGlobalHandler(errorHandler);+ ErrorUtils.setGlobalHandler(errorHandler)}// Register the main application component-AppRegistry.registerComponent(appName, () => App);+AppRegistry.registerComponent(appName, () => App)diff --git a/ios/.xcode.env b/ios/.xcode.envdeleted file mode 100644index 3d5782c7..00000000--- a/ios/.xcode.env+++ /dev/null@@ -1,11 +0,0 @@-# This `.xcode.env` file is versioned and is used to source the environment-# used when running script phases inside Xcode.-# To customize your local environment, you can create an `.xcode.env.local`-# file that is not versioned.--# NODE_BINARY variable contains the PATH to the node executable.-#-# Customize the NODE_BINARY variable here.-# For example, to use nvm with brew, add the following line-# . "$(brew --prefix nvm)/nvm.sh" --no-use-export NODE_BINARY=$(command -v node)diff --git a/ios/Locata.xcodeproj/project.pbxproj b/ios/Locata.xcodeproj/project.pbxprojdeleted file mode 100644index da528195..00000000--- a/ios/Locata.xcodeproj/project.pbxproj+++ /dev/null@@ -1,471 +0,0 @@-// !$*UTF8*$!-{- archiveVersion = 1;- classes = {- };- objectVersion = 54;- objects = {--/* Begin PBXBuildFile section */- 0C80B921A6F3F58F76C31292 /* libPods-Colota.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-Colota.a */; };- 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };- 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };- 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };-/* End PBXBuildFile section */--/* Begin PBXFileReference section */- 13B07F961A680F5B00A75B9A /* Colota.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Colota.app; sourceTree = BUILT_PRODUCTS_DIR; };- 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Colota/Images.xcassets; sourceTree = "<group>"; };- 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Colota/Info.plist; sourceTree = "<group>"; };- 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = Colota/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };- 3B4392A12AC88292D35C810B /* Pods-Colota.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colota.debug.xcconfig"; path = "Target Support Files/Pods-Colota/Pods-Colota.debug.xcconfig"; sourceTree = "<group>"; };- 5709B34CF0A7D63546082F79 /* Pods-Colota.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Colota.release.xcconfig"; path = "Target Support Files/Pods-Colota/Pods-Colota.release.xcconfig"; sourceTree = "<group>"; };- 5DCACB8F33CDC322A6C60F78 /* libPods-Colota.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Colota.a"; sourceTree = BUILT_PRODUCTS_DIR; };- 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Colota/AppDelegate.swift; sourceTree = "<group>"; };- 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Colota/LaunchScreen.storyboard; sourceTree = "<group>"; };- ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };-/* End PBXFileReference section */--/* Begin PBXFrameworksBuildPhase section */- 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {- isa = PBXFrameworksBuildPhase;- buildActionMask = 2147483647;- files = (- 0C80B921A6F3F58F76C31292 /* libPods-Colota.a in Frameworks */,- );- runOnlyForDeploymentPostprocessing = 0;- };-/* End PBXFrameworksBuildPhase section */--/* Begin PBXGroup section */- 13B07FAE1A68108700A75B9A /* Colota */ = {- isa = PBXGroup;- children = (- 13B07FB51A68108700A75B9A /* Images.xcassets */,- 761780EC2CA45674006654EE /* AppDelegate.swift */,- 13B07FB61A68108700A75B9A /* Info.plist */,- 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,- 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,- );- name = Colota;- sourceTree = "<group>";- };- 2D16E6871FA4F8E400B85C8A /* Frameworks */ = {- isa = PBXGroup;- children = (- ED297162215061F000B7C4FE /* JavaScriptCore.framework */,- 5DCACB8F33CDC322A6C60F78 /* libPods-Colota.a */,- );- name = Frameworks;- sourceTree = "<group>";- };- 832341AE1AAA6A7D00B99B32 /* Libraries */ = {- isa = PBXGroup;- children = (- );- name = Libraries;- sourceTree = "<group>";- };- 83CBB9F61A601CBA00E9B192 = {- isa = PBXGroup;- children = (- 13B07FAE1A68108700A75B9A /* Colota */,- 832341AE1AAA6A7D00B99B32 /* Libraries */,- 83CBBA001A601CBA00E9B192 /* Products */,- 2D16E6871FA4F8E400B85C8A /* Frameworks */,- BBD78D7AC51CEA395F1C20DB /* Pods */,- );- indentWidth = 2;- sourceTree = "<group>";- tabWidth = 2;- usesTabs = 0;- };- 83CBBA001A601CBA00E9B192 /* Products */ = {- isa = PBXGroup;- children = (- 13B07F961A680F5B00A75B9A /* Colota.app */,- );- name = Products;- sourceTree = "<group>";- };- BBD78D7AC51CEA395F1C20DB /* Pods */ = {- isa = PBXGroup;- children = (- 3B4392A12AC88292D35C810B /* Pods-Colota.debug.xcconfig */,- 5709B34CF0A7D63546082F79 /* Pods-Colota.release.xcconfig */,- );- path = Pods;- sourceTree = "<group>";- };-/* End PBXGroup section */--/* Begin PBXNativeTarget section */- 13B07F861A680F5B00A75B9A /* Colota */ = {- isa = PBXNativeTarget;- buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Colota" */;- buildPhases = (- C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,- 13B07F871A680F5B00A75B9A /* Sources */,- 13B07F8C1A680F5B00A75B9A /* Frameworks */,- 13B07F8E1A680F5B00A75B9A /* Resources */,- 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,- 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,- E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,- );- buildRules = (- );- dependencies = (- );- name = Colota;- productName = Colota;- productReference = 13B07F961A680F5B00A75B9A /* Colota.app */;- productType = "com.apple.product-type.application";- };-/* End PBXNativeTarget section */--/* Begin PBXProject section */- 83CBB9F71A601CBA00E9B192 /* Project object */ = {- isa = PBXProject;- attributes = {- LastUpgradeCheck = 1210;- TargetAttributes = {- 13B07F861A680F5B00A75B9A = {- LastSwiftMigration = 1120;- };- };- };- buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Colota" */;- compatibilityVersion = "Xcode 12.0";- developmentRegion = en;- hasScannedForEncodings = 0;- knownRegions = (- en,- Base,- );- mainGroup = 83CBB9F61A601CBA00E9B192;- productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;- projectDirPath = "";- projectRoot = "";- targets = (- 13B07F861A680F5B00A75B9A /* Colota */,- );- };-/* End PBXProject section */--/* Begin PBXResourcesBuildPhase section */- 13B07F8E1A680F5B00A75B9A /* Resources */ = {- isa = PBXResourcesBuildPhase;- buildActionMask = 2147483647;- files = (- 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,- 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,- );- runOnlyForDeploymentPostprocessing = 0;- };-/* End PBXResourcesBuildPhase section */--/* Begin PBXShellScriptBuildPhase section */- 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {- isa = PBXShellScriptBuildPhase;- buildActionMask = 2147483647;- files = (- );- inputPaths = (- "$(SRCROOT)/.xcode.env.local",- "$(SRCROOT)/.xcode.env",- );- name = "Bundle React Native code and images";- outputPaths = (- );- runOnlyForDeploymentPostprocessing = 0;- shellPath = /bin/sh;- shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"\\\"$WITH_ENVIRONMENT\\\" \\\"$REACT_NATIVE_XCODE\\\"\"\n";- };- 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {- isa = PBXShellScriptBuildPhase;- buildActionMask = 2147483647;- files = (- );- inputFileListPaths = (- "${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-frameworks-${CONFIGURATION}-input-files.xcfilelist",- );- name = "[CP] Embed Pods Frameworks";- outputFileListPaths = (- "${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-frameworks-${CONFIGURATION}-output-files.xcfilelist",- );- runOnlyForDeploymentPostprocessing = 0;- shellPath = /bin/sh;- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-frameworks.sh\"\n";- showEnvVarsInLog = 0;- };- C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {- isa = PBXShellScriptBuildPhase;- buildActionMask = 2147483647;- files = (- );- inputFileListPaths = (- );- inputPaths = (- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",- "${PODS_ROOT}/Manifest.lock",- );- name = "[CP] Check Pods Manifest.lock";- outputFileListPaths = (- );- outputPaths = (- "$(DERIVED_FILE_DIR)/Pods-Colota-checkManifestLockResult.txt",- );- runOnlyForDeploymentPostprocessing = 0;- shellPath = /bin/sh;- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";- showEnvVarsInLog = 0;- };- E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {- isa = PBXShellScriptBuildPhase;- buildActionMask = 2147483647;- files = (- );- inputFileListPaths = (- "${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-resources-${CONFIGURATION}-input-files.xcfilelist",- );- name = "[CP] Copy Pods Resources";- outputFileListPaths = (- "${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-resources-${CONFIGURATION}-output-files.xcfilelist",- );- runOnlyForDeploymentPostprocessing = 0;- shellPath = /bin/sh;- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Colota/Pods-Colota-resources.sh\"\n";- showEnvVarsInLog = 0;- };-/* End PBXShellScriptBuildPhase section */--/* Begin PBXSourcesBuildPhase section */- 13B07F871A680F5B00A75B9A /* Sources */ = {- isa = PBXSourcesBuildPhase;- buildActionMask = 2147483647;- files = (- 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */,- );- runOnlyForDeploymentPostprocessing = 0;- };-/* End PBXSourcesBuildPhase section */--/* Begin XCBuildConfiguration section */- 13B07F941A680F5B00A75B9A /* Debug */ = {- isa = XCBuildConfiguration;- baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-Colota.debug.xcconfig */;- buildSettings = {- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;- CLANG_ENABLE_MODULES = YES;- CURRENT_PROJECT_VERSION = 1;- ENABLE_BITCODE = NO;- INFOPLIST_FILE = Colota/Info.plist;- IPHONEOS_DEPLOYMENT_TARGET = 15.1;- LD_RUNPATH_SEARCH_PATHS = (- "$(inherited)",- "@executable_path/Frameworks",- );- MARKETING_VERSION = 1.0;- OTHER_LDFLAGS = (- "$(inherited)",- "-ObjC",- "-lc++",- );- PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";- PRODUCT_NAME = Colota;- SWIFT_OPTIMIZATION_LEVEL = "-Onone";- SWIFT_VERSION = 5.0;- VERSIONING_SYSTEM = "apple-generic";- };- name = Debug;- };- 13B07F951A680F5B00A75B9A /* Release */ = {- isa = XCBuildConfiguration;- baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-Colota.release.xcconfig */;- buildSettings = {- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;- CLANG_ENABLE_MODULES = YES;- CURRENT_PROJECT_VERSION = 1;- INFOPLIST_FILE = Colota/Info.plist;- IPHONEOS_DEPLOYMENT_TARGET = 15.1;- LD_RUNPATH_SEARCH_PATHS = (- "$(inherited)",- "@executable_path/Frameworks",- );- MARKETING_VERSION = 1.0;- OTHER_LDFLAGS = (- "$(inherited)",- "-ObjC",- "-lc++",- );- PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";- PRODUCT_NAME = Colota;- SWIFT_VERSION = 5.0;- VERSIONING_SYSTEM = "apple-generic";- };- name = Release;- };- 83CBBA201A601CBA00E9B192 /* Debug */ = {- isa = XCBuildConfiguration;- buildSettings = {- ALWAYS_SEARCH_USER_PATHS = NO;- CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;- CLANG_CXX_LANGUAGE_STANDARD = "c++20";- CLANG_CXX_LIBRARY = "libc++";- CLANG_ENABLE_MODULES = YES;- CLANG_ENABLE_OBJC_ARC = YES;- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;- CLANG_WARN_BOOL_CONVERSION = YES;- CLANG_WARN_COMMA = YES;- CLANG_WARN_CONSTANT_CONVERSION = YES;- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;- CLANG_WARN_EMPTY_BODY = YES;- CLANG_WARN_ENUM_CONVERSION = YES;- CLANG_WARN_INFINITE_RECURSION = YES;- CLANG_WARN_INT_CONVERSION = YES;- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;- CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;- CLANG_WARN_STRICT_PROTOTYPES = YES;- CLANG_WARN_SUSPICIOUS_MOVE = YES;- CLANG_WARN_UNREACHABLE_CODE = YES;- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";- COPY_PHASE_STRIP = NO;- ENABLE_STRICT_OBJC_MSGSEND = YES;- ENABLE_TESTABILITY = YES;- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";- GCC_C_LANGUAGE_STANDARD = gnu99;- GCC_DYNAMIC_NO_PIC = NO;- GCC_NO_COMMON_BLOCKS = YES;- GCC_OPTIMIZATION_LEVEL = 0;- GCC_PREPROCESSOR_DEFINITIONS = (- "DEBUG=1",- "$(inherited)",- );- GCC_SYMBOLS_PRIVATE_EXTERN = NO;- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;- GCC_WARN_UNDECLARED_SELECTOR = YES;- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;- GCC_WARN_UNUSED_FUNCTION = YES;- GCC_WARN_UNUSED_VARIABLE = YES;- IPHONEOS_DEPLOYMENT_TARGET = 15.1;- LD_RUNPATH_SEARCH_PATHS = (- /usr/lib/swift,- "$(inherited)",- );- LIBRARY_SEARCH_PATHS = (- "\"$(SDKROOT)/usr/lib/swift\"",- "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",- "\"$(inherited)\"",- );- MTL_ENABLE_DEBUG_INFO = YES;- ONLY_ACTIVE_ARCH = YES;- OTHER_CPLUSPLUSFLAGS = (- "$(OTHER_CFLAGS)",- "-DFOLLY_NO_CONFIG",- "-DFOLLY_MOBILE=1",- "-DFOLLY_USE_LIBCPP=1",- "-DFOLLY_CFG_NO_COROUTINES=1",- "-DFOLLY_HAVE_CLOCK_GETTIME=1",- );- SDKROOT = iphoneos;- };- name = Debug;- };- 83CBBA211A601CBA00E9B192 /* Release */ = {- isa = XCBuildConfiguration;- buildSettings = {- ALWAYS_SEARCH_USER_PATHS = NO;- CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;- CLANG_CXX_LANGUAGE_STANDARD = "c++20";- CLANG_CXX_LIBRARY = "libc++";- CLANG_ENABLE_MODULES = YES;- CLANG_ENABLE_OBJC_ARC = YES;- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;- CLANG_WARN_BOOL_CONVERSION = YES;- CLANG_WARN_COMMA = YES;- CLANG_WARN_CONSTANT_CONVERSION = YES;- CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;- CLANG_WARN_EMPTY_BODY = YES;- CLANG_WARN_ENUM_CONVERSION = YES;- CLANG_WARN_INFINITE_RECURSION = YES;- CLANG_WARN_INT_CONVERSION = YES;- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;- CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;- CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;- CLANG_WARN_STRICT_PROTOTYPES = YES;- CLANG_WARN_SUSPICIOUS_MOVE = YES;- CLANG_WARN_UNREACHABLE_CODE = YES;- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";- COPY_PHASE_STRIP = YES;- ENABLE_NS_ASSERTIONS = NO;- ENABLE_STRICT_OBJC_MSGSEND = YES;- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";- GCC_C_LANGUAGE_STANDARD = gnu99;- GCC_NO_COMMON_BLOCKS = YES;- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;- GCC_WARN_UNDECLARED_SELECTOR = YES;- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;- GCC_WARN_UNUSED_FUNCTION = YES;- GCC_WARN_UNUSED_VARIABLE = YES;- IPHONEOS_DEPLOYMENT_TARGET = 15.1;- LD_RUNPATH_SEARCH_PATHS = (- /usr/lib/swift,- "$(inherited)",- );- LIBRARY_SEARCH_PATHS = (- "\"$(SDKROOT)/usr/lib/swift\"",- "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",- "\"$(inherited)\"",- );- MTL_ENABLE_DEBUG_INFO = NO;- OTHER_CPLUSPLUSFLAGS = (- "$(OTHER_CFLAGS)",- "-DFOLLY_NO_CONFIG",- "-DFOLLY_MOBILE=1",- "-DFOLLY_USE_LIBCPP=1",- "-DFOLLY_CFG_NO_COROUTINES=1",- "-DFOLLY_HAVE_CLOCK_GETTIME=1",- );- SDKROOT = iphoneos;- VALIDATE_PRODUCT = YES;- };- name = Release;- };-/* End XCBuildConfiguration section */--/* Begin XCConfigurationList section */- 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Colota" */ = {- isa = XCConfigurationList;- buildConfigurations = (- 13B07F941A680F5B00A75B9A /* Debug */,- 13B07F951A680F5B00A75B9A /* Release */,- );- defaultConfigurationIsVisible = 0;- defaultConfigurationName = Release;- };- 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Colota" */ = {- isa = XCConfigurationList;- buildConfigurations = (- 83CBBA201A601CBA00E9B192 /* Debug */,- 83CBBA211A601CBA00E9B192 /* Release */,- );- defaultConfigurationIsVisible = 0;- defaultConfigurationName = Release;- };-/* End XCConfigurationList section */- };- rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;-}diff --git a/ios/Locata.xcodeproj/xcshareddata/xcschemes/Locata.xcscheme b/ios/Locata.xcodeproj/xcshareddata/xcschemes/Locata.xcschemedeleted file mode 100644index fbc2a03a..00000000--- a/ios/Locata.xcodeproj/xcshareddata/xcschemes/Locata.xcscheme+++ /dev/null@@ -1,88 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<Scheme- LastUpgradeVersion = "1210"- version = "1.3">- <BuildAction- parallelizeBuildables = "YES"- buildImplicitDependencies = "YES">- <BuildActionEntries>- <BuildActionEntry- buildForTesting = "YES"- buildForRunning = "YES"- buildForProfiling = "YES"- buildForArchiving = "YES"- buildForAnalyzing = "YES">- <BuildableReference- BuildableIdentifier = "primary"- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"- BuildableName = "Colota.app"- BlueprintName = "Colota"- ReferencedContainer = "container:Colota.xcodeproj">- </BuildableReference>- </BuildActionEntry>- </BuildActionEntries>- </BuildAction>- <TestAction- buildConfiguration = "Debug"- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"- shouldUseLaunchSchemeArgsEnv = "YES">- <Testables>- <TestableReference- skipped = "NO">- <BuildableReference- BuildableIdentifier = "primary"- BlueprintIdentifier = "00E356ED1AD99517003FC87E"- BuildableName = "ColotaTests.xctest"- BlueprintName = "ColotaTests"- ReferencedContainer = "container:Colota.xcodeproj">- </BuildableReference>- </TestableReference>- </Testables>- </TestAction>- <LaunchAction- buildConfiguration = "Debug"- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"- launchStyle = "0"- useCustomWorkingDirectory = "NO"- ignoresPersistentStateOnLaunch = "NO"- debugDocumentVersioning = "YES"- debugServiceExtension = "internal"- allowLocationSimulation = "YES">- <BuildableProductRunnable- runnableDebuggingMode = "0">- <BuildableReference- BuildableIdentifier = "primary"- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"- BuildableName = "Colota.app"- BlueprintName = "Colota"- ReferencedContainer = "container:Colota.xcodeproj">- </BuildableReference>- </BuildableProductRunnable>- </LaunchAction>- <ProfileAction- buildConfiguration = "Release"- shouldUseLaunchSchemeArgsEnv = "YES"- savedToolIdentifier = ""- useCustomWorkingDirectory = "NO"- debugDocumentVersioning = "YES">- <BuildableProductRunnable- runnableDebuggingMode = "0">- <BuildableReference- BuildableIdentifier = "primary"- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"- BuildableName = "Colota.app"- BlueprintName = "Colota"- ReferencedContainer = "container:Colota.xcodeproj">- </BuildableReference>- </BuildableProductRunnable>- </ProfileAction>- <AnalyzeAction- buildConfiguration = "Debug">- </AnalyzeAction>- <ArchiveAction- buildConfiguration = "Release"- revealArchiveInOrganizer = "YES">- </ArchiveAction>-</Scheme>diff --git a/ios/Locata/AppDelegate.swift b/ios/Locata/AppDelegate.swiftdeleted file mode 100644index b19d33d4..00000000--- a/ios/Locata/AppDelegate.swift+++ /dev/null@@ -1,48 +0,0 @@-import UIKit-import React-import React_RCTAppDelegate-import ReactAppDependencyProvider--@main-class AppDelegate: UIResponder, UIApplicationDelegate {- var window: UIWindow?-- var reactNativeDelegate: ReactNativeDelegate?- var reactNativeFactory: RCTReactNativeFactory?-- func application(- _ application: UIApplication,- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil- ) -> Bool {- let delegate = ReactNativeDelegate()- let factory = RCTReactNativeFactory(delegate: delegate)- delegate.dependencyProvider = RCTAppDependencyProvider()-- reactNativeDelegate = delegate- reactNativeFactory = factory-- window = UIWindow(frame: UIScreen.main.bounds)-- factory.startReactNative(- withModuleName: "Colota",- in: window,- launchOptions: launchOptions- )-- return true- }-}--class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {- override func sourceURL(for bridge: RCTBridge) -> URL? {- self.bundleURL()- }-- override func bundleURL() -> URL? {-#if DEBUG- RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")-#else- Bundle.main.url(forResource: "main", withExtension: "jsbundle")-#endif- }-}diff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/100.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/100.pngdeleted file mode 100644index d6ed0d82..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/100.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/102.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/102.pngdeleted file mode 100644index ad407fbd..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/102.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/1024.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/1024.pngdeleted file mode 100644index 38b93496..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/1024.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/108.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/108.pngdeleted file mode 100644index 63b56993..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/108.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/114.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/114.pngdeleted file mode 100644index 8d21299c..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/114.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/120.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/120.pngdeleted file mode 100644index d4a22926..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/120.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/128.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/128.pngdeleted file mode 100644index 9a8b913e..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/128.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/144.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/144.pngdeleted file mode 100644index a0dfe417..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/144.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/152.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/152.pngdeleted file mode 100644index c5913d58..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/152.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/16.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/16.pngdeleted file mode 100644index 74a045ce..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/16.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/167.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/167.pngdeleted file mode 100644index d03f2b30..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/167.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/172.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/172.pngdeleted file mode 100644index 7d0535a1..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/172.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/180.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/180.pngdeleted file mode 100644index e2eff37c..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/180.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/196.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/196.pngdeleted file mode 100644index 9f658b47..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/196.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/20.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/20.pngdeleted file mode 100644index ae14180b..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/20.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/216.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/216.pngdeleted file mode 100644index d2271ea1..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/216.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/234.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/234.pngdeleted file mode 100644index ef3dfcb0..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/234.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/256.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/256.pngdeleted file mode 100644index f845dc9e..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/256.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/258.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/258.pngdeleted file mode 100644index 080c72d7..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/258.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/29.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/29.pngdeleted file mode 100644index 2701c1a2..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/29.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/32.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/32.pngdeleted file mode 100644index d54472c8..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/32.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/40.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/40.pngdeleted file mode 100644index d358fb60..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/40.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/48.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/48.pngdeleted file mode 100644index e5f92b3c..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/48.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/50.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/50.pngdeleted file mode 100644index c46cc88a..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/50.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/512.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/512.pngdeleted file mode 100644index 0c16f92c..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/512.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/55.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/55.pngdeleted file mode 100644index ff7eccc2..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/55.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/57.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/57.pngdeleted file mode 100644index 1409ea20..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/57.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/58.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/58.pngdeleted file mode 100644index f9600a59..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/58.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/60.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/60.pngdeleted file mode 100644index ee3a26d7..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/60.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/64.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/64.pngdeleted file mode 100644index 5ebd0c6f..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/64.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/66.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/66.pngdeleted file mode 100644index 1205d44d..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/66.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/72.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/72.pngdeleted file mode 100644index 521e88f9..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/72.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/76.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/76.pngdeleted file mode 100644index cb8dd785..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/76.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/80.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/80.pngdeleted file mode 100644index ebd16aab..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/80.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/87.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/87.pngdeleted file mode 100644index 92cba995..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/87.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/88.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/88.pngdeleted file mode 100644index 324588b7..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/88.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/92.png b/ios/Locata/Images.xcassets/AppIcon.appiconset/92.pngdeleted file mode 100644index 87b81c4d..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/92.png and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/Contents.json b/ios/Locata/Images.xcassets/AppIcon.appiconset/Contents.jsondeleted file mode 100644index ebd0af41..00000000--- a/ios/Locata/Images.xcassets/AppIcon.appiconset/Contents.json+++ /dev/null@@ -1,128 +0,0 @@-{- "images": [- {- "idiom": "iphone",- "size": "20x20",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "20x20",- "scale": "3x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "29x29",- "scale": "1x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "29x29",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "29x29",- "scale": "3x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "40x40",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "40x40",- "scale": "3x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "60x60",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "60x60",- "scale": "3x",- "filename": "[email protected]"- },- {- "idiom": "iphone",- "size": "76x76",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "20x20",- "scale": "1x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "20x20",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "29x29",- "scale": "1x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "29x29",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "40x40",- "scale": "1x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "40x40",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "76x76",- "scale": "1x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "76x76",- "scale": "2x",- "filename": "[email protected]"- },- {- "idiom": "ipad",- "size": "83.5x83.5",- "scale": "2x",- "filename": "[email protected]"- },- {- "size": "1024x1024",- "idiom": "ios-marketing",- "scale": "1x",- "filename": "[email protected]"- }- ],- "info": {- "version": 1,- "author": "easyappicon"- }-}diff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index a91eecf0..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 15c8ff86..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index e0200ce3..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 410ecbee..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index c945dd9e..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 297589f5..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 15c8ff86..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index ef9e7c85..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index ba832800..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index ba832800..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 3df7d6a7..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index ed024872..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 87852c9d..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index 05b67813..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] b/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected]deleted file mode 100644index a3f68f9d..00000000Binary files a/ios/Locata/Images.xcassets/AppIcon.appiconset/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/Contents.json b/ios/Locata/Images.xcassets/Contents.jsondeleted file mode 100644index 97a8662e..00000000--- a/ios/Locata/Images.xcassets/Contents.json+++ /dev/null@@ -1,6 +0,0 @@-{- "info": {- "version": 1,- "author": "xcode"- }-}diff --git a/ios/Locata/Images.xcassets/[email protected] b/ios/Locata/Images.xcassets/[email protected]deleted file mode 100644index 229ac0ab..00000000Binary files a/ios/Locata/Images.xcassets/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/[email protected] b/ios/Locata/Images.xcassets/[email protected]deleted file mode 100644index a3f68f9d..00000000Binary files a/ios/Locata/Images.xcassets/[email protected] and /dev/null differdiff --git a/ios/Locata/Images.xcassets/[email protected] b/ios/Locata/Images.xcassets/[email protected]deleted file mode 100644index c45028b7..00000000Binary files a/ios/Locata/Images.xcassets/[email protected] and /dev/null differdiff --git a/ios/Locata/Info.plist b/ios/Locata/Info.plistdeleted file mode 100644index 2947dbce..00000000--- a/ios/Locata/Info.plist+++ /dev/null@@ -1,59 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">-<plist version="1.0">-<dict>- <key>CADisableMinimumFrameDurationOnPhone</key>- <true/>- <key>CFBundleDevelopmentRegion</key>- <string>en</string>- <key>CFBundleDisplayName</key>- <string>Colota</string>- <key>CFBundleExecutable</key>- <string>$(EXECUTABLE_NAME)</string>- <key>CFBundleIdentifier</key>- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>- <key>CFBundleInfoDictionaryVersion</key>- <string>6.0</string>- <key>CFBundleName</key>- <string>$(PRODUCT_NAME)</string>- <key>CFBundlePackageType</key>- <string>APPL</string>- <key>CFBundleShortVersionString</key>- <string>$(MARKETING_VERSION)</string>- <key>CFBundleSignature</key>- <string>????</string>- <key>CFBundleVersion</key>- <string>$(CURRENT_PROJECT_VERSION)</string>- <key>LSRequiresIPhoneOS</key>- <true/>- <key>NSAppTransportSecurity</key>- <dict>- <!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->- <key>NSAllowsArbitraryLoads</key>- <false/>- <key>NSAllowsLocalNetworking</key>- <true/>- </dict>- <key>NSLocationWhenInUseUsageDescription</key>- <string>We need your location to send it to your specified endpoint.</string>- <key>NSLocationAlwaysUsageDescription</key>- <string>We need your location to send it always to your specified endpoint..</string>- <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>- <string>We need your location to send it to your specified endpoint in the background and foreground.</string>- <string></string>- <key>UILaunchStoryboardName</key>- <string>LaunchScreen</string>- <key>UIRequiredDeviceCapabilities</key>- <array>- <string>arm64</string>- </array>- <key>UISupportedInterfaceOrientations</key>- <array>- <string>UIInterfaceOrientationPortrait</string>- <string>UIInterfaceOrientationLandscapeLeft</string>- <string>UIInterfaceOrientationLandscapeRight</string>- </array>- <key>UIViewControllerBasedStatusBarAppearance</key>- <false/>-</dict>-</plist>diff --git a/ios/Locata/LaunchScreen.storyboard b/ios/Locata/LaunchScreen.storyboarddeleted file mode 100644index 8410afda..00000000--- a/ios/Locata/LaunchScreen.storyboard+++ /dev/null@@ -1,47 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">- <device id="retina4_7" orientation="portrait" appearance="light"/>- <dependencies>- <deployment identifier="iOS"/>- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>- <capability name="Safe area layout guides" minToolsVersion="9.0"/>- <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>- </dependencies>- <scenes>- <!--View Controller-->- <scene sceneID="EHf-IW-A2E">- <objects>- <viewController id="01J-lp-oVM" sceneMemberID="viewController">- <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>- <subviews>- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Colota" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">- <rect key="frame" x="0.0" y="202" width="375" height="43"/>- <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>- <nil key="highlightedColor"/>- </label>- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="MN2-I3-ftu">- <rect key="frame" x="0.0" y="626" width="375" height="21"/>- <fontDescription key="fontDescription" type="system" pointSize="17"/>- <nil key="highlightedColor"/>- </label>- </subviews>- <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>- <constraints>- <constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="MN2-I3-ftu" secondAttribute="bottom" constant="20" id="OZV-Vh-mqD"/>- <constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>- <constraint firstItem="MN2-I3-ftu" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="akx-eg-2ui"/>- <constraint firstItem="MN2-I3-ftu" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="i1E-0Y-4RG"/>- <constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>- <constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>- </constraints>- <viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>- </view>- </viewController>- <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>- </objects>- <point key="canvasLocation" x="52.173913043478265" y="375"/>- </scene>- </scenes>-</document>diff --git a/ios/Locata/PrivacyInfo.xcprivacy b/ios/Locata/PrivacyInfo.xcprivacydeleted file mode 100644index 41b8317f..00000000--- a/ios/Locata/PrivacyInfo.xcprivacy+++ /dev/null@@ -1,37 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">-<plist version="1.0">-<dict>- <key>NSPrivacyAccessedAPITypes</key>- <array>- <dict>- <key>NSPrivacyAccessedAPIType</key>- <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>- <key>NSPrivacyAccessedAPITypeReasons</key>- <array>- <string>C617.1</string>- </array>- </dict>- <dict>- <key>NSPrivacyAccessedAPIType</key>- <string>NSPrivacyAccessedAPICategoryUserDefaults</string>- <key>NSPrivacyAccessedAPITypeReasons</key>- <array>- <string>CA92.1</string>- </array>- </dict>- <dict>- <key>NSPrivacyAccessedAPIType</key>- <string>NSPrivacyAccessedAPICategorySystemBootTime</string>- <key>NSPrivacyAccessedAPITypeReasons</key>- <array>- <string>35F9.1</string>- </array>- </dict>- </array>- <key>NSPrivacyCollectedDataTypes</key>- <array/>- <key>NSPrivacyTracking</key>- <false/>-</dict>-</plist>diff --git a/ios/Podfile b/ios/Podfiledeleted file mode 100644index f07f59b8..00000000--- a/ios/Podfile+++ /dev/null@@ -1,34 +0,0 @@-# Resolve react_native_pods.rb with node to allow for hoisting-require Pod::Executable.execute_command('node', ['-p',- 'require.resolve(- "react-native/scripts/react_native_pods.rb",- {paths: [process.argv[1]]},- )', __dir__]).strip--platform :ios, min_ios_version_supported-prepare_react_native_project!--linkage = ENV['USE_FRAMEWORKS']-if linkage != nil- Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green- use_frameworks! :linkage => linkage.to_sym-end--target 'Colota' do- config = use_native_modules!-- use_react_native!(- :path => config[:reactNativePath],- # An absolute path to your application root.- :app_path => "#{Pod::Config.instance.installation_root}/.."- )-- post_install do |installer|- react_native_post_install(- installer,- config[:reactNativePath],- :mac_catalyst_enabled => false,- # :ccache_enabled => true- )- end-enddiff --git a/jest.config.js b/jest.config.jsindex edf19461..3abb3a4c 100644--- a/jest.config.js+++ b/jest.config.js@@ -1,3 +1,3 @@module.exports = {- preset: "react-native",-};+ preset: "react-native"+}diff --git a/metro.config.js b/metro.config.jsindex fc2f460a..5f62fea0 100644--- a/metro.config.js+++ b/metro.config.js@@ -1,4 +1,4 @@-const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");+const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config")/*** Metro configuration@@ -6,6 +6,6 @@ const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");** @type {import('@react-native/metro-config').MetroConfig}*/-const config = {};+const config = {}-module.exports = mergeConfig(getDefaultConfig(__dirname), config);+module.exports = mergeConfig(getDefaultConfig(__dirname), config)diff --git a/package.json b/package.jsonindex 33c03134..ca4dd6f4 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "Colota",- "version": "0.2.0",+ "version": "1.0.0","versionCode": 10,"private": true,"scripts": {@@ -25,7 +25,6 @@"@react-navigation/native-stack": "^7.9.0","react": "19.2.0","react-native": "0.83.1",- "react-native-permissions": "^5.4.4","react-native-safe-area-context": "^5.6.2","react-native-screens": "^4.19.0","react-native-webview": "^13.16.0"@@ -34,7 +33,6 @@"@babel/core": "^7.25.2","@babel/preset-env": "^7.25.3","@babel/runtime": "^7.25.0",- "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.5.0/react-icons-all-files-5.5.0.tgz","@react-native-community/cli": "20.0.0","@react-native-community/cli-platform-android": "20.0.0","@react-native-community/cli-platform-ios": "20.0.0",diff --git a/src/assets/icons/center.png b/src/assets/icons/center.pngdeleted file mode 100644index 3cb56b4d..00000000Binary files a/src/assets/icons/center.png and /dev/null differdiff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsxindex 33b87b31..bfb04e0a 100644--- a/src/components/ErrorBoundary.tsx+++ b/src/components/ErrorBoundary.tsx@@ -2,56 +2,49 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { Component } from "react";-import { View, Text, StyleSheet, TouchableOpacity } from "react-native";-import { ThemeColors } from "../types/global";+import React, { Component } from "react"+import { View, Text, StyleSheet, TouchableOpacity } from "react-native"+import { ThemeColors } from "../types/global"interface ErrorBoundaryProps {- children: React.ReactNode;- colors: ThemeColors;+ children: React.ReactNode+ colors: ThemeColors}interface ErrorBoundaryState {- hasError: boolean;- error: Error | null;+ hasError: boolean+ error: Error | null}class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {constructor(props: ErrorBoundaryProps) {- super(props);- this.state = { hasError: false, error: null };+ super(props)+ this.state = { hasError: false, error: null }}static getDerivedStateFromError(error: Error): ErrorBoundaryState {- return { hasError: true, error };+ return { hasError: true, error }}componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {// Log to error reporting service (e.g., Sentry, Crashlytics)- console.error("ErrorBoundary caught an error:", error, errorInfo);+ console.error("ErrorBoundary caught an error:", error, errorInfo)// You can add error tracking here:// Sentry.captureException(error);}handleReset = () => {- this.setState({ hasError: false, error: null });- };+ this.setState({ hasError: false, error: null })+ }render() {- const { colors, children } = this.props;+ const { colors, children } = this.propsif (this.state.hasError) {return (- <View- style={[- styles.errorContainer,- { backgroundColor: colors.background },- ]}- >- <Text style={[styles.errorTitle, { color: colors.text }]}>- Something went wrong- </Text>+ <View style={[styles.errorContainer, { backgroundColor: colors.background }]}>+ <Text style={[styles.errorTitle, { color: colors.text }]}>Something went wrong</Text><Text style={[styles.errorMessage, { color: colors.textSecondary }]}>{this.state.error?.message || "An unexpected error occurred"}</Text>@@ -62,10 +55,10 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {<Text style={styles.errorButtonText}>Try Again</Text></TouchableOpacity></View>- );+ )}- return children;+ return children}}@@ -74,29 +67,29 @@ const styles = StyleSheet.create({flex: 1,justifyContent: "center",alignItems: "center",- padding: 20,+ padding: 20},errorTitle: {fontSize: 24,fontWeight: "bold",- marginBottom: 10,+ marginBottom: 10},errorMessage: {fontSize: 16,textAlign: "center",marginBottom: 20,- paddingHorizontal: 20,+ paddingHorizontal: 20},errorButton: {paddingHorizontal: 24,paddingVertical: 12,- borderRadius: 8,+ borderRadius: 8},errorButtonText: {fontSize: 16,color: "#fff",- fontWeight: "600",- },-});+ fontWeight: "600"+ }+})-export default ErrorBoundary;+export default ErrorBoundarydiff --git a/src/components/ThemedErrorBoundary.tsx b/src/components/ThemedErrorBoundary.tsxindex c2c06583..c887650d 100644--- a/src/components/ThemedErrorBoundary.tsx+++ b/src/components/ThemedErrorBoundary.tsx@@ -2,20 +2,18 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { useTheme } from "../hooks/useTheme";-import ErrorBoundary from "./ErrorBoundary";+import React from "react"+import { useTheme } from "../hooks/useTheme"+import ErrorBoundary from "./ErrorBoundary"interface ThemedErrorBoundaryProps {- children: React.ReactNode;+ children: React.ReactNode}-const ThemedErrorBoundary: React.FC<ThemedErrorBoundaryProps> = ({- children,-}) => {- const { colors } = useTheme();+const ThemedErrorBoundary: React.FC<ThemedErrorBoundaryProps> = ({ children }) => {+ const { colors } = useTheme()- return <ErrorBoundary colors={colors}>{children}</ErrorBoundary>;-};+ return <ErrorBoundary colors={colors}>{children}</ErrorBoundary>+}-export default ThemedErrorBoundary;+export default ThemedErrorBoundarydiff --git a/src/components/features/dashboard/ComingSoonRibbon.tsx b/src/components/features/dashboard/ComingSoonRibbon.tsxindex 480acaae..971bf748 100644--- a/src/components/features/dashboard/ComingSoonRibbon.tsx+++ b/src/components/features/dashboard/ComingSoonRibbon.tsx@@ -3,27 +3,22 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, StyleSheet, ViewStyle, StyleProp, Text } from "react-native";-import { useTheme } from "../../../hooks/useTheme";+import React from "react"+import { View, StyleSheet, ViewStyle, StyleProp, Text } from "react-native"+import { useTheme } from "../../../hooks/useTheme"type ComingSoonRibbonProps = {- style?: StyleProp<ViewStyle>;-};+ style?: StyleProp<ViewStyle>+}export function ComingSoonRibbon({}: ComingSoonRibbonProps) {- const { colors } = useTheme();+ const { colors } = useTheme()return (- <View- style={[- styles.comingSoonRibbon,- { backgroundColor: colors.warning, shadowColor: colors.shadow },- ]}- >+ <View style={[styles.comingSoonRibbon, { backgroundColor: colors.warning, shadowColor: colors.shadow }]}><Text style={styles.comingSoonRibbonText}>Coming Soon</Text></View>- );+ )}const styles = StyleSheet.create({@@ -38,12 +33,12 @@ const styles = StyleSheet.create({elevation: 10,shadowOffset: { width: 0, height: 1 },shadowOpacity: 0.3,- shadowRadius: 2,+ shadowRadius: 2},comingSoonRibbonText: {fontSize: 9,fontWeight: "700",textAlign: "center",- letterSpacing: 0.5,- },-});+ letterSpacing: 0.5+ }+})diff --git a/src/components/features/dashboard/CoordinateDisplay.tsx b/src/components/features/dashboard/CoordinateDisplay.tsxindex 9fc0d953..2019d172 100644--- a/src/components/features/dashboard/CoordinateDisplay.tsx+++ b/src/components/features/dashboard/CoordinateDisplay.tsx@@ -3,20 +3,20 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet } from "react-native";-import { LocationCoords } from "../../../types/global";-import { useTheme } from "../../../hooks/useTheme";-import { SectionTitle } from "../../ui/SectionTitle";-import { Card } from "../../ui/Card";+import React from "react"+import { View, Text, StyleSheet } from "react-native"+import { LocationCoords } from "../../../types/global"+import { useTheme } from "../../../hooks/useTheme"+import { SectionTitle } from "../../ui/SectionTitle"+import { Card } from "../../ui/Card"/*** Props for the CoordinateDisplay component*/type Props = {/** Location coordinates object containing latitude, longitude, altitude, accuracy, speed, and bearing */- coords: LocationCoords;-};+ coords: LocationCoords+}/*** Displays location data in a responsive grid layout with six metric cards.@@ -41,28 +41,26 @@ type Props = {* ```*/export function CoordinateDisplay({ coords }: Props) {- const { colors } = useTheme();+ const { colors } = useTheme()// Format values with appropriate precision and fallbacks- const latitude = coords.latitude?.toFixed(6) ?? "0.000000";- const longitude = coords.longitude?.toFixed(6) ?? "0.000000";- const altitude = Math.round(coords.altitude ?? 0);- const accuracy = coords.accuracy?.toFixed(1) ?? "0.0";+ const latitude = coords.latitude?.toFixed(6) ?? "0.000000"+ const longitude = coords.longitude?.toFixed(6) ?? "0.000000"+ const altitude = Math.round(coords.altitude ?? 0)+ const accuracy = coords.accuracy?.toFixed(1) ?? "0.0"/*** Renders a single coordinate metric card*/const renderCard = (label: string, value: string, unit: string) => (<Card style={[{ backgroundColor: colors.backgroundElevated }]}>- <Text style={[styles.coordLabel, { color: colors.textSecondary }]}>- {label}- </Text>+ <Text style={[styles.coordLabel, { color: colors.textSecondary }]}>{label}</Text><Text style={[styles.coordValue, { color: colors.text }]}>{value}<Text style={styles.coordUnit}> {unit}</Text></Text></Card>- );+ )return (<>@@ -81,38 +79,38 @@ export function CoordinateDisplay({ coords }: Props) {</View></View></>- );+ )}const styles = StyleSheet.create({container: {- gap: 10,+ gap: 10},row: {flexDirection: "row",- gap: 10,+ gap: 10},coordCard: {flex: 1,padding: 12,borderRadius: 8,- borderWidth: 1,+ borderWidth: 1},coordLabel: {fontSize: 10,fontWeight: "600",marginBottom: 4,letterSpacing: 0.5,- textTransform: "uppercase",+ textTransform: "uppercase"},coordValue: {fontSize: 15,fontWeight: "700",- letterSpacing: -0.3,+ letterSpacing: -0.3},coordUnit: {fontSize: 12,fontWeight: "500",- opacity: 0.6,- },-});+ opacity: 0.6+ }+})diff --git a/src/components/features/dashboard/DashboardMap.tsx b/src/components/features/dashboard/DashboardMap.tsxindex 0e74a73b..05faea4b 100644--- a/src/components/features/dashboard/DashboardMap.tsx+++ b/src/components/features/dashboard/DashboardMap.tsx@@ -3,91 +3,76 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, {- useRef,- useEffect,- useMemo,- useState,- useCallback,-} from "react";-import {- View,- StyleSheet,- Text,- ActivityIndicator,- DeviceEventEmitter,- Image,-} from "react-native";-import { WebView } from "react-native-webview";-import { LocationCoords } from "../../../types/global";-import { useTheme } from "../../../hooks/useTheme";-import NativeLocationService from "../../../services/NativeLocationService";-import { MapCenterButton } from "../map/MapCenterButton";-import icon from "../../../assets/icons/icon.png";+import React, { useRef, useEffect, useMemo, useState, useCallback } from "react"+import { View, StyleSheet, Text, ActivityIndicator, DeviceEventEmitter, Image } from "react-native"+import { WebView } from "react-native-webview"+import { LocationCoords } from "../../../types/global"+import { useTheme } from "../../../hooks/useTheme"+import NativeLocationService from "../../../services/NativeLocationService"+import { MapCenterButton } from "../map/MapCenterButton"+import icon from "../../../assets/icons/icon.png"type Props = {- coords: LocationCoords | null;- tracking: boolean;- isPaused: boolean;- activeZoneName: string | null;-};+ coords: LocationCoords | null+ tracking: boolean+ isPaused: boolean+ activeZoneName: string | null+}export function DashboardMap({ coords, tracking, activeZoneName }: Props) {- const webviewRef = useRef<WebView>(null);- const { colors, mode } = useTheme();- const isDark = mode === "dark";- const [geofences, setGeofences] = useState<any[]>([]);- const [isCentered, setIsCentered] = useState(true);- const [mapReady, setMapReady] = useState(false);- const initialCoords = useRef<LocationCoords | null>(null);- const [hasInitialCoords, setHasInitialCoords] = useState(false);-- const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(- null- );+ const webviewRef = useRef<WebView>(null)+ const { colors, mode } = useTheme()+ const isDark = mode === "dark"+ const [geofences, setGeofences] = useState<any[]>([])+ const [isCentered, setIsCentered] = useState(true)+ const [mapReady, setMapReady] = useState(false)+ const initialCoords = useRef<LocationCoords | null>(null)+ const [hasInitialCoords, setHasInitialCoords] = useState(false)++ const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(null)const isValidCoords = (c: LocationCoords | null): c is LocationCoords => {- return c !== null && c.latitude !== 0 && c.longitude !== 0;- };+ return c !== null && c.latitude !== 0 && c.longitude !== 0+ }useEffect(() => {if (!initialCoords.current && coords) {- initialCoords.current = coords;- setHasInitialCoords(true);+ initialCoords.current = coords+ setHasInitialCoords(true)}- }, [coords]);+ }, [coords])const loadGeofences = useCallback(async () => {try {- const data = await NativeLocationService.getGeofences();- setGeofences(data);+ const data = await NativeLocationService.getGeofences()+ setGeofences(data)} catch (err) {- console.error("[GeofenceScreen] Failed to load geofences:", err);+ console.error("[GeofenceScreen] Failed to load geofences:", err)}- }, []);+ }, [])useEffect(() => {- loadGeofences();- }, [loadGeofences]);+ loadGeofences()+ }, [loadGeofences])// Check for silent zoneuseEffect(() => {const checkSilentZone = async () => {try {- const zoneName = await NativeLocationService.checkCurrentSilentZone();- setCurrentSilentZone(zoneName);+ const zoneName = await NativeLocationService.checkCurrentSilentZone()+ setCurrentSilentZone(zoneName)} catch (err) {- console.error("[GeofenceScreen] Failed to check silent zone:", err);+ console.error("[GeofenceScreen] Failed to check silent zone:", err)}- };+ }- checkSilentZone();+ checkSilentZone()const listener = DeviceEventEmitter.addListener("geofenceUpdated", () => {- checkSilentZone();- loadGeofences(); // Reload geofences when they're updated- });- return () => listener.remove();- }, [loadGeofences]);+ checkSilentZone()+ loadGeofences() // Reload geofences when they're updated+ })+ return () => listener.remove()+ }, [loadGeofences])// Update user positionuseEffect(() => {@@ -97,11 +82,11 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {action: "update_user_pos",coords,tracking,- isPaused: !!currentSilentZone,+ isPaused: !!currentSilentZone})- );+ )}- }, [coords, mapReady, tracking, currentSilentZone]);+ }, [coords, mapReady, tracking, currentSilentZone])// Update geofencesuseEffect(() => {@@ -109,24 +94,22 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {webviewRef.current.postMessage(JSON.stringify({action: "update_geofences",- geofences,+ geofences})- );+ )}- }, [geofences, mapReady]);+ }, [geofences, mapReady])const handleCenterMe = useCallback(() => {if (coords) {- webviewRef.current?.postMessage(- JSON.stringify({ action: "center_map", coords })- );+ webviewRef.current?.postMessage(JSON.stringify({ action: "center_map", coords }))}- }, [coords]);+ }, [coords])const html = useMemo(() => {- if (!hasInitialCoords || !initialCoords.current) return "";+ if (!hasInitialCoords || !initialCoords.current) return ""- const lon = initialCoords.current.longitude;- const lat = initialCoords.current.latitude;+ const lon = initialCoords.current.longitude+ const lat = initialCoords.current.latitudereturn `<!DOCTYPE html>@@ -215,9 +198,7 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {}.ol-attribution {- background: ${- isDark ? "rgba(0,0,0,0.85)" : "rgba(255,255,255,0.95)"- } !important;+ background: ${isDark ? "rgba(0,0,0,0.85)" : "rgba(255,255,255,0.95)"} !important;padding: 4px 8px !important;font-size: 11px !important;-webkit-font-smoothing: antialiased !important;@@ -234,11 +215,7 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {text-decoration: none !important;}- ${- isDark- ? ".ol-layer canvas { filter: brightness(0.6) contrast(1.2) saturate(0.8); }"- : ""- }+ ${isDark ? ".ol-layer canvas { filter: brightness(0.6) contrast(1.2) saturate(0.8); }" : ""}</style></head><body>@@ -304,16 +281,12 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {feature.setStyle(new ol.style.Style({stroke: new ol.style.Stroke({- color: zone.pauseTracking ? "${colors.warning}" : "${- colors.info- }",+ color: zone.pauseTracking ? "${colors.warning}" : "${colors.info}",width: 2,lineDash: zone.pauseTracking ? null : [5, 5]}),fill: new ol.style.Fill({- color: zone.pauseTracking ? "${colors.warning}4D" : "${- colors.info- }1A"+ color: zone.pauseTracking ? "${colors.warning}4D" : "${colors.info}1A"}),}));@@ -325,9 +298,7 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {text: zone.name,font: "bold 12px sans-serif",fill: new ol.style.Fill({- color: zone.pauseTracking ? "${colors.warning}" : "${- colors.info- }"+ color: zone.pauseTracking ? "${colors.warning}" : "${colors.info}"}),stroke: new ol.style.Stroke({ color: "#fff", width: 3 }),offsetY: -25@@ -388,9 +359,7 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {if (markerIcon && markerPulse) {const isActive = data.tracking && !data.isPaused;- const markerColor = data.isPaused ? "${colors.textDisabled}" : "${- colors.primary- }";+ const markerColor = data.isPaused ? "${colors.textDisabled}" : "${colors.primary}";markerIcon.style.background = markerColor;markerPulse.style.borderColor = markerColor;@@ -444,53 +413,31 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {</script></body></html>-`;- }, [colors, isDark, hasInitialCoords]);+`+ }, [colors, isDark, hasInitialCoords])if (!tracking) {return (- <View- style={[- styles.stateContainer,- { backgroundColor: colors.card, borderRadius: colors.borderRadius },- ]}- >+ <View style={[styles.stateContainer, { backgroundColor: colors.card, borderRadius: colors.borderRadius }]}><View style={[styles.iconCircle, { backgroundColor: colors.border }]}><Image source={icon} style={styles.icon} /></View>- <Text style={[styles.stateTitle, { color: colors.text }]}>- Tracking Disabled- </Text>+ <Text style={[styles.stateTitle, { color: colors.text }]}>Tracking Disabled</Text><Text style={[styles.stateSubtext, { color: colors.textSecondary }]}>Start tracking to see your position and zones.</Text></View>- );+ )}if (!isValidCoords(coords)) {return (- <View- style={[- styles.stateContainer,- { backgroundColor: colors.card, borderRadius: colors.borderRadius },- ]}- >+ <View style={[styles.stateContainer, { backgroundColor: colors.card, borderRadius: colors.borderRadius }]}><ActivityIndicator size="large" color={colors.primary} />- <Text- style={[- styles.stateTitle,- styles.stateTitleSpaced,- { color: colors.text },- ]}- >- Searching GPS...- </Text>- <Text style={[styles.stateSubtext, { color: colors.textSecondary }]}>- Waiting for valid location signal.- </Text>+ <Text style={[styles.stateTitle, styles.stateTitleSpaced, { color: colors.text }]}>Searching GPS...</Text>+ <Text style={[styles.stateSubtext, { color: colors.textSecondary }]}>Waiting for valid location signal.</Text></View>- );+ )}return (@@ -501,26 +448,26 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {originWhitelist={["*"]}source={{html: html,- baseUrl: "file:///android_asset/",+ baseUrl: "file:///android_asset/"}}style={styles.webview}scrollEnabled={false}startInLoadingState={false}onMessage={(event) => {try {- const data = JSON.parse(event.nativeEvent.data);+ const data = JSON.parse(event.nativeEvent.data)if (data.type === "MAP_READY") {- setMapReady(true);+ setMapReady(true)// 1. Send Geofences immediately on readyif (geofences.length > 0) {webviewRef.current?.postMessage(JSON.stringify({action: "update_geofences",- geofences,+ geofences})- );+ )}// 2. Send current position immediately on ready@@ -530,32 +477,24 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {action: "update_user_pos",coords,tracking,- isPaused: !!currentSilentZone,+ isPaused: !!currentSilentZone})- );+ )}}if (data.type === "CENTERED") {- setIsCentered(data.value);+ setIsCentered(data.value)}} catch (err) {- console.error("WebView message error:", err);+ console.error("WebView message error:", err)}}}/>) : (<View style={[styles.stateContainer, { backgroundColor: colors.card }]}><ActivityIndicator size="large" color={colors.primary} />- <Text- style={[- styles.stateTitle,- styles.stateTitleSpaced,- { color: colors.text },- ]}- >- Loading Map...- </Text>+ <Text style={[styles.stateTitle, styles.stateTitleSpaced, { color: colors.text }]}>Loading Map...</Text></View>)}@@ -567,20 +506,16 @@ export function DashboardMap({ coords, tracking, activeZoneName }: Props) {styles.topInfoCard,{backgroundColor: colors.card,- borderLeftColor: colors.warning,- },+ borderLeftColor: colors.warning+ }]}>- <Text style={[styles.infoTitle, { color: colors.text }]}>- Paused in {activeZoneName}- </Text>- <Text style={[styles.infoSub, { color: colors.textSecondary }]}>- Location not being recorded- </Text>+ <Text style={[styles.infoTitle, { color: colors.text }]}>Paused in {activeZoneName}</Text>+ <Text style={[styles.infoSub, { color: colors.textSecondary }]}>Location not being recorded</Text></View>)}</View>- );+ )}const styles = StyleSheet.create({@@ -590,7 +525,7 @@ const styles = StyleSheet.create({flex: 1,justifyContent: "center",alignItems: "center",- padding: 24,+ padding: 24},icon: { width: 64, height: 64 },iconCircle: {@@ -599,7 +534,7 @@ const styles = StyleSheet.create({borderRadius: 40,justifyContent: "center",alignItems: "center",- marginBottom: 16,+ marginBottom: 16},stateTitle: { fontSize: 18, fontWeight: "bold", textAlign: "center" },stateTitleSpaced: { marginTop: 20 },@@ -607,7 +542,7 @@ const styles = StyleSheet.create({fontSize: 14,textAlign: "center",marginTop: 8,- lineHeight: 20,+ lineHeight: 20},topInfoCard: {position: "absolute",@@ -619,8 +554,8 @@ const styles = StyleSheet.create({elevation: 8,shadowOpacity: 0.2,borderLeftWidth: 5,- zIndex: 5,+ zIndex: 5},infoTitle: { fontSize: 16, fontWeight: "bold", marginBottom: 2 },- infoSub: { fontSize: 13 },-});+ infoSub: { fontSize: 13 }+})diff --git a/src/components/features/dashboard/QuickAccess.tsx b/src/components/features/dashboard/QuickAccess.tsxindex d2b48104..b32dbf7d 100644--- a/src/components/features/dashboard/QuickAccess.tsx+++ b/src/components/features/dashboard/QuickAccess.tsx@@ -2,33 +2,27 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import {- View,- StyleSheet,- Text,- TouchableOpacity,- Linking,-} from "react-native";-import { useTheme } from "../../../hooks/useTheme";-import { SectionTitle } from "../../ui/SectionTitle";-import { ComingSoonRibbon } from "./ComingSoonRibbon";+import React from "react"+import { View, StyleSheet, Text, TouchableOpacity, Linking } from "react-native"+import { useTheme } from "../../../hooks/useTheme"+import { SectionTitle } from "../../ui/SectionTitle"+import { ComingSoonRibbon } from "./ComingSoonRibbon"interface NavItem {- name: string;- icon: string;- color: string;- onPress?: () => void;- comingSoon?: boolean;- subtitle?: string;+ name: string+ icon: string+ color: string+ onPress?: () => void+ comingSoon?: boolean+ subtitle?: string}interface QuickAccessProps {- navigation: any;+ navigation: any}export function QuickAccess({ navigation }: QuickAccessProps) {- const { colors } = useTheme();+ const { colors } = useTheme()const navItems: NavItem[] = [{@@ -36,44 +30,44 @@ export function QuickAccess({ navigation }: QuickAccessProps) {icon: "⚙️",color: colors.primary,subtitle: "Configure tracking",- onPress: () => navigation.navigate("Settings"),+ onPress: () => navigation.navigate("Settings")},{name: "Geofences",icon: "🏡",color: colors.success,subtitle: "Manage zones",- onPress: () => navigation.navigate("Geofences"),+ onPress: () => navigation.navigate("Geofences")},{name: "Inspector",icon: "🔍",color: colors.info,subtitle: "View locations",- onPress: () => navigation.navigate("Locations Inspector"),+ onPress: () => navigation.navigate("Locations Inspector")},{name: "Export",icon: "📤",color: colors.warning,subtitle: "Download data",- onPress: () => navigation.navigate("Export Data"),+ onPress: () => navigation.navigate("Export Data")},{name: "About",icon: "ℹ️",color: colors.info,subtitle: "App info",- onPress: () => navigation.navigate("About Colota"),+ onPress: () => navigation.navigate("About Colota")},{name: "Support",icon: "💖",color: colors.error,subtitle: "Help us grow",- onPress: () => Linking.openURL("https://mxd.codes/colota/support"),- },- ];+ onPress: () => Linking.openURL("https://mxd.codes/colota/support")+ }+ ]return (<View style={styles.container}>@@ -87,8 +81,8 @@ export function QuickAccess({ navigation }: QuickAccessProps) {styles.navItem,{backgroundColor: colors.card,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}onPress={item.onPress}>@@ -98,27 +92,21 @@ export function QuickAccess({ navigation }: QuickAccessProps) {styles.navIconBox,{backgroundColor: item.color + "15",- borderColor: item.color + "30",- },+ borderColor: item.color + "30"+ }]}><Text style={styles.navIcon}>{item.icon}</Text></View>{/* Title */}- <Text- style={[styles.navLabel, { color: colors.text }]}- numberOfLines={1}- >+ <Text style={[styles.navLabel, { color: colors.text }]} numberOfLines={1}>{item.name}</Text>{/* Subtitle */}{item.subtitle && (- <Text- style={[styles.navSubtitle, { color: colors.textSecondary }]}- numberOfLines={1}- >+ <Text style={[styles.navSubtitle, { color: colors.textSecondary }]} numberOfLines={1}>{item.subtitle}</Text>)}@@ -128,17 +116,17 @@ export function QuickAccess({ navigation }: QuickAccessProps) {))}</View></View>- );+ )}const styles = StyleSheet.create({container: {- marginBottom: 16,+ marginBottom: 16},navGrid: {flexDirection: "row",flexWrap: "wrap",- gap: 12,+ gap: 12},navItem: {width: "31%",@@ -152,7 +140,7 @@ const styles = StyleSheet.create({shadowOffset: { width: 0, height: 2 },shadowOpacity: 0.05,shadowRadius: 4,- elevation: 2,+ elevation: 2},navIconBox: {width: 48,@@ -161,21 +149,21 @@ const styles = StyleSheet.create({justifyContent: "center",alignItems: "center",marginBottom: 8,- borderWidth: 1,+ borderWidth: 1},navIcon: {- fontSize: 24,+ fontSize: 24},navLabel: {fontSize: 12,fontWeight: "700",textAlign: "center",letterSpacing: 0.3,- marginBottom: 2,+ marginBottom: 2},navSubtitle: {fontSize: 10,textAlign: "center",- opacity: 0.7,- },-});+ opacity: 0.7+ }+})diff --git a/src/components/features/databases/DatabaseStatistics.tsx b/src/components/features/databases/DatabaseStatistics.tsxindex 087325bc..2f541fa2 100644--- a/src/components/features/databases/DatabaseStatistics.tsx+++ b/src/components/features/databases/DatabaseStatistics.tsx@@ -2,19 +2,19 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { Text, StyleSheet, View } from "react-native";-import { SectionTitle, Card } from "../..";-import { useTheme } from "../../../hooks/useTheme";-import { getQueueColor } from "../../../helpers/queueStatus";+import React from "react"+import { Text, StyleSheet, View } from "react-native"+import { SectionTitle, Card } from "../.."+import { useTheme } from "../../../hooks/useTheme"+import { getQueueColor } from "../../../helpers/queueStatus"type DatabaseStatisticsProps = {- stats: any;-};+ stats: any+}export function DatabaseStatistics({ stats }: DatabaseStatisticsProps) {- const { colors } = useTheme();- const queuedColor = getQueueColor(stats.queued, colors);+ const { colors } = useTheme()+ const queuedColor = getQueueColor(stats.queued, colors)return (<>@@ -26,37 +26,25 @@ export function DatabaseStatistics({ stats }: DatabaseStatisticsProps) {style={[styles.statCard,{- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Queued- </Text>- <Text style={[styles.statValue, { color: queuedColor }]}>- {stats.queued.toLocaleString()}- </Text>- <Text style={[styles.statUnit, { color: colors.textLight }]}>- pending- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Queued</Text>+ <Text style={[styles.statValue, { color: queuedColor }]}>{stats.queued.toLocaleString()}</Text>+ <Text style={[styles.statUnit, { color: colors.textLight }]}>pending</Text></Card><Cardstyle={[styles.statCard,{- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Sent- </Text>- <Text style={[styles.statValue, { color: colors.success }]}>- {stats.sent.toLocaleString()}- </Text>- <Text style={[styles.statUnit, { color: colors.textLight }]}>- synced- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Sent</Text>+ <Text style={[styles.statValue, { color: colors.success }]}>{stats.sent.toLocaleString()}</Text>+ <Text style={[styles.statUnit, { color: colors.textLight }]}>synced</Text></Card></View><View style={[styles.statsGrid, styles.statsGridSpaced]}>@@ -64,73 +52,61 @@ export function DatabaseStatistics({ stats }: DatabaseStatisticsProps) {style={[styles.statCard,{- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Today- </Text>- <Text style={[styles.statValue, { color: colors.info }]}>- {stats.today.toLocaleString()}- </Text>- <Text style={[styles.statUnit, { color: colors.textLight }]}>- tracked- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Today</Text>+ <Text style={[styles.statValue, { color: colors.info }]}>{stats.today.toLocaleString()}</Text>+ <Text style={[styles.statUnit, { color: colors.textLight }]}>tracked</Text></Card><Cardstyle={[styles.statCard,{- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Storage- </Text>- <Text style={[styles.statValue, { color: colors.primary }]}>- {stats.databaseSizeMB.toFixed(1)}- </Text>- <Text style={[styles.statUnit, { color: colors.textLight }]}>- MB- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Storage</Text>+ <Text style={[styles.statValue, { color: colors.primary }]}>{stats.databaseSizeMB.toFixed(1)}</Text>+ <Text style={[styles.statUnit, { color: colors.textLight }]}>MB</Text></Card></View></View></>- );+ )}const styles = StyleSheet.create({metricsSection: {- marginBottom: 24,+ marginBottom: 24},statsGrid: {flexDirection: "row",- gap: 12,+ gap: 12},statsGridSpaced: {- marginTop: 12,+ marginTop: 12},statCard: {- alignItems: "center",+ alignItems: "center"},statUnit: {fontSize: 11,- fontWeight: "500",+ fontWeight: "500"},statLabel: {fontSize: 10,fontWeight: "600",marginBottom: 6,letterSpacing: 0.5,- textTransform: "uppercase",+ textTransform: "uppercase"},statValue: {fontSize: 24,fontWeight: "700",letterSpacing: -0.5,- marginBottom: 2,- },-});+ marginBottom: 2+ }+})diff --git a/src/components/features/map/MapCenterButton.tsx b/src/components/features/map/MapCenterButton.tsxindex 91fb1f35..85c81618 100644--- a/src/components/features/map/MapCenterButton.tsx+++ b/src/components/features/map/MapCenterButton.tsx@@ -3,78 +3,38 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import {- TouchableOpacity,- View,- StyleSheet,- ViewStyle,- StyleProp,-} from "react-native";-import { useTheme } from "../../../hooks/useTheme";+import React from "react"+import { TouchableOpacity, View, StyleSheet, ViewStyle, StyleProp } from "react-native"+import { useTheme } from "../../../hooks/useTheme"interface Props {- onPress: () => void;- visible: boolean;- style?: StyleProp<ViewStyle>;+ onPress: () => void+ visible: boolean+ style?: StyleProp<ViewStyle>}-export const MapCenterButton: React.FC<Props> = ({- onPress,- visible,- style,-}) => {- const { colors } = useTheme();+export const MapCenterButton: React.FC<Props> = ({ onPress, visible, style }) => {+ const { colors } = useTheme()- if (!visible) return null;+ if (!visible) return nullreturn (<TouchableOpacity- style={[- styles.centerButton,- { backgroundColor: colors.card, borderColor: colors.border },- style,- ]}+ style={[styles.centerButton, { backgroundColor: colors.card, borderColor: colors.border }, style]}onPress={onPress}activeOpacity={0.7}><View style={[styles.crosshairOuter, { borderColor: colors.text }]}>- <View- style={[styles.crosshairInner, { backgroundColor: colors.text }]}- />+ <View style={[styles.crosshairInner, { backgroundColor: colors.text }]} />{/* The four notches */}- <View- style={[- styles.notch,- styles.notchTop,- { backgroundColor: colors.text },- ]}- />- <View- style={[- styles.notch,- styles.notchBottom,- { backgroundColor: colors.text },- ]}- />- <View- style={[- styles.notch,- styles.notchLeft,- { backgroundColor: colors.text },- ]}- />- <View- style={[- styles.notch,- styles.notchRight,- { backgroundColor: colors.text },- ]}- />+ <View style={[styles.notch, styles.notchTop, { backgroundColor: colors.text }]} />+ <View style={[styles.notch, styles.notchBottom, { backgroundColor: colors.text }]} />+ <View style={[styles.notch, styles.notchLeft, { backgroundColor: colors.text }]} />+ <View style={[styles.notch, styles.notchRight, { backgroundColor: colors.text }]} /></View></TouchableOpacity>- );-};+ )+}const styles = StyleSheet.create({centerButton: {@@ -92,7 +52,7 @@ const styles = StyleSheet.create({shadowOpacity: 0.25,shadowRadius: 3.84,borderWidth: 1,- zIndex: 10,+ zIndex: 10},crosshairOuter: {width: 20,@@ -101,38 +61,38 @@ const styles = StyleSheet.create({borderWidth: 2,alignItems: "center",justifyContent: "center",- position: "relative",+ position: "relative"},crosshairInner: {width: 6,height: 6,- borderRadius: 3,+ borderRadius: 3},notch: {- position: "absolute",+ position: "absolute"},notchTop: {top: -6,width: 2,height: 5,- left: 7,+ left: 7},notchBottom: {bottom: -6,width: 2,height: 5,- left: 7,+ left: 7},notchLeft: {left: -6,width: 5,height: 2,- top: 7,+ top: 7},notchRight: {right: -6,width: 5,height: 2,- top: 7,- },-});+ top: 7+ }+})diff --git a/src/components/features/settings/PermissionsDashboard.tsx b/src/components/features/settings/PermissionsDashboard.tsxdeleted file mode 100644index 0651d53a..00000000--- a/src/components/features/settings/PermissionsDashboard.tsx+++ /dev/null@@ -1,119 +0,0 @@-/**- * Copyright (C) 2026 Max Dietrich- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.- */--import React, { useEffect, useState, useCallback } from "react";-import { View, Text, StyleSheet, ActivityIndicator } from "react-native";-import {- checkPermissions,- PermissionStatus,- ensurePermissions,-} from "../../../services/LocationServicePermission";-import { useTheme } from "../../../hooks/useTheme";-import { Container, Button } from "../..";--type RowProps = {- label: string;- isGranted: boolean;- colors: any;-};--const PermissionRow = ({ label, isGranted, colors }: RowProps) => (- <View style={[styles.row, { borderBottomColor: colors.border }]}>- <Text style={[styles.label, { color: colors.textSecondary }]}>{label}</Text>- <Text- style={[- styles.status,- { color: isGranted ? colors.success : colors.error },- ]}- >- {isGranted ? "✅ Active" : "❌ Missing"}- </Text>- </View>-);--export const PermissionDashboard = () => {- const [status, setStatus] = useState<PermissionStatus | null>(null);- const [loading, setLoading] = useState(true);-- const { colors } = useTheme();-- const refreshStatus = useCallback(async () => {- setLoading(true);- const currentStatus = await checkPermissions();- setStatus(currentStatus);- setLoading(false);- }, []);-- useEffect(() => {- refreshStatus();- }, [refreshStatus]);-- const handleFix = async () => {- const success = await ensurePermissions();- if (success) refreshStatus();- };-- if (loading && !status) {- return (- <View style={styles.loader}>- <ActivityIndicator size="large" color={colors.primary} />- </View>- );- }-- return (- <Container>- <Text style={[styles.title, { color: colors.text }]}>- Tracking-Status- </Text>-- <PermissionRow- label="Standort (Präzise)"- isGranted={status?.location ?? false}- colors={colors}- />- <PermissionRow- label="Hintergrund-Zugriff"- isGranted={status?.background ?? false}- colors={colors}- />- <PermissionRow- label="Benachrichtigungen"- isGranted={status?.notifications ?? false}- colors={colors}- />- <PermissionRow- label="Akku-Optimierung aus"- isGranted={status?.batteryOptimized ?? false}- colors={colors}- />-- {(!status?.location ||- !status?.background ||- !status?.notifications ||- !status?.batteryOptimized) && (- <View style={styles.buttonContainer}>- <Button onPress={handleFix} title="Request missing permissions" />- </View>- )}- </Container>- );-};--const styles = StyleSheet.create({- loader: { flex: 1, justifyContent: "center", alignItems: "center" },- title: { fontSize: 18, fontWeight: "bold", marginBottom: 12 },- row: {- flexDirection: "row",- justifyContent: "space-between",- paddingVertical: 12,- borderBottomWidth: StyleSheet.hairlineWidth,- },- label: { fontSize: 14 },- status: { fontSize: 14, fontWeight: "600" },- buttonContainer: {- marginTop: 24,- },-});diff --git a/src/components/features/settings/PresetOption.tsx b/src/components/features/settings/PresetOption.tsxindex 8b5cc965..564088c4 100644--- a/src/components/features/settings/PresetOption.tsx+++ b/src/components/features/settings/PresetOption.tsx@@ -2,19 +2,15 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet, TouchableOpacity } from "react-native";-import {- ThemeColors,- SelectablePreset,- TRACKING_PRESETS,-} from "../../../types/global";+import React from "react"+import { View, Text, StyleSheet, TouchableOpacity } from "react-native"+import { ThemeColors, SelectablePreset, TRACKING_PRESETS } from "../../../types/global"interface PresetOptionProps {- preset: SelectablePreset;- isSelected: boolean;- onSelect: (preset: SelectablePreset) => void;- colors: ThemeColors;+ preset: SelectablePreset+ isSelected: boolean+ onSelect: (preset: SelectablePreset) => void+ colors: ThemeColors}/**@@ -26,37 +22,26 @@ interface PresetOptionProps {* - Improved selection states* - More accessible touch targets*/-export function PresetOption({- preset,- isSelected,- onSelect,- colors,-}: PresetOptionProps) {- const config = TRACKING_PRESETS[preset];- const showRecommendedBadge = preset === "balanced";- const showWarningBadge = config.batteryImpact === "High";+export function PresetOption({ preset, isSelected, onSelect, colors }: PresetOptionProps) {+ const config = TRACKING_PRESETS[preset]+ const showRecommendedBadge = preset === "balanced"+ const showWarningBadge = config.batteryImpact === "High"- const radioBgColor = isSelected ? colors.primary + "20" : "transparent";+ const radioBgColor = isSelected ? colors.primary + "20" : "transparent"return (<TouchableOpacitystyle={[styles.container,{- backgroundColor: isSelected- ? colors.primary + "12"- : colors.background,- },+ backgroundColor: isSelected ? colors.primary + "12" : colors.background+ }]}onPress={() => onSelect(preset)}activeOpacity={0.7}>{/* Selection indicator bar */}- {isSelected && (- <View- style={[styles.selectionBar, { backgroundColor: colors.primary }]}- />- )}+ {isSelected && <View style={[styles.selectionBar, { backgroundColor: colors.primary }]} />}<View style={styles.content}>{/* Left side - Icon and text */}@@ -64,22 +49,18 @@ export function PresetOption({<Text style={styles.emoji}>{config.emoji}</Text><View style={styles.textContent}><View style={styles.titleRow}>- <Text style={[styles.label, { color: colors.text }]}>- {config.label}- </Text>+ <Text style={[styles.label, { color: colors.text }]}>{config.label}</Text>{showRecommendedBadge && (<Viewstyle={[styles.badge,{backgroundColor: colors.success + "20",- borderColor: colors.success + "40",- },+ borderColor: colors.success + "40"+ }]}>- <Text style={[styles.badgeText, { color: colors.success }]}>- ✓ Recommended- </Text>+ <Text style={[styles.badgeText, { color: colors.success }]}>✓ Recommended</Text></View>)}{showWarningBadge && (@@ -88,19 +69,15 @@ export function PresetOption({styles.badge,{backgroundColor: colors.warning + "20",- borderColor: colors.warning + "40",- },+ borderColor: colors.warning + "40"+ }]}>- <Text style={[styles.badgeText, { color: colors.warning }]}>- ⚡ High Battery- </Text>+ <Text style={[styles.badgeText, { color: colors.warning }]}>⚡ High Battery</Text></View>)}</View>- <Text style={[styles.description, { color: colors.textSecondary }]}>- {config.description}- </Text>+ <Text style={[styles.description, { color: colors.textSecondary }]}>{config.description}</Text></View></View>@@ -110,19 +87,15 @@ export function PresetOption({styles.radio,{borderColor: isSelected ? colors.primary : colors.border,- backgroundColor: radioBgColor,- },+ backgroundColor: radioBgColor+ }]}>- {isSelected && (- <View- style={[styles.radioInner, { backgroundColor: colors.primary }]}- />- )}+ {isSelected && <View style={[styles.radioInner, { backgroundColor: colors.primary }]} />}</View></View></TouchableOpacity>- );+ )}const styles = StyleSheet.create({@@ -130,59 +103,59 @@ const styles = StyleSheet.create({borderRadius: 14,overflow: "hidden",position: "relative",- marginBottom: 8,+ marginBottom: 8},selectionBar: {position: "absolute",left: 0,top: 0,bottom: 0,- width: 4,+ width: 4},content: {flexDirection: "row",alignItems: "center",padding: 16,- paddingLeft: 20,+ paddingLeft: 20},leftContent: {flex: 1,flexDirection: "row",alignItems: "center",- gap: 14,+ gap: 14},emoji: {- fontSize: 28,+ fontSize: 28},textContent: {- flex: 1,+ flex: 1},titleRow: {flexDirection: "row",alignItems: "center",flexWrap: "wrap",gap: 8,- marginBottom: 4,+ marginBottom: 4},label: {fontSize: 16,fontWeight: "600",- letterSpacing: -0.2,+ letterSpacing: -0.2},badge: {paddingHorizontal: 8,paddingVertical: 3,borderRadius: 6,- borderWidth: 1,+ borderWidth: 1},badgeText: {fontSize: 10,fontWeight: "700",- letterSpacing: 0.3,+ letterSpacing: 0.3},description: {fontSize: 13,- lineHeight: 18,+ lineHeight: 18},radio: {width: 24,@@ -191,11 +164,11 @@ const styles = StyleSheet.create({borderWidth: 2,justifyContent: "center",alignItems: "center",- marginLeft: 12,+ marginLeft: 12},radioInner: {width: 12,height: 12,- borderRadius: 6,- },-});+ borderRadius: 6+ }+})diff --git a/src/components/features/settings/ServerConnection.tsx b/src/components/features/settings/ServerConnection.tsxindex 6ee3c53a..d506b841 100644--- a/src/components/features/settings/ServerConnection.tsx+++ b/src/components/features/settings/ServerConnection.tsx@@ -3,117 +3,110 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useCallback, useMemo, useRef } from "react";-import { StyleSheet, View, Text, TouchableOpacity } from "react-native";-import { useFocusEffect } from "@react-navigation/native";-import { useTheme } from "../../../hooks/useTheme";-import { useTracking } from "../../../contexts/TrackingProvider";-import { ServerStatus, ServerConnectionProps } from "../../../types/global";-import NativeLocationService from "../../../services/NativeLocationService";--const SERVER_TIMEOUT = 5000;-const SERVER_CHECK_INTERVAL = 5 * 60 * 1000;--export function ServerConnection({- endpoint,- navigation,-}: ServerConnectionProps) {- const { colors } = useTheme();- const { settings } = useTracking();- const isOffline = settings.isOfflineMode;-- const [serverStatus, setServerStatus] = useState<- ServerStatus | "offline" | null- >(null);+import React, { useState, useCallback, useMemo, useRef } from "react"+import { StyleSheet, View, Text, TouchableOpacity } from "react-native"+import { useFocusEffect } from "@react-navigation/native"+import { useTheme } from "../../../hooks/useTheme"+import { useTracking } from "../../../contexts/TrackingProvider"+import { ServerStatus, ServerConnectionProps } from "../../../types/global"+import NativeLocationService from "../../../services/NativeLocationService"++const SERVER_TIMEOUT = 5000+const SERVER_CHECK_INTERVAL = 5 * 60 * 1000++export function ServerConnection({ endpoint, navigation }: ServerConnectionProps) {+ const { colors } = useTheme()+ const { settings } = useTracking()+ const isOffline = settings.isOfflineMode++ const [serverStatus, setServerStatus] = useState<ServerStatus | "offline" | null>(null)// Track if we've done the initial check- const hasChecked = useRef(false);+ const hasChecked = useRef(false)/** Checks server connection status */const checkServer = useCallback(async () => {if (isOffline) {- setServerStatus("offline");- hasChecked.current = true;- return;+ setServerStatus("offline")+ hasChecked.current = true+ return}if (!endpoint) {- setServerStatus("notConfigured");- hasChecked.current = true;- return;+ setServerStatus("notConfigured")+ hasChecked.current = true+ return}- const controller = new AbortController();- const timeoutId = setTimeout(() => controller.abort(), SERVER_TIMEOUT);+ const controller = new AbortController()+ const timeoutId = setTimeout(() => controller.abort(), SERVER_TIMEOUT)try {- let authHeaders: Record<string, string> = {};+ let authHeaders: Record<string, string> = {}try {- authHeaders = await NativeLocationService.getAuthHeaders();+ authHeaders = await NativeLocationService.getAuthHeaders()} catch {// proceed without auth headers}// Strategy 1: Try dedicated health endpoint- const healthUrl = endpoint.replace(/\/api\/locations$/, "/health");+ const healthUrl = endpoint.replace(/\/api\/locations$/, "/health")let response = await fetch(healthUrl, {method: "HEAD",signal: controller.signal,- headers: authHeaders,- });+ headers: authHeaders+ })// Strategy 2: If health endpoint doesn't exist, try HEAD on main endpointif (response.status === 404 || response.status === 405) {response = await fetch(endpoint, {method: "HEAD",signal: controller.signal,- headers: authHeaders,- });+ headers: authHeaders+ })}// Strategy 3: If endpoint still fails, try root domainif (!response.ok) {- const match = endpoint.match(/^(https?:\/\/[^/]+)/);+ const match = endpoint.match(/^(https?:\/\/[^/]+)/)if (match) {- const rootUrl = match[1];+ const rootUrl = match[1]response = await fetch(rootUrl, {method: "GET",signal: controller.signal,- headers: authHeaders,- });+ headers: authHeaders+ })}}- setServerStatus(response.ok ? "connected" : "error");- hasChecked.current = true;+ setServerStatus(response.ok ? "connected" : "error")+ hasChecked.current = true} catch {- setServerStatus("error");- hasChecked.current = true;+ setServerStatus("error")+ hasChecked.current = true} finally {- clearTimeout(timeoutId);+ clearTimeout(timeoutId)}- }, [endpoint, isOffline]);+ }, [endpoint, isOffline])// Re-run check when focus returns or offline mode togglesuseFocusEffect(useCallback(() => {// Only reset if settings changedif (!hasChecked.current) {- checkServer();+ checkServer()} else {// Silently recheck in background without resetting state- checkServer();+ checkServer()}- const timer = setInterval(checkServer, SERVER_CHECK_INTERVAL);- return () => clearInterval(timer);+ const timer = setInterval(checkServer, SERVER_CHECK_INTERVAL)+ return () => clearInterval(timer)}, [checkServer])- );+ )- const displayUrl = endpoint- ? endpoint.replace(/^https?:\/\//, "").split("/")[0]- : "";+ const displayUrl = endpoint ? endpoint.replace(/^https?:\/\//, "").split("/")[0] : ""/** Dynamic UI configuration based on status */const config = useMemo(() => {@@ -121,39 +114,37 @@ export function ServerConnection({connected: {color: colors.success,label: "Connected",- description: `Location data is being sent to ${displayUrl}.`,+ description: `Location data is being sent to ${displayUrl}.`},error: {color: colors.error,label: "Error",- description: "Cannot reach the server. Check your endpoint or network.",+ description: "Cannot reach the server. Check your endpoint or network."},notConfigured: {color: colors.warning,label: "Not configured",- description: "Configure an endpoint in settings to start syncing data.",+ description: "Configure an endpoint in settings to start syncing data."},offline: {color: colors.textSecondary,label: "Offline Mode",- description: "Syncing is paused. Data is only collected locally.",+ description: "Syncing is paused. Data is only collected locally."},loading: {color: colors.textLight,label: "Checking...",- description: "Verifying connection to the server...",- },- };+ description: "Verifying connection to the server..."+ }+ }// Show loading state until first check completesif (serverStatus === null) {- return statusMap.loading;+ return statusMap.loading}- return isOffline- ? statusMap.offline- : statusMap[serverStatus as ServerStatus] || statusMap.error;- }, [serverStatus, colors, isOffline, displayUrl]);+ return isOffline ? statusMap.offline : statusMap[serverStatus as ServerStatus] || statusMap.error+ }, [serverStatus, colors, isOffline, displayUrl])return (<TouchableOpacity@@ -164,33 +155,27 @@ export function ServerConnection({{backgroundColor: colors.card,borderLeftColor: config.color,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}><View style={styles.serverHeader}>- <Text style={[styles.serverLabel, { color: colors.text }]}>- SERVER CONNECTION- </Text>+ <Text style={[styles.serverLabel, { color: colors.text }]}>SERVER CONNECTION</Text><Viewstyle={[styles.serverIndicator,{backgroundColor: config.color + "20",- borderColor: config.color,- },+ borderColor: config.color+ }]}>- <Text style={[styles.serverIndicatorText, { color: config.color }]}>- {config.label}- </Text>+ <Text style={[styles.serverIndicatorText, { color: config.color }]}>{config.label}</Text></View></View>- <Text style={[styles.serverDescription, { color: colors.textLight }]}>- {config.description}- </Text>+ <Text style={[styles.serverDescription, { color: colors.textLight }]}>{config.description}</Text></TouchableOpacity>- );+ )}const styles = StyleSheet.create({@@ -199,21 +184,21 @@ const styles = StyleSheet.create({borderRadius: 10,padding: 16,marginBottom: 24,- borderWidth: 1,+ borderWidth: 1},serverHeader: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- marginBottom: 8,+ marginBottom: 8},serverLabel: { fontSize: 11, fontWeight: "700", letterSpacing: 1.2 },serverIndicator: {paddingHorizontal: 10,paddingVertical: 4,borderRadius: 12,- borderWidth: 1,+ borderWidth: 1},serverIndicatorText: { fontSize: 11, fontWeight: "600", letterSpacing: 0.3 },- serverDescription: { fontSize: 13, lineHeight: 18 },-});+ serverDescription: { fontSize: 13, lineHeight: 18 }+})diff --git a/src/components/features/settings/StatsCard.tsx b/src/components/features/settings/StatsCard.tsxindex 20c17e13..35265b8e 100644--- a/src/components/features/settings/StatsCard.tsx+++ b/src/components/features/settings/StatsCard.tsx@@ -2,24 +2,24 @@* Copyright (C) 2026 Max Dietrich* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet, TouchableOpacity } from "react-native";-import { ThemeColors } from "../../../types/global";-import { getQueueColor } from "../../../helpers/queueStatus";+import React from "react"+import { View, Text, StyleSheet, TouchableOpacity } from "react-native"+import { ThemeColors } from "../../../types/global"+import { getQueueColor } from "../../../helpers/queueStatus"interface StatsCardProps {- queueCount: number;- sentCount: number;- interval: string;- isOfflineMode: boolean;- onManageClick?: () => void;- colors: ThemeColors;+ queueCount: number+ sentCount: number+ interval: string+ isOfflineMode: boolean+ onManageClick?: () => void+ colors: ThemeColors}-type WarningLevel = "normal" | "warning" | "critical";+type WarningLevel = "normal" | "warning" | "critical"-const HIGH_QUEUE_THRESHOLD = 50;-const CRITICAL_QUEUE_THRESHOLD = 100;+const HIGH_QUEUE_THRESHOLD = 50+const CRITICAL_QUEUE_THRESHOLD = 100/*** StatsCard Component - Improved Design@@ -30,45 +30,38 @@ const CRITICAL_QUEUE_THRESHOLD = 100;* - Improved warning states* - More prominent CTA when needed*/-export function StatsCard({- queueCount,- sentCount,- interval,- isOfflineMode,- onManageClick,- colors,-}: StatsCardProps) {+export function StatsCard({ queueCount, sentCount, interval, isOfflineMode, onManageClick, colors }: StatsCardProps) {const getWarningLevel = (): WarningLevel => {- if (queueCount > CRITICAL_QUEUE_THRESHOLD) return "critical";- if (queueCount > HIGH_QUEUE_THRESHOLD) return "warning";- return "normal";- };+ if (queueCount > CRITICAL_QUEUE_THRESHOLD) return "critical"+ if (queueCount > HIGH_QUEUE_THRESHOLD) return "warning"+ return "normal"+ }- const queuedColor = getQueueColor(queueCount, colors);- const warningLevel = getWarningLevel();- const showWarning = queueCount > HIGH_QUEUE_THRESHOLD;+ const queuedColor = getQueueColor(queueCount, colors)+ const warningLevel = getWarningLevel()+ const showWarning = queueCount > HIGH_QUEUE_THRESHOLDconst getBorderColor = () => {switch (warningLevel) {case "critical":- return colors.error;+ return colors.errorcase "warning":- return colors.warning;+ return colors.warningdefault:- return colors.border;+ return colors.border}- };+ }const getBackgroundGradient = () => {switch (warningLevel) {case "critical":- return colors.error + "08";+ return colors.error + "08"case "warning":- return colors.warning + "08";+ return colors.warning + "08"default:- return "transparent";+ return "transparent"}- };+ }return (<View@@ -76,68 +69,49 @@ export function StatsCard({styles.container,{backgroundColor: colors.card,- borderColor: getBorderColor(),- },+ borderColor: getBorderColor()+ }]}>{/* Gradient overlay for warning states */}{warningLevel !== "normal" && (- <View- style={[- styles.gradientOverlay,- { backgroundColor: getBackgroundGradient() },- ]}- />+ <View style={[styles.gradientOverlay, { backgroundColor: getBackgroundGradient() }]} />)}{/* Stats Grid */}<View style={styles.statsGrid}>{/* Queued */}<View style={styles.statItem}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Queued- </Text>- <Text style={[styles.statValue, { color: queuedColor }]}>- {queueCount.toLocaleString()}- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Queued</Text>+ <Text style={[styles.statValue, { color: queuedColor }]}>{queueCount.toLocaleString()}</Text></View><View style={[styles.divider, { backgroundColor: colors.border }]} />{/* Sent */}<View style={styles.statItem}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Sent- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Sent</Text><Textstyle={[styles.statValue,{- color: isOfflineMode ? colors.textLight : colors.success,- },+ color: isOfflineMode ? colors.textLight : colors.success+ }]}>{isOfflineMode ? "—" : sentCount.toLocaleString()}</Text>- {isOfflineMode && (- <Text style={[styles.disabledHint, { color: colors.textLight }]}>- Offline- </Text>- )}+ {isOfflineMode && <Text style={[styles.disabledHint, { color: colors.textLight }]}>Offline</Text>}</View><View style={[styles.divider, { backgroundColor: colors.border }]} />{/* Interval */}<View style={styles.statItem}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Interval- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Interval</Text><Text style={[styles.statValue, { color: colors.info }]}>{interval}- <Text style={[styles.unit, { color: colors.textSecondary }]}>- s- </Text>+ <Text style={[styles.unit, { color: colors.textSecondary }]}>s</Text></Text></View></View>@@ -148,12 +122,9 @@ export function StatsCard({style={[styles.warningBanner,{- backgroundColor:- warningLevel === "critical"- ? colors.error + "15"- : colors.warning + "15",- borderTopColor: colors.border,- },+ backgroundColor: warningLevel === "critical" ? colors.error + "15" : colors.warning + "15",+ borderTopColor: colors.border+ }]}onPress={onManageClick}activeOpacity={0.7}@@ -163,9 +134,8 @@ export function StatsCard({style={[styles.warningIcon,{- color:- warningLevel === "critical" ? colors.error : colors.warning,- },+ color: warningLevel === "critical" ? colors.error : colors.warning+ }]}>{warningLevel === "critical" ? "⚠️" : "⚠️"}@@ -175,31 +145,21 @@ export function StatsCard({style={[styles.warningTitle,{- color:- warningLevel === "critical"- ? colors.error- : colors.warning,- },+ color: warningLevel === "critical" ? colors.error : colors.warning+ }]}>- {warningLevel === "critical"- ? "Critical Queue Size"- : "High Queue Size"}- </Text>- <Text- style={[styles.warningHint, { color: colors.textSecondary }]}- >- Tap to manage data+ {warningLevel === "critical" ? "Critical Queue Size" : "High Queue Size"}</Text>+ <Text style={[styles.warningHint, { color: colors.textSecondary }]}>Tap to manage data</Text></View></View><Textstyle={[styles.arrow,{- color:- warningLevel === "critical" ? colors.error : colors.warning,- },+ color: warningLevel === "critical" ? colors.error : colors.warning+ }]}>›@@ -207,7 +167,7 @@ export function StatsCard({</TouchableOpacity>)}</View>- );+ )}const styles = StyleSheet.create({@@ -215,48 +175,48 @@ const styles = StyleSheet.create({borderRadius: 16,borderWidth: 2,marginBottom: 24,- overflow: "hidden",+ overflow: "hidden"},gradientOverlay: {position: "absolute",top: 0,left: 0,right: 0,- bottom: 0,+ bottom: 0},statsGrid: {flexDirection: "row",- padding: 20,+ padding: 20},statItem: {flex: 1,- alignItems: "center",+ alignItems: "center"},statLabel: {fontSize: 12,fontWeight: "600",textTransform: "uppercase",letterSpacing: 0.8,- marginBottom: 8,+ marginBottom: 8},statValue: {fontSize: 26,fontWeight: "700",- letterSpacing: -0.5,+ letterSpacing: -0.5},unit: {fontSize: 16,- fontWeight: "500",+ fontWeight: "500"},disabledHint: {fontSize: 11,marginTop: 2,- fontStyle: "italic",+ fontStyle: "italic"},divider: {width: 1,marginHorizontal: 12,- opacity: 0.3,+ opacity: 0.3},warningBanner: {flexDirection: "row",@@ -264,31 +224,31 @@ const styles = StyleSheet.create({justifyContent: "space-between",paddingHorizontal: 20,paddingVertical: 14,- borderTopWidth: 1,+ borderTopWidth: 1},warningContent: {flexDirection: "row",alignItems: "center",- flex: 1,+ flex: 1},warningIcon: {fontSize: 20,- marginRight: 12,+ marginRight: 12},warningText: {- flex: 1,+ flex: 1},warningTitle: {fontSize: 14,fontWeight: "600",- marginBottom: 2,+ marginBottom: 2},warningHint: {- fontSize: 12,+ fontSize: 12},arrow: {fontSize: 24,fontWeight: "300",- marginLeft: 8,- },-});+ marginLeft: 8+ }+})diff --git a/src/components/index.ts b/src/components/index.tsindex 5e0d213d..a2fae7ac 100644--- a/src/components/index.ts+++ b/src/components/index.ts@@ -13,33 +13,36 @@// ============================================================================// UI Components (Core)// ============================================================================-export { Container } from "./ui/Container";-export { Card } from "./ui/Card";-export { Button } from "./ui/Button";-export { Section } from "./ui/Section";-export { SectionTitle } from "./ui/SectionTitle";-export { Divider } from "./ui/Divider";-export { CollapsibleSection } from "./ui/CollapsibleSection";-export { NumericInput } from "./ui/NumericInput";-export { FloatingSaveIndicator } from "./ui/FloatingSaveIndicator";-export { Footer } from "./ui/Footer";+export { Container } from "./ui/Container"+export { Card } from "./ui/Card"+export { Button } from "./ui/Button"+export { SectionTitle } from "./ui/SectionTitle"+export { Divider } from "./ui/Divider"+export { NumericInput } from "./ui/NumericInput"+export { FloatingSaveIndicator } from "./ui/FloatingSaveIndicator"+export { Footer } from "./ui/Footer"// ============================================================================// Feature Components - Dashboard// ============================================================================-export { DashboardMap } from "./features/dashboard/DashboardMap";-export { CoordinateDisplay } from "./features/dashboard/CoordinateDisplay";-export { ComingSoonRibbon } from "./features/dashboard/ComingSoonRibbon";-export { QuickAccess } from "./features/dashboard/QuickAccess";+export { DashboardMap } from "./features/dashboard/DashboardMap"+export { CoordinateDisplay } from "./features/dashboard/CoordinateDisplay"+export { ComingSoonRibbon } from "./features/dashboard/ComingSoonRibbon"+export { QuickAccess } from "./features/dashboard/QuickAccess"++// ============================================================================+// Feature Components - Map+// ============================================================================+export { MapCenterButton } from "./features/map/MapCenterButton"// ============================================================================// Feature Components - Database// ============================================================================-export { DatabaseStatistics } from "./features/databases/DatabaseStatistics";+export { DatabaseStatistics } from "./features/databases/DatabaseStatistics"// ============================================================================// Feature Components - Settings// ============================================================================-export { ServerConnection } from "./features/settings/ServerConnection";-export { StatsCard } from "./features/settings/StatsCard";-export { PresetOption } from "./features/settings/PresetOption";+export { ServerConnection } from "./features/settings/ServerConnection"+export { StatsCard } from "./features/settings/StatsCard"+export { PresetOption } from "./features/settings/PresetOption"diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsxindex c8a1a831..22ba8cbf 100644--- a/src/components/ui/Button.tsx+++ b/src/components/ui/Button.tsx@@ -3,25 +3,18 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import {- TouchableOpacity,- Text,- StyleSheet,- GestureResponderEvent,- StyleProp,- ViewStyle,-} from "react-native";-import { useTheme } from "../../hooks/useTheme";+import React from "react"+import { TouchableOpacity, Text, StyleSheet, GestureResponderEvent, StyleProp, ViewStyle } from "react-native"+import { useTheme } from "../../hooks/useTheme"type Props = {- title: string;- onPress: (event: GestureResponderEvent) => void;- disabled?: boolean;- style?: StyleProp<ViewStyle>;- activeOpacity?: number;- color?: string;-};+ title: string+ onPress: (event: GestureResponderEvent) => void+ disabled?: boolean+ style?: StyleProp<ViewStyle>+ activeOpacity?: number+ color?: string+}/*** Custom button component with theme support and disabled state.@@ -41,15 +34,8 @@ type Props = {* />* ```*/-export function Button({- title,- onPress,- disabled = false,- style,- activeOpacity,- color,-}: Props) {- const { colors } = useTheme();+export function Button({ title, onPress, disabled = false, style, activeOpacity, color }: Props) {+ const { colors } = useTheme()return (<TouchableOpacity@@ -57,9 +43,9 @@ export function Button({styles.button,{backgroundColor: disabled ? colors.textDisabled : colors.primary,- borderRadius: colors.borderRadius,+ borderRadius: colors.borderRadius},- style,+ style]}onPress={onPress}disabled={disabled}@@ -67,7 +53,7 @@ export function Button({><Text style={[styles.text, { color: color }]}>{title}</Text></TouchableOpacity>- );+ )}const styles = StyleSheet.create({@@ -75,10 +61,10 @@ const styles = StyleSheet.create({paddingVertical: 12,paddingHorizontal: 24,alignItems: "center",- marginVertical: 8,+ marginVertical: 8},text: {fontSize: 16,- fontWeight: "600",- },-});+ fontWeight: "600"+ }+})diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsxindex a26b849b..296a1da8 100644--- a/src/components/ui/Card.tsx+++ b/src/components/ui/Card.tsx@@ -3,20 +3,20 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, StyleSheet, ViewStyle, StyleProp } from "react-native";-import { useTheme } from "../../hooks/useTheme";+import React from "react"+import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"+import { useTheme } from "../../hooks/useTheme"type CardProps = {- children: React.ReactNode;- style?: StyleProp<ViewStyle>;- danger?: boolean;-};+ children: React.ReactNode+ style?: StyleProp<ViewStyle>+ danger?: boolean+}export function Card({ children, style, danger = false }: CardProps) {- const { colors } = useTheme();+ const { colors } = useTheme()- const borderWidth = danger ? 2 : 1;+ const borderWidth = danger ? 2 : 1return (<View@@ -25,14 +25,14 @@ export function Card({ children, style, danger = false }: CardProps) {{backgroundColor: danger ? colors.error + "10" : colors.card,borderColor: danger ? colors.error : colors.border,- borderWidth,+ borderWidth},- style,+ style]}>{children}</View>- );+ )}const styles = StyleSheet.create({@@ -41,6 +41,6 @@ const styles = StyleSheet.create({padding: 16,borderRadius: 12,borderWidth: 1,- width: "100%",- },-});+ width: "100%"+ }+})diff --git a/src/components/ui/CollapsibleSection.tsx b/src/components/ui/CollapsibleSection.tsxdeleted file mode 100644index 77d4bda6..00000000--- a/src/components/ui/CollapsibleSection.tsx+++ /dev/null@@ -1,84 +0,0 @@-/**- * Copyright (C) 2026 Max Dietrich- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.- */-import React, { useState } from "react";-import {- View,- Text,- TouchableOpacity,- StyleSheet,- LayoutAnimation,- Platform,- UIManager,-} from "react-native";-import { useTheme } from "../../hooks/useTheme";--if (- Platform.OS === "android" &&- UIManager.setLayoutAnimationEnabledExperimental-) {- UIManager.setLayoutAnimationEnabledExperimental(true);-}--interface CollapsibleSectionProps {- title: string;- children: React.ReactNode;- defaultOpen?: boolean;-}--export function CollapsibleSection({- title,- children,- defaultOpen = false,-}: CollapsibleSectionProps) {- const [isOpen, setIsOpen] = useState(defaultOpen);- const { colors } = useTheme();-- const toggle = () => {- LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);- setIsOpen(!isOpen);- };-- return (- <View style={styles.container}>- <TouchableOpacity- onPress={toggle}- activeOpacity={0.7}- style={styles.header}- >- <Text style={[styles.title, { color: colors.text }]}>{title}</Text>- <Text style={[styles.toggleText, { color: colors.primary }]}>- {isOpen ? "▲ Hide" : "▼ Show details"}- </Text>- </TouchableOpacity>- {isOpen && <View style={styles.content}>{children}</View>}- </View>- );-}--const styles = StyleSheet.create({- container: {- marginBottom: 16,- borderRadius: 8,- overflow: "hidden",- },- header: {- flexDirection: "row",- justifyContent: "space-between",- alignItems: "center",- paddingVertical: 8,- },- title: {- fontSize: 11,- fontWeight: "700",- letterSpacing: 1.2,- textTransform: "uppercase",- },- toggleText: {- fontSize: 12,- },- content: {- marginTop: 8,- },-});diff --git a/src/components/ui/Container.tsx b/src/components/ui/Container.tsxindex b6f35cd9..f2f2ef99 100644--- a/src/components/ui/Container.tsx+++ b/src/components/ui/Container.tsx@@ -3,30 +3,30 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, StyleSheet, ViewStyle, StyleProp } from "react-native";-import { useTheme } from "../../hooks/useTheme";+import React from "react"+import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"+import { useTheme } from "../../hooks/useTheme"type ContainerProps = {- children: React.ReactNode;- style?: StyleProp<ViewStyle>;- useKeyboardAvoid?: boolean;-};+ children: React.ReactNode+ style?: StyleProp<ViewStyle>+ useKeyboardAvoid?: boolean+}export function Container({ children, style }: ContainerProps) {- const { colors } = useTheme();+ const { colors } = useTheme()return (<View style={[styles.root, { backgroundColor: colors.background }]}><View style={[styles.container, style]}>{children}</View></View>- );+ )}const styles = StyleSheet.create({root: { flex: 1 },container: {flex: 1,- marginBottom: 24,- },-});+ marginBottom: 24+ }+})diff --git a/src/components/ui/Divider.tsx b/src/components/ui/Divider.tsxindex 135e2e73..d2cf2c28 100644--- a/src/components/ui/Divider.tsx+++ b/src/components/ui/Divider.tsx@@ -3,18 +3,18 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { View, StyleSheet } from "react-native";-import { useTheme } from "../../hooks/useTheme";+import { View, StyleSheet } from "react-native"+import { useTheme } from "../../hooks/useTheme"export const Divider = () => {- const { colors } = useTheme();+ const { colors } = useTheme()- return <View style={[styles.divider, { backgroundColor: colors.divider }]} />;-};+ return <View style={[styles.divider, { backgroundColor: colors.divider }]} />+}const styles = StyleSheet.create({divider: {height: 1,- marginVertical: 16,- },-});+ marginVertical: 16+ }+})diff --git a/src/components/ui/FloatingSaveIndicator.tsx b/src/components/ui/FloatingSaveIndicator.tsxindex ca4ed1a8..06af089e 100644--- a/src/components/ui/FloatingSaveIndicator.tsx+++ b/src/components/ui/FloatingSaveIndicator.tsx@@ -3,37 +3,28 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet } from "react-native";+import React from "react"+import { View, Text, StyleSheet } from "react-native"interface Props {- saving: boolean;- success: boolean;+ saving: boolean+ success: boolean/** Optional custom message. When provided, controls visibility instead of saving/success. */- message?: string | null;+ message?: string | nullcolors: {- info: string;- success: string;- text: string;- };+ info: string+ success: string+ text: string+ }}-export const FloatingSaveIndicator: React.FC<Props> = ({- saving,- success,- message,- colors,-}) => {- const hasMessage = message != null;- const visible = hasMessage || saving || success;+export const FloatingSaveIndicator: React.FC<Props> = ({ saving, success, message, colors }) => {+ const hasMessage = message != null+ const visible = hasMessage || saving || success- if (!visible) return null;+ if (!visible) return null- const displayText = hasMessage- ? message- : saving- ? "⏳ Saving & restarting..."- : "✓ Saved";+ const displayText = hasMessage ? message : saving ? "⏳ Saving & restarting..." : "✓ Saved"return (<View style={styles.container}>@@ -42,15 +33,15 @@ export const FloatingSaveIndicator: React.FC<Props> = ({styles.badge,{backgroundColor: saving ? colors.info : colors.success,- shadowColor: saving ? colors.info : colors.success,- },+ shadowColor: saving ? colors.info : colors.success+ }]}><Text style={[styles.text, { color: colors.text }]}>{displayText}</Text></View></View>- );-};+ )+}const styles = StyleSheet.create({container: {@@ -60,7 +51,7 @@ const styles = StyleSheet.create({right: 0,alignItems: "center",zIndex: 1000,- pointerEvents: "none",+ pointerEvents: "none"},badge: {paddingHorizontal: 20,@@ -69,7 +60,7 @@ const styles = StyleSheet.create({shadowOffset: { width: 0, height: 4 },shadowOpacity: 0.3,shadowRadius: 8,- elevation: 8,+ elevation: 8},- text: { fontSize: 14, fontWeight: "600" },-});+ text: { fontSize: 14, fontWeight: "600" }+})diff --git a/src/components/ui/Footer.tsx b/src/components/ui/Footer.tsxindex b09ca44d..86911782 100644--- a/src/components/ui/Footer.tsx+++ b/src/components/ui/Footer.tsx@@ -3,27 +3,23 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet } from "react-native";-import { useTheme } from "../../hooks/useTheme";+import React from "react"+import { View, Text, StyleSheet } from "react-native"+import { useTheme } from "../../hooks/useTheme"export function Footer() {- const { colors } = useTheme();+ const { colors } = useTheme()return (<View style={styles.footer}><Text style={[styles.privacyText, { color: colors.textSecondary }]}>🔒 All data stays on your device and server</Text>- <Text style={[styles.taglineText, { color: colors.textLight }]}>- Open source · Self-hosted · Privacy-first- </Text>+ <Text style={[styles.taglineText, { color: colors.textLight }]}>Open source · Self-hosted · Privacy-first</Text><View style={styles.divider} />- <Text style={[styles.copyright, { color: colors.textLight }]}>- © 2026 Max Dietrich- </Text>+ <Text style={[styles.copyright, { color: colors.textLight }]}>© 2026 Max Dietrich</Text></View>- );+ )}const styles = StyleSheet.create({@@ -31,27 +27,27 @@ const styles = StyleSheet.create({marginTop: 32,marginBottom: 16,alignItems: "center",- gap: 8,+ gap: 8},privacyText: {fontSize: 14,textAlign: "center",- fontWeight: "500",+ fontWeight: "500"},taglineText: {fontSize: 12,textAlign: "center",- letterSpacing: 0.5,+ letterSpacing: 0.5},divider: {width: 40,height: 1,backgroundColor: "#666",opacity: 0.3,- marginVertical: 4,+ marginVertical: 4},copyright: {fontSize: 11,- opacity: 0.7,- },-});+ opacity: 0.7+ }+})diff --git a/src/components/ui/NumericInput.tsx b/src/components/ui/NumericInput.tsxindex 095a7374..36b661bb 100644--- a/src/components/ui/NumericInput.tsx+++ b/src/components/ui/NumericInput.tsx@@ -3,20 +3,20 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, Text, StyleSheet, TextInput } from "react-native";-import { ThemeColors } from "../../types/global";+import React from "react"+import { View, Text, StyleSheet, TextInput } from "react-native"+import { ThemeColors } from "../../types/global"interface NumericInputProps {- label: string;- value: string;- onChange: (value: string) => void;- onBlur: () => void;- unit: string;- placeholder?: string;- min?: number;- colors: ThemeColors;- hint?: string;+ label: string+ value: string+ onChange: (value: string) => void+ onBlur: () => void+ unit: string+ placeholder?: string+ min?: number+ colors: ThemeColors+ hint?: string}/**@@ -39,7 +39,7 @@ export function NumericInput({unit,placeholder = "0",colors,- hint,+ hint}: NumericInputProps) {return (<View style={styles.container}>@@ -47,9 +47,7 @@ export function NumericInput({<Text style={[styles.label, { color: colors.text }]}>{label}</Text>{/* Hint (optional) */}- {hint && (- <Text style={[styles.hint, { color: colors.textLight }]}>{hint}</Text>- )}+ {hint && <Text style={[styles.hint, { color: colors.textLight }]}>{hint}</Text>}{/* Input Row */}<View style={styles.inputRow}>@@ -59,8 +57,8 @@ export function NumericInput({{borderColor: colors.border,color: colors.text,- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}keyboardType="numeric"value={value}@@ -69,32 +67,30 @@ export function NumericInput({placeholder={placeholder}placeholderTextColor={colors.placeholder}/>- <Text style={[styles.unit, { color: colors.textSecondary }]}>- {unit}- </Text>+ <Text style={[styles.unit, { color: colors.textSecondary }]}>{unit}</Text></View></View>- );+ )}const styles = StyleSheet.create({container: {- marginBottom: 16,+ marginBottom: 16},label: {fontSize: 14,fontWeight: "600",- marginBottom: 8,+ marginBottom: 8},hint: {fontSize: 12,fontStyle: "italic",- marginBottom: 12,+ marginBottom: 12},inputRow: {flexDirection: "row",alignItems: "center",- gap: 12,+ gap: 12},input: {flex: 1,@@ -102,10 +98,10 @@ const styles = StyleSheet.create({padding: 14,borderRadius: 12,fontSize: 15,- textAlign: "center",+ textAlign: "center"},unit: {fontSize: 15,- fontWeight: "500",- },-});+ fontWeight: "500"+ }+})diff --git a/src/components/ui/Section.tsx b/src/components/ui/Section.tsxdeleted file mode 100644index b37fdfdd..00000000--- a/src/components/ui/Section.tsx+++ /dev/null@@ -1,38 +0,0 @@-/**- * Copyright (C) 2026 Max Dietrich- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.- */--import React from "react";-import { View, StyleSheet, ViewStyle, StyleProp, Text } from "react-native";-import { useTheme } from "../../hooks/useTheme";--type SectionProps = {- children: React.ReactNode;- style?: StyleProp<ViewStyle>;-};--export function Section({ children, style }: SectionProps) {- const { colors } = useTheme();-- return (- <View style={[styles.section, style]}>- <Text style={[styles.sectionLabel, { color: colors.textSecondary }]}>- {children}- </Text>- </View>- );-}--const styles = StyleSheet.create({- section: {- flex: 1,- marginBottom: 24,- },- sectionLabel: {- fontSize: 11,- fontWeight: "700",- letterSpacing: 1.2,- marginBottom: 36,- },-});diff --git a/src/components/ui/SectionTitle.tsx b/src/components/ui/SectionTitle.tsxindex 8db9bba9..4a7d6000 100644--- a/src/components/ui/SectionTitle.tsx+++ b/src/components/ui/SectionTitle.tsx@@ -3,28 +3,24 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React from "react";-import { View, StyleSheet, ViewStyle, StyleProp, Text } from "react-native";-import { useTheme } from "../../hooks/useTheme";+import React from "react"+import { View, StyleSheet, ViewStyle, StyleProp, Text } from "react-native"+import { useTheme } from "../../hooks/useTheme"type SectionTitleProps = {- children: React.ReactNode;- style?: StyleProp<ViewStyle>;- color?: string;-};+ children: React.ReactNode+ style?: StyleProp<ViewStyle>+ color?: string+}export function SectionTitle({ children, style, color }: SectionTitleProps) {- const { colors } = useTheme();+ const { colors } = useTheme()return (<View style={style}>- <Text- style={[styles.sectionTitle, { color: color ? color : colors.text }]}- >- {children}- </Text>+ <Text style={[styles.sectionTitle, { color: color ? color : colors.text }]}>{children}</Text></View>- );+ )}const styles = StyleSheet.create({@@ -34,6 +30,6 @@ const styles = StyleSheet.create({fontWeight: "700",letterSpacing: 1.2,marginBottom: 12,- paddingHorizontal: 4,- },-});+ paddingHorizontal: 4+ }+})diff --git a/src/contexts/TrackingProvider.tsx b/src/contexts/TrackingProvider.tsxindex 8ac0866b..41cf3e19 100644--- a/src/contexts/TrackingProvider.tsx+++ b/src/contexts/TrackingProvider.tsx@@ -3,38 +3,25 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, {- createContext,- useContext,- useState,- useEffect,- useMemo,- useCallback,- useRef,-} from "react";-import {- Settings,- DEFAULT_SETTINGS,- LocationCoords,- ApiTemplateName,-} from "../types/global";-import { useLocationTracking } from "../hooks/useLocationTracking";-import NativeLocationService from "../services/NativeLocationService";-import SettingsService from "../services/SettingsService";+import React, { createContext, useContext, useState, useEffect, useMemo, useCallback, useRef } from "react"+import { Settings, DEFAULT_SETTINGS, LocationCoords, ApiTemplateName } from "../types/global"+import { useLocationTracking } from "../hooks/useLocationTracking"+import NativeLocationService from "../services/NativeLocationService"+import SettingsService from "../services/SettingsService"type TrackingContextType = {- settings: Settings;- setSettings: (s: Settings) => Promise<void>;- coords: LocationCoords | null;- tracking: boolean;- isLoading: boolean;- error: Error | null;- startTracking: () => Promise<void>;- stopTracking: () => void;- restartTracking: (newSettings?: Settings) => Promise<void>;-};--const TrackingContext = createContext<TrackingContextType | null>(null);+ settings: Settings+ setSettings: (s: Settings) => Promise<void>+ coords: LocationCoords | null+ tracking: boolean+ isLoading: boolean+ error: Error | null+ startTracking: () => Promise<void>+ stopTracking: () => void+ restartTracking: (newSettings?: Settings) => Promise<void>+}++const TrackingContext = createContext<TrackingContextType | null>(null)/*** Parses raw SQLite settings (all strings) into typed Settings object@@ -43,25 +30,15 @@ function parseRawSettings(allRaw: Record<string, string>): Settings {return {...DEFAULT_SETTINGS,// Convert Android milliseconds back to seconds (UNIX-Timestamp)- interval: allRaw.interval- ? parseInt(allRaw.interval, 10) / 1000- : DEFAULT_SETTINGS.interval,+ interval: allRaw.interval ? parseInt(allRaw.interval, 10) / 1000 : DEFAULT_SETTINGS.interval,- distance: allRaw.minUpdateDistance- ? parseFloat(allRaw.minUpdateDistance)- : DEFAULT_SETTINGS.distance,+ distance: allRaw.minUpdateDistance ? parseFloat(allRaw.minUpdateDistance) : DEFAULT_SETTINGS.distance,- syncInterval: allRaw.syncInterval- ? parseInt(allRaw.syncInterval, 10)- : DEFAULT_SETTINGS.syncInterval,+ syncInterval: allRaw.syncInterval ? parseInt(allRaw.syncInterval, 10) : DEFAULT_SETTINGS.syncInterval,- retryInterval: allRaw.retryInterval- ? parseInt(allRaw.retryInterval, 10)- : DEFAULT_SETTINGS.retryInterval,+ retryInterval: allRaw.retryInterval ? parseInt(allRaw.retryInterval, 10) : DEFAULT_SETTINGS.retryInterval,- maxRetries: allRaw.maxRetries- ? parseInt(allRaw.maxRetries, 10)- : DEFAULT_SETTINGS.maxRetries,+ maxRetries: allRaw.maxRetries ? parseInt(allRaw.maxRetries, 10) : DEFAULT_SETTINGS.maxRetries,accuracyThreshold: allRaw.accuracyThreshold? parseFloat(allRaw.accuracyThreshold)@@ -72,17 +49,12 @@ function parseRawSettings(allRaw: Record<string, string>): Settings {syncPreset: (allRaw.syncPreset as any) ?? DEFAULT_SETTINGS.syncPreset,filterInaccurateLocations: allRaw.filterInaccurateLocations === "true",- fieldMap: allRaw.fieldMap- ? JSON.parse(allRaw.fieldMap)- : DEFAULT_SETTINGS.fieldMap,+ fieldMap: allRaw.fieldMap ? JSON.parse(allRaw.fieldMap) : DEFAULT_SETTINGS.fieldMap,- customFields: allRaw.customFields- ? JSON.parse(allRaw.customFields)- : DEFAULT_SETTINGS.customFields,+ customFields: allRaw.customFields ? JSON.parse(allRaw.customFields) : DEFAULT_SETTINGS.customFields,- apiTemplate:- (allRaw.apiTemplate as ApiTemplateName) ?? DEFAULT_SETTINGS.apiTemplate,- };+ apiTemplate: (allRaw.apiTemplate as ApiTemplateName) ?? DEFAULT_SETTINGS.apiTemplate+ }}/**@@ -100,15 +72,15 @@ function parseRawSettings(allRaw: Record<string, string>): Settings {* underlying GPS foreground service.*/export function TrackingProvider({ children }: { children: React.ReactNode }) {- const [settings, setSettingsState] = useState<Settings>(DEFAULT_SETTINGS);- const [isLoading, setIsLoading] = useState(true);- const [error, setError] = useState<Error | null>(null);+ const [settings, setSettingsState] = useState<Settings>(DEFAULT_SETTINGS)+ const [isLoading, setIsLoading] = useState(true)+ const [error, setError] = useState<Error | null>(null)// Ref to track if component is mounted (prevents state updates after unmount)- const isMountedRef = useRef(true);+ const isMountedRef = useRef(true)// Ref to track if initialization has been done (prevents re-running on dependency changes)- const hasInitializedRef = useRef(false);+ const hasInitializedRef = useRef(false)/*** Batch updates settings across both UI state and Native storage.@@ -116,22 +88,22 @@ export function TrackingProvider({ children }: { children: React.ReactNode }) {*/const setSettings = useCallback(async (newSettings: Settings) => {try {- console.log("[TrackingContext] 💾 Batch syncing to Native storage...");+ console.log("[TrackingContext] 💾 Batch syncing to Native storage...")// SettingsService handles unit conversion (seconds -> ms)- await SettingsService.updateMultiple(newSettings);+ await SettingsService.updateMultiple(newSettings)if (isMountedRef.current) {- setSettingsState(newSettings);- setError(null); // Clear any previous errors+ setSettingsState(newSettings)+ setError(null) // Clear any previous errors}} catch (err) {- console.error("[TrackingContext] Persistence failed:", err);+ console.error("[TrackingContext] Persistence failed:", err)if (isMountedRef.current) {- setError(err instanceof Error ? err : new Error(String(err)));+ setError(err instanceof Error ? err : new Error(String(err)))}- throw err; // Re-throw to allow caller to handle+ throw err // Re-throw to allow caller to handle}- }, []);+ }, [])const {coords,@@ -139,8 +111,8 @@ export function TrackingProvider({ children }: { children: React.ReactNode }) {startTracking: internalStart,stopTracking: internalStop,restartTracking: internalRestart,- reconnect: internalReconnect,- } = useLocationTracking(settings);+ reconnect: internalReconnect+ } = useLocationTracking(settings)/*** Initial Hydration Effect.@@ -148,118 +120,114 @@ export function TrackingProvider({ children }: { children: React.ReactNode }) {* are parsed into their respective JS types (Numbers, Booleans, and JSON objects).*/useEffect(() => {- if (hasInitializedRef.current) return;+ if (hasInitializedRef.current) returnconst init = async () => {try {- console.log("[TrackingContext] 📂 Hydrating settings and state...");- const allRaw = await NativeLocationService.getAllSettings();+ console.log("[TrackingContext] 📂 Hydrating settings and state...")+ const allRaw = await NativeLocationService.getAllSettings()- if (!isMountedRef.current) return;+ if (!isMountedRef.current) return// Initialize DB with defaults if emptyif (Object.keys(allRaw).length === 0) {- console.log("[TrackingContext] 🆕 Initializing DB with defaults");- await setSettings(DEFAULT_SETTINGS);- return;+ console.log("[TrackingContext] 🆕 Initializing DB with defaults")+ await setSettings(DEFAULT_SETTINGS)+ return}// Parse settings from raw SQLite data- const mergedSettings = parseRawSettings(allRaw);+ const mergedSettings = parseRawSettings(allRaw)- if (!isMountedRef.current) return;- setSettingsState(mergedSettings);+ if (!isMountedRef.current) return+ setSettingsState(mergedSettings)// Auto-reconnect UI if tracking was active- const isTrackingActive = allRaw.tracking_enabled === "true";+ const isTrackingActive = allRaw.tracking_enabled === "true"if (isTrackingActive) {- console.log(- "[TrackingContext] 🔄 Re-syncing UI with active background service"- );- internalReconnect();+ console.log("[TrackingContext] 🔄 Re-syncing UI with active background service")+ internalReconnect()}} catch (err) {- console.error("[TrackingContext] Hydration failed:", err);+ console.error("[TrackingContext] Hydration failed:", err)if (isMountedRef.current) {- setError(err instanceof Error ? err : new Error(String(err)));+ setError(err instanceof Error ? err : new Error(String(err)))}} finally {if (isMountedRef.current) {- setIsLoading(false);+ setIsLoading(false)}- hasInitializedRef.current = true;+ hasInitializedRef.current = true}- };+ }- init();+ init()// Safety timeout: force isLoading=false if init hangsconst timeout = setTimeout(() => {if (isMountedRef.current && !hasInitializedRef.current) {- console.error(- "[TrackingContext] Initialization timed out after 5s, forcing ready state"- );- setIsLoading(false);- hasInitializedRef.current = true;+ console.error("[TrackingContext] Initialization timed out after 5s, forcing ready state")+ setIsLoading(false)+ hasInitializedRef.current = true}- }, 5000);+ }, 5000)// Cleanup functionreturn () => {- isMountedRef.current = false;- clearTimeout(timeout);- };- }, [internalReconnect, setSettings]);+ isMountedRef.current = false+ clearTimeout(timeout)+ }+ }, [internalReconnect, setSettings])/*** Wrapped tracking controls with useCallback for stable references*/const startTracking = useCallback(async () => {try {- await internalStart(settings);+ await internalStart(settings)if (isMountedRef.current) {- setError(null);+ setError(null)}} catch (err) {- console.error("[TrackingContext] Failed to start tracking:", err);+ console.error("[TrackingContext] Failed to start tracking:", err)if (isMountedRef.current) {- setError(err instanceof Error ? err : new Error(String(err)));+ setError(err instanceof Error ? err : new Error(String(err)))}- throw err;+ throw err}- }, [settings, internalStart]);+ }, [settings, internalStart])const stopTracking = useCallback(() => {try {- internalStop();+ internalStop()if (isMountedRef.current) {- setError(null);+ setError(null)}} catch (err) {- console.error("[TrackingContext] Failed to stop tracking:", err);+ console.error("[TrackingContext] Failed to stop tracking:", err)if (isMountedRef.current) {- setError(err instanceof Error ? err : new Error(String(err)));+ setError(err instanceof Error ? err : new Error(String(err)))}}- }, [internalStop]);+ }, [internalStop])const restartTracking = useCallback(async (newSettings?: Settings) => {try {- await internalRestart(newSettings || settings);+ await internalRestart(newSettings || settings)if (isMountedRef.current) {- setError(null);+ setError(null)}} catch (err) {- console.error("[TrackingContext] Failed to restart tracking:", err);+ console.error("[TrackingContext] Failed to restart tracking:", err)if (isMountedRef.current) {- setError(err instanceof Error ? err : new Error(String(err)));+ setError(err instanceof Error ? err : new Error(String(err)))}- throw err;+ throw err}},[settings, internalRestart]- );+ )/*** Memoized context value to prevent unnecessary re-renders of consuming components.@@ -275,26 +243,12 @@ export function TrackingProvider({ children }: { children: React.ReactNode }) {error,startTracking,stopTracking,- restartTracking,+ restartTracking}),- [- settings,- coords,- tracking,- isLoading,- error,- setSettings,- startTracking,- stopTracking,- restartTracking,- ]- );-- return (- <TrackingContext.Provider value={value}>- {children}- </TrackingContext.Provider>- );+ [settings, coords, tracking, isLoading, error, setSettings, startTracking, stopTracking, restartTracking]+ )++ return <TrackingContext.Provider value={value}>{children}</TrackingContext.Provider>}/**@@ -303,9 +257,9 @@ export function TrackingProvider({ children }: { children: React.ReactNode }) {* @returns {TrackingContextType} Current tracking state and controller functions.*/export function useTracking(): TrackingContextType {- const context = useContext(TrackingContext);+ const context = useContext(TrackingContext)if (!context) {- throw new Error("useTracking must be used within TrackingProvider");+ throw new Error("useTracking must be used within TrackingProvider")}- return context;+ return context}diff --git a/src/helpers/queueStatus.ts b/src/helpers/queueStatus.tsindex 42d9bf0d..62a84e67 100644--- a/src/helpers/queueStatus.ts+++ b/src/helpers/queueStatus.ts@@ -3,16 +3,16 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { ThemeColors } from "../types/global";+import { ThemeColors } from "../types/global"-const HIGH_QUEUE_THRESHOLD = 50;-const CRITICAL_QUEUE_THRESHOLD = 100;+const HIGH_QUEUE_THRESHOLD = 50+const CRITICAL_QUEUE_THRESHOLD = 100/*** Returns the appropriate color for the queue count based on severity*/export const getQueueColor = (count: number, colors: ThemeColors) => {- if (count > CRITICAL_QUEUE_THRESHOLD) return colors.error;- if (count > HIGH_QUEUE_THRESHOLD) return colors.warning;- return colors.text;-};+ if (count > CRITICAL_QUEUE_THRESHOLD) return colors.error+ if (count > HIGH_QUEUE_THRESHOLD) return colors.warning+ return colors.text+}diff --git a/src/helpers/sanitizeCoords.ts b/src/helpers/sanitizeCoords.tsdeleted file mode 100644index fd2dde87..00000000--- a/src/helpers/sanitizeCoords.ts+++ /dev/null@@ -1,196 +0,0 @@-/**- * Copyright (C) 2026 Max Dietrich- * Licensed under the GNU AGPLv3. See LICENSE in the project root for details.- */--import { LocationCoords } from "../types/global";--/**- * Sanitized location coordinates with normalized values for API transmission- */-export interface SanitizedCoords {- latitude: number;- longitude: number;- altitude: number;- accuracy: number;- speed: number;- battery?: number;- batteryStatus: number;-}--/** Earth's radius in meters */-const EARTH_RADIUS_METERS = 6371e3;--/** Valid latitude range */-const VALID_LATITUDE = { min: -90, max: 90 } as const;--/** Valid longitude range */-const VALID_LONGITUDE = { min: -180, max: 180 } as const;--/**- * Sanitizes and normalizes location coordinates for API transmission.- *- * - Preserves lat/lon precision- * - Rounds altitude, accuracy, speed to integers- * - Normalizes battery status to 0 or 1- * - Provides safe defaults for missing values- *- * @param coords Raw location coordinates from device- * @returns Sanitized coordinates ready for transmission- *- * @example- * ```ts- * const raw = { latitude: 40.712776, longitude: -74.005974, altitude: 10.234 };- * const clean = sanitizeCoords(raw);- * // { latitude: 40.712776, longitude: -74.005974, altitude: 10, ... }- * ```- */-export function sanitizeCoords(coords: LocationCoords): SanitizedCoords {- return {- latitude: coords.latitude,- longitude: coords.longitude,- altitude: Math.round(coords.altitude ?? 0),- accuracy: Math.round(coords.accuracy ?? 0),- speed: Math.round(coords.speed ?? 0),- battery:- coords.battery !== undefined ? Math.round(coords.battery) : undefined,- batteryStatus: coords.battery_status ?? 0,- };-}--/**- * Validates that coordinates are within valid geographic ranges.- *- * Checks:- * - Latitude: -90 to 90- * - Longitude: -180 to 180- * - No NaN or Infinity values- *- * @param coords Coordinates to validate- * @returns True if valid, false otherwise- *- * @example- * ```ts- * if (isValidCoordinates(coords)) {- * await sendToServer(coords);- * }- * ```- */-export function isValidCoordinates(coords: LocationCoords): boolean {- const { latitude, longitude } = coords;-- return (- // Check latitude range- latitude >= VALID_LATITUDE.min &&- latitude <= VALID_LATITUDE.max &&- // Check longitude range- longitude >= VALID_LONGITUDE.min &&- longitude <= VALID_LONGITUDE.max &&- // Check for valid numbers- Number.isFinite(latitude) &&- Number.isFinite(longitude)- );-}--/**- * Calculates distance between two points using Haversine formula.- *- * @param coord1 First coordinate point- * @param coord2 Second coordinate point- * @returns Distance in meters- *- * @example- * ```ts- * const pointA = { latitude: 40.7128, longitude: -74.0060 };- * const pointB = { latitude: 40.7589, longitude: -73.9851 };- * const distance = calculateDistance(pointA, pointB); // ~5820 meters- * ```- */-export function calculateDistance(- coord1: LocationCoords,- coord2: LocationCoords-): number {- const toRadians = (degrees: number) => (degrees * Math.PI) / 180;-- const φ1 = toRadians(coord1.latitude);- const φ2 = toRadians(coord2.latitude);- const Δφ = toRadians(coord2.latitude - coord1.latitude);- const Δλ = toRadians(coord2.longitude - coord1.longitude);-- const a =- Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +- Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);-- const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));-- return EARTH_RADIUS_METERS * c;-}--/**- * Formats coordinates as a human-readable string.- *- * @param coords Coordinates to format- * @param precision Number of decimal places (default: 6)- * @returns Formatted coordinate string- *- * @example- * ```ts- * formatCoordinates({ latitude: 40.712776, longitude: -74.005974 });- * // "40.712776, -74.005974"- *- * formatCoordinates({ latitude: 40.712776, longitude: -74.005974 }, 3);- * // "40.713, -74.006"- * ```- */-export function formatCoordinates(- coords: LocationCoords,- precision: number = 6-): string {- return `${coords.latitude.toFixed(precision)}, ${coords.longitude.toFixed(- precision- )}`;-}--/**- * Checks if two coordinate points are approximately equal within a threshold.- *- * @param coord1 First coordinate point- * @param coord2 Second coordinate point- * @param thresholdMeters Distance threshold in meters (default: 10)- * @returns True if coordinates are within threshold- *- * @example- * ```ts- * const pointA = { latitude: 40.7128, longitude: -74.0060 };- * const pointB = { latitude: 40.7129, longitude: -74.0061 };- * const isNear = areCoordinatesNear(pointA, pointB, 20); // true- * ```- */-export function areCoordinatesNear(- coord1: LocationCoords,- coord2: LocationCoords,- thresholdMeters: number = 10-): boolean {- const distance = calculateDistance(coord1, coord2);- return distance <= thresholdMeters;-}--/**- * Converts degrees to radians- *- * @param degrees Angle in degrees- * @returns Angle in radians- */-export function degreesToRadians(degrees: number): number {- return (degrees * Math.PI) / 180;-}--/**- * Converts radians to degrees- *- * @param radians Angle in radians- * @returns Angle in degrees- */-export function radiansToDegrees(radians: number): number {- return (radians * 180) / Math.PI;-}diff --git a/src/hooks/useLocationTracking.ts b/src/hooks/useLocationTracking.tsindex a0ef3ecb..18236d1f 100644--- a/src/hooks/useLocationTracking.ts+++ b/src/hooks/useLocationTracking.ts@@ -3,18 +3,14 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { useState, useEffect, useRef, useCallback } from "react";-import { NativeEventEmitter, NativeModules, Alert } from "react-native";-import NativeLocationService from "../services/NativeLocationService";-import {- LocationCoords,- Settings,- LocationTrackingResult,-} from "../types/global";-import { ensurePermissions } from "../services/LocationServicePermission";+import { useState, useEffect, useRef, useCallback } from "react"+import { NativeEventEmitter, NativeModules, Alert } from "react-native"+import NativeLocationService from "../services/NativeLocationService"+import { LocationCoords, Settings, LocationTrackingResult } from "../types/global"+import { ensurePermissions } from "../services/LocationServicePermission"-const { LocationServiceModule } = NativeModules;-const locationEventEmitter = new NativeEventEmitter(LocationServiceModule);+const { LocationServiceModule } = NativeModules+const locationEventEmitter = new NativeEventEmitter(LocationServiceModule)/*** Hook for managing native location tracking.@@ -30,29 +26,27 @@ const locationEventEmitter = new NativeEventEmitter(LocationServiceModule);* @param settings Initial tracking configuration* @returns Control interface for location tracking*/-export function useLocationTracking(- settings: Settings-): LocationTrackingResult {+export function useLocationTracking(settings: Settings): LocationTrackingResult {// State- const [coords, setCoords] = useState<LocationCoords | null>(null);- const [tracking, setTracking] = useState(false);- const [isRestarting, setIsRestarting] = useState(false);+ const [coords, setCoords] = useState<LocationCoords | null>(null)+ const [tracking, setTracking] = useState(false)+ const [isRestarting, setIsRestarting] = useState(false)// Refs for synchronous checks- const settingsRef = useRef<Settings>(settings);- const isTrackingRef = useRef(false);- const restartingRef = useRef(false);- const restartQueuedRef = useRef(false);- const listenerRef = useRef<any>(null);+ const settingsRef = useRef<Settings>(settings)+ const isTrackingRef = useRef(false)+ const restartingRef = useRef(false)+ const restartQueuedRef = useRef(false)+ const listenerRef = useRef<any>(null)// Sync refs with stateuseEffect(() => {- settingsRef.current = settings;- }, [settings]);+ settingsRef.current = settings+ }, [settings])useEffect(() => {- isTrackingRef.current = tracking;- }, [tracking]);+ isTrackingRef.current = tracking+ }, [tracking])/*** Fetches last known location from SQLite on mount@@ -62,7 +56,7 @@ export function useLocationTracking(const syncInitialLocation = async () => {if (!coords && (tracking || isRestarting)) {try {- const latest = await NativeLocationService.getMostRecentLocation();+ const latest = await NativeLocationService.getMostRecentLocation()if (latest) {setCoords({latitude: latest.latitude,@@ -73,53 +67,47 @@ export function useLocationTracking(bearing: latest.bearing ?? 0,timestamp: latest.timestamp ?? Date.now(),battery: latest.battery,- battery_status: latest.batteryStatus,- });+ battery_status: latest.batteryStatus+ })}} catch (err) {- console.error(- "[useLocationTracking] Failed to fetch initial location:",- err- );+ console.error("[useLocationTracking] Failed to fetch initial location:", err)}}- };+ }- syncInitialLocation();- }, [tracking, isRestarting, coords]);+ syncInitialLocation()+ }, [tracking, isRestarting, coords])/*** Subscribes to real-time location updates from native service*/useEffect(() => {if (tracking && !listenerRef.current) {- console.log("[useLocationTracking] 📡 Attaching native listener");- listenerRef.current = locationEventEmitter.addListener(- "onLocationUpdate",- (event: any) => {- setCoords({- latitude: event.latitude,- longitude: event.longitude,- accuracy: event.accuracy,- altitude: event.altitude,- speed: event.speed,- bearing: event.bearing,- timestamp: event.timestamp,- battery: event.battery,- battery_status: event.batteryStatus,- });- }- );+ console.log("[useLocationTracking] 📡 Attaching native listener")+ listenerRef.current = locationEventEmitter.addListener("onLocationUpdate", (event: any) => {+ setCoords({+ latitude: event.latitude,+ longitude: event.longitude,+ accuracy: event.accuracy,+ altitude: event.altitude,+ speed: event.speed,+ bearing: event.bearing,+ timestamp: event.timestamp,+ battery: event.battery,+ battery_status: event.batteryStatus+ })+ })}return () => {if (listenerRef.current) {- console.log("[useLocationTracking] 🔌 Detaching native listener");- listenerRef.current.remove();- listenerRef.current = null;+ console.log("[useLocationTracking] 🔌 Detaching native listener")+ listenerRef.current.remove()+ listenerRef.current = null}- };- }, [tracking]);+ }+ }, [tracking])/*** Starts location tracking@@ -127,58 +115,53 @@ export function useLocationTracking(*/const startTracking = useCallback(async (overrideSettings?: Settings) => {if (isTrackingRef.current) {- console.log("[useLocationTracking] Already tracking");- return;+ console.log("[useLocationTracking] Already tracking")+ return}const effectiveSettings: Settings = {...settingsRef.current,- ...overrideSettings,- };+ ...overrideSettings+ }- const granted = await ensurePermissions();+ const granted = await ensurePermissions()if (!granted) {- Alert.alert(- "Permission Required",- "Background location permission is required for tracking."- );- return;+ Alert.alert("Permission Required", "Background location permission is required for tracking.")+ return}- setTracking(true);+ setTracking(true)try {- await NativeLocationService.start(effectiveSettings);- console.log(- `[useLocationTracking] ✅ Service started (offline: ${effectiveSettings.isOfflineMode})`- );+ await NativeLocationService.start(effectiveSettings)+ console.log(`[useLocationTracking] ✅ Service started (offline: ${effectiveSettings.isOfflineMode})`)} catch (error) {- setTracking(false);- console.error("[useLocationTracking] ❌ Failed to start:", error);- Alert.alert("Error", "Failed to start location tracking.");+ setTracking(false)+ console.error("[useLocationTracking] ❌ Failed to start:", error)+ Alert.alert("Error", "Failed to start location tracking.")}- }, []);+ }, [])/*** Stops location tracking and cleans up*/const stopTracking = useCallback(() => {if (!isTrackingRef.current) {- console.log("[useLocationTracking] Not tracking");- return;+ console.log("[useLocationTracking] Not tracking")+ return}- console.log("[useLocationTracking] Stopping service");+ console.log("[useLocationTracking] Stopping service")if (listenerRef.current) {- listenerRef.current.remove();- listenerRef.current = null;+ listenerRef.current.remove()+ listenerRef.current = null}- NativeLocationService.stop();- setTracking(false);- setCoords(null);- }, []);+ NativeLocationService.stop()+ setTracking(false)+ setCoords(null)+ }, [])/*** Restarts the service with new settings@@ -188,38 +171,36 @@ export function useLocationTracking(const restartTracking = useCallback(async (newSettings?: Settings) => {if (restartingRef.current) {- console.log(- "[useLocationTracking] Restart already in progress, queuing"- );- restartQueuedRef.current = true;- return;+ console.log("[useLocationTracking] Restart already in progress, queuing")+ restartQueuedRef.current = true+ return}- console.log("[useLocationTracking] Restarting service");- setIsRestarting(true);- restartingRef.current = true;+ console.log("[useLocationTracking] Restarting service")+ setIsRestarting(true)+ restartingRef.current = truetry {- stopTracking();+ stopTracking()// Android requires delay to fully release foreground service- await new Promise<void>((resolve) => setTimeout(resolve, 500));+ await new Promise<void>((resolve) => setTimeout(resolve, 500))- await startTracking(newSettings ?? settingsRef.current);+ await startTracking(newSettings ?? settingsRef.current)} finally {- restartingRef.current = false;- setIsRestarting(false);+ restartingRef.current = false+ setIsRestarting(false)// Process queued restart if anyif (restartQueuedRef.current) {- restartQueuedRef.current = false;- console.log("[useLocationTracking] Processing queued restart");- setTimeout(() => restartTracking(newSettings), 100);+ restartQueuedRef.current = false+ console.log("[useLocationTracking] Processing queued restart")+ setTimeout(() => restartTracking(newSettings), 100)}}},[startTracking, stopTracking]- );+ )/*** Reconnects React state to an already-running native service.@@ -228,13 +209,13 @@ export function useLocationTracking(*/const reconnect = useCallback(() => {if (isTrackingRef.current) {- console.log("[useLocationTracking] Already tracking, skip reconnect");- return;+ console.log("[useLocationTracking] Already tracking, skip reconnect")+ return}- console.log("[useLocationTracking] Reconnecting to active service");- setTracking(true);- }, []);+ console.log("[useLocationTracking] Reconnecting to active service")+ setTracking(true)+ }, [])/*** Cleanup on unmount@@ -242,13 +223,11 @@ export function useLocationTracking(*/useEffect(() => {return () => {- console.log(- "[useLocationTracking] 🧹 Component unmounted, service remains active"- );- restartQueuedRef.current = false;- restartingRef.current = false;- };- }, []);+ console.log("[useLocationTracking] 🧹 Component unmounted, service remains active")+ restartQueuedRef.current = false+ restartingRef.current = false+ }+ }, [])return {coords,@@ -257,6 +236,6 @@ export function useLocationTracking(stopTracking,restartTracking,reconnect,- settings,- };+ settings+ }}diff --git a/src/hooks/useTheme.tsx b/src/hooks/useTheme.tsxindex b2507703..4f6268bb 100644--- a/src/hooks/useTheme.tsx+++ b/src/hooks/useTheme.tsx@@ -3,43 +3,33 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, {- useState,- useEffect,- useContext,- createContext,- ReactNode,- useMemo,- useCallback,-} from "react";-import { Appearance, ColorSchemeName } from "react-native";-import { ThemeColors, ThemeMode } from "../types/global";-import { darkColors, lightColors } from "../styles/colors";+import React, { useState, useEffect, useContext, createContext, ReactNode, useMemo, useCallback } from "react"+import { Appearance, ColorSchemeName } from "react-native"+import { ThemeColors, ThemeMode } from "../types/global"+import { darkColors, lightColors } from "../styles/colors"/*** Extended theme context with additional utilities*/interface ThemeContextType {- colors: ThemeColors;- mode: ThemeMode;- toggleTheme: () => void;- resetToSystemTheme: () => void;- setTheme: (mode: ThemeMode) => void;- isDark: boolean;- isLight: boolean;- hasManualOverride: boolean;+ colors: ThemeColors+ mode: ThemeMode+ toggleTheme: () => void+ resetToSystemTheme: () => void+ setTheme: (mode: ThemeMode) => void+ isDark: boolean+ isLight: boolean+ hasManualOverride: boolean}/*** Normalizes React Native's ColorSchemeName to ThemeMode*/-const normalizeScheme = (- scheme: ColorSchemeName | null | undefined-): ThemeMode => {- return scheme === "dark" ? "dark" : "light";-};+const normalizeScheme = (scheme: ColorSchemeName | null | undefined): ThemeMode => {+ return scheme === "dark" ? "dark" : "light"+}-const ThemeContext = createContext<ThemeContextType | undefined>(undefined);+const ThemeContext = createContext<ThemeContextType | undefined>(undefined)/*** Theme provider managing theme state and system theme synchronization.@@ -57,50 +47,45 @@ const ThemeContext = createContext<ThemeContextType | undefined>(undefined);* ```*/export const ThemeProvider = ({ children }: { children: ReactNode }) => {- const [hasManualOverride, setHasManualOverride] = useState(false);- const [mode, setMode] = useState<ThemeMode>(() =>- normalizeScheme(Appearance.getColorScheme())- );+ const [hasManualOverride, setHasManualOverride] = useState(false)+ const [mode, setMode] = useState<ThemeMode>(() => normalizeScheme(Appearance.getColorScheme()))// Listen to system theme changesuseEffect(() => {const subscription = Appearance.addChangeListener(({ colorScheme }) => {if (!hasManualOverride) {- setMode(normalizeScheme(colorScheme));+ setMode(normalizeScheme(colorScheme))}- });+ })- return () => subscription.remove();- }, [hasManualOverride]);+ return () => subscription.remove()+ }, [hasManualOverride])/*** Toggles between light and dark theme*/const toggleTheme = useCallback(() => {- setHasManualOverride(true);- setMode((prev) => (prev === "light" ? "dark" : "light"));- }, []);+ setHasManualOverride(true)+ setMode((prev) => (prev === "light" ? "dark" : "light"))+ }, [])/*** Resets theme to follow system preference*/const resetToSystemTheme = useCallback(() => {- setHasManualOverride(false);- setMode(normalizeScheme(Appearance.getColorScheme()));- }, []);+ setHasManualOverride(false)+ setMode(normalizeScheme(Appearance.getColorScheme()))+ }, [])/*** Sets specific theme mode*/const setTheme = useCallback((newMode: ThemeMode) => {- setHasManualOverride(true);- setMode(newMode);- }, []);+ setHasManualOverride(true)+ setMode(newMode)+ }, [])- const colors = useMemo(- () => (mode === "dark" ? darkColors : lightColors),- [mode]- );+ const colors = useMemo(() => (mode === "dark" ? darkColors : lightColors), [mode])const contextValue = useMemo(() => ({@@ -111,17 +96,13 @@ export const ThemeProvider = ({ children }: { children: ReactNode }) => {setTheme,isDark: mode === "dark",isLight: mode === "light",- hasManualOverride,+ hasManualOverride}),[colors, mode, hasManualOverride, toggleTheme, resetToSystemTheme, setTheme]- );+ )- return (- <ThemeContext.Provider value={contextValue}>- {children}- </ThemeContext.Provider>- );-};+ return <ThemeContext.Provider value={contextValue}>{children}</ThemeContext.Provider>+}/*** Hook to access theme context.@@ -140,38 +121,9 @@ export const ThemeProvider = ({ children }: { children: ReactNode }) => {* ```*/export const useTheme = (): ThemeContextType => {- const context = useContext(ThemeContext);+ const context = useContext(ThemeContext)if (!context) {- throw new Error("useTheme must be used within a ThemeProvider");+ throw new Error("useTheme must be used within a ThemeProvider")}- return context;-};--/**- * Gets a specific color from the current theme.- *- * @example- * ```tsx- * const primaryColor = useThemeColor('primary');- * ```- */-export const useThemeColor = <K extends keyof ThemeColors>(- colorKey: K-): ThemeColors[K] => {- const { colors } = useTheme();- return colors[colorKey];-};--/**- * Returns different values based on current theme mode.- *- * @example- * ```tsx- * const padding = useThemedValue(16, 20);- * const icon = useThemedValue('☀️', '🌙');- * ```- */-export const useThemedValue = <T,>(lightValue: T, darkValue: T): T => {- const { isDark } = useTheme();- return isDark ? darkValue : lightValue;-};+ return context+}diff --git a/src/screens/AboutScreen.tsx b/src/screens/AboutScreen.tsxindex 7d7851b0..e9d609f8 100644--- a/src/screens/AboutScreen.tsx+++ b/src/screens/AboutScreen.tsx@@ -3,24 +3,16 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useEffect } from "react";-import {- Text,- StyleSheet,- View,- ScrollView,- Linking,- TouchableOpacity,- Image,-} from "react-native";-import { ScreenProps, ThemeColors } from "../types/global";-import { useTheme } from "../hooks/useTheme";-import { SectionTitle, Card, Container, Divider, Footer } from "../components";-import NativeLocationService from "../services/NativeLocationService";-import icon from "../assets/icons/icon.png";+import React, { useState, useEffect } from "react"+import { Text, StyleSheet, View, ScrollView, Linking, TouchableOpacity, Image } from "react-native"+import { ScreenProps, ThemeColors } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import { SectionTitle, Card, Container, Divider, Footer } from "../components"+import NativeLocationService from "../services/NativeLocationService"+import icon from "../assets/icons/icon.png"-const REPO_URL = "https://github.com/dietrichmax/colota";-const PRIVACY_POLICY_URL = "https://mxd.codes/colota/privacy-policy";+const REPO_URL = "https://github.com/dietrichmax/colota"+const PRIVACY_POLICY_URL = "https://mxd.codes/colota/privacy-policy"// Helper function to map SDK to Android versionfunction getAndroidVersion(sdkVersion: number): string {@@ -38,9 +30,9 @@ function getAndroidVersion(sdkVersion: number): string {34: "14",35: "15",36: "16",- 37: "17",- };- return versions[sdkVersion] || "Unknown";+ 37: "17"+ }+ return versions[sdkVersion] || "Unknown"}// Moved outside of AboutScreen component@@ -50,14 +42,14 @@ const LinkButton = ({subtitle,url,colors,- onOpenURL,+ onOpenURL}: {- iconLabel: string;- title: string;- subtitle: string;- url: string;- colors: ThemeColors;- onOpenURL: (url: string) => void;+ iconLabel: string+ title: string+ subtitle: string+ url: string+ colors: ThemeColors+ onOpenURL: (url: string) => void}) => (<TouchableOpacitystyle={[styles.linkButton, { backgroundColor: colors.background }]}@@ -68,92 +60,78 @@ const LinkButton = ({<Text style={styles.linkIcon}>{iconLabel}</Text><View style={styles.linkTextContainer}><Text style={[styles.linkTitle, { color: colors.text }]}>{title}</Text>- <Text style={[styles.linkSubtitle, { color: colors.textSecondary }]}>- {subtitle}- </Text>+ <Text style={[styles.linkSubtitle, { color: colors.textSecondary }]}>{subtitle}</Text></View><Text style={[styles.chevron, { color: colors.textLight }]}>›</Text></View></TouchableOpacity>-);+)-const TechRow = ({- label,- value,- colors,-}: {- label: string;- value: string;- colors: ThemeColors;-}) => (+const TechRow = ({ label, value, colors }: { label: string; value: string; colors: ThemeColors }) => (<><View style={styles.techRow}>- <Text style={[styles.techLabel, { color: colors.textSecondary }]}>- {label}- </Text>+ <Text style={[styles.techLabel, { color: colors.textSecondary }]}>{label}</Text><Text style={[styles.techValue, { color: colors.text }]}>{value}</Text></View><Divider /></>-);+)export function AboutScreen({}: ScreenProps) {- const { colors } = useTheme();- const [showDebugInfo, setShowDebugInfo] = useState(false);- const [tapCount, setTapCount] = useState(0);+ const { colors } = useTheme()+ const [showDebugInfo, setShowDebugInfo] = useState(false)+ const [tapCount, setTapCount] = useState(0)const [deviceInfo, setDeviceInfo] = useState({model: "...",brand: "...",deviceId: "...",systemVersion: "...",- apiLevel: "...",- });+ apiLevel: "..."+ })- const buildConfig = NativeLocationService.getBuildConfig();+ const buildConfig = NativeLocationService.getBuildConfig()// Reset tap count after 2 secondsuseEffect(() => {if (tapCount > 0) {- const timer = setTimeout(() => setTapCount(0), 2000);- return () => clearTimeout(timer);+ const timer = setTimeout(() => setTapCount(0), 2000)+ return () => clearTimeout(timer)}- }, [tapCount]);+ }, [tapCount])const handleVersionTap = () => {- const newCount = tapCount + 1;- setTapCount(newCount);+ const newCount = tapCount + 1+ setTapCount(newCount)// Enable debug mode after 7 tapsif (newCount >= 7) {- setShowDebugInfo(true);- setTapCount(0);+ setShowDebugInfo(true)+ setTapCount(0)}- };+ }useEffect(() => {const loadDeviceInfo = async () => {try {- const info = await NativeLocationService.getDeviceInfo();+ const info = await NativeLocationService.getDeviceInfo()setDeviceInfo({model: info.model,brand: info.brand,deviceId: info.deviceId,systemVersion: info.systemVersion,- apiLevel: info.apiLevel.toString(),- });+ apiLevel: info.apiLevel.toString()+ })} catch (err) {- console.error("Failed to load device info:", err);+ console.error("Failed to load device info:", err)}- };+ }- loadDeviceInfo();- }, []);+ loadDeviceInfo()+ }, [])const handleOpenURL = (url: string) => {- Linking.openURL(url).catch((err) =>- console.error("Failed to open URL:", err)- );- };+ Linking.openURL(url).catch((err) => console.error("Failed to open URL:", err))+ }// Fallback if buildConfig is not availableif (!buildConfig) {@@ -162,13 +140,11 @@ export function AboutScreen({}: ScreenProps) {<ScrollView contentContainerStyle={styles.scrollContent}><View style={styles.header}><Text style={[styles.title, { color: colors.text }]}>Colota</Text>- <Text style={[styles.subtitle, { color: colors.textSecondary }]}>- Build configuration unavailable- </Text>+ <Text style={[styles.subtitle, { color: colors.textSecondary }]}>Build configuration unavailable</Text></View></ScrollView></Container>- );+ )}return (@@ -176,11 +152,7 @@ export function AboutScreen({}: ScreenProps) {<ScrollView contentContainerStyle={styles.scrollContent}>{/* App Icon & Header */}<View style={styles.header}>- <TouchableOpacity- style={styles.appIconContainer}- onPress={handleVersionTap}- activeOpacity={0.8}- >+ <TouchableOpacity style={styles.appIconContainer} onPress={handleVersionTap} activeOpacity={0.8}><Image source={icon} style={styles.appIcon} resizeMode="contain" /></TouchableOpacity><Text style={[styles.title, { color: colors.text }]}>Colota</Text>@@ -202,10 +174,7 @@ export function AboutScreen({}: ScreenProps) {)}{showDebugInfo && (- <TouchableOpacity- onPress={() => setShowDebugInfo(false)}- style={styles.debugBadge}- >+ <TouchableOpacity onPress={() => setShowDebugInfo(false)} style={styles.debugBadge}><Text style={styles.debugText}>🐛 Debug Mode (tap to hide)</Text></TouchableOpacity>)}@@ -213,13 +182,11 @@ export function AboutScreen({}: ScreenProps) {{/* Description Card */}<Card style={styles.descriptionCard}>- <Text style={[styles.tagline, { color: colors.primary }]}>- Privacy-First Location Tracking- </Text>+ <Text style={[styles.tagline, { color: colors.primary }]}>Privacy-First Location Tracking</Text><Text style={[styles.description, { color: colors.text }]}>- A GPS location tracking client built for selfhosted backends. Modern- Android {getAndroidVersion(buildConfig.TARGET_SDK_VERSION)}{" "}- standards with battery efficiency and data sovereignty at its core.+ A GPS location tracking client built for selfhosted backends. Modern Android{" "}+ {getAndroidVersion(buildConfig.TARGET_SDK_VERSION)} standards with battery efficiency and data sovereignty+ at its core.</Text></Card>@@ -248,27 +215,18 @@ export function AboutScreen({}: ScreenProps) {<TouchableOpacitystyle={[styles.linkButton, { backgroundColor: colors.background }]}- onPress={() =>- handleOpenURL(- "https://github.com/dietrichmax/colota/blob/main/LICENSE"- )- }+ onPress={() => handleOpenURL("https://github.com/dietrichmax/colota/blob/main/LICENSE")}activeOpacity={0.7}><View style={styles.section}><SectionTitle>LICENSE</SectionTitle><Card><View style={styles.licenseHeader}>- <Text style={[styles.licenseBadge, { color: colors.primary }]}>- 📜 GNU AGPLv3- </Text>+ <Text style={[styles.licenseBadge, { color: colors.primary }]}>📜 GNU AGPLv3</Text></View>- <Text- style={[styles.licenseText, { color: colors.textSecondary }]}- >- Free and open-source software. You're free to inspect, modify,- and redistribute the code. Network-based modifications must be- shared with the community.+ <Text style={[styles.licenseText, { color: colors.textSecondary }]}>+ Free and open-source software. You're free to inspect, modify, and redistribute the code. Network-based+ modifications must be shared with the community.</Text></Card></View>@@ -278,23 +236,11 @@ export function AboutScreen({}: ScreenProps) {<View style={styles.section}><SectionTitle>APP VERSION</SectionTitle><Card>- <TechRow- label="Version"- value={`${buildConfig.VERSION_NAME}`}- colors={colors}- />- <TechRow- label="Build"- value={`${buildConfig.VERSION_CODE}`}- colors={colors}- />+ <TechRow label="Version" value={`${buildConfig.VERSION_NAME}`} colors={colors} />+ <TechRow label="Build" value={`${buildConfig.VERSION_CODE}`} colors={colors} /><View style={styles.techRow}>- <Text style={[styles.techLabel, { color: colors.textSecondary }]}>- Framework- </Text>- <Text style={[styles.techValue, { color: colors.text }]}>- React Native- </Text>+ <Text style={[styles.techLabel, { color: colors.textSecondary }]}>Framework</Text>+ <Text style={[styles.techValue, { color: colors.text }]}>React Native</Text></View></Card></View>@@ -307,46 +253,22 @@ export function AboutScreen({}: ScreenProps) {<Card><TechRowlabel="Target SDK"- value={`${- buildConfig.TARGET_SDK_VERSION- } (Android ${getAndroidVersion(+ value={`${buildConfig.TARGET_SDK_VERSION} (Android ${getAndroidVersion(buildConfig.TARGET_SDK_VERSION)})`}colors={colors}/><TechRowlabel="Min SDK"- value={`${- buildConfig.MIN_SDK_VERSION- } (Android ${getAndroidVersion(- buildConfig.MIN_SDK_VERSION- )})`}- colors={colors}- />- <TechRow- label="Compile SDK"- value={buildConfig.COMPILE_SDK_VERSION.toString()}- colors={colors}- />- <TechRow- label="Build Tools"- value={buildConfig.BUILD_TOOLS_VERSION}- colors={colors}- />- <TechRow- label="Kotlin Version"- value={buildConfig.KOTLIN_VERSION}+ value={`${buildConfig.MIN_SDK_VERSION} (Android ${getAndroidVersion(buildConfig.MIN_SDK_VERSION)})`}colors={colors}/>+ <TechRow label="Compile SDK" value={buildConfig.COMPILE_SDK_VERSION.toString()} colors={colors} />+ <TechRow label="Build Tools" value={buildConfig.BUILD_TOOLS_VERSION} colors={colors} />+ <TechRow label="Kotlin Version" value={buildConfig.KOTLIN_VERSION} colors={colors} /><View style={styles.techRow}>- <Text- style={[styles.techLabel, { color: colors.textSecondary }]}- >- NDK Version- </Text>- <Text style={[styles.techValue, { color: colors.text }]}>- {buildConfig.NDK_VERSION}- </Text>+ <Text style={[styles.techLabel, { color: colors.textSecondary }]}>NDK Version</Text>+ <Text style={[styles.techValue, { color: colors.text }]}>{buildConfig.NDK_VERSION}</Text></View></Card></View>@@ -354,35 +276,13 @@ export function AboutScreen({}: ScreenProps) {<View style={styles.section}><SectionTitle>🐛 DEBUG: DEVICE INFORMATION</SectionTitle><Card>- <TechRow- label="OS Version"- value={`Android ${deviceInfo.systemVersion}`}- colors={colors}- />- <TechRow- label="API Level"- value={deviceInfo.apiLevel}- colors={colors}- />- <TechRow- label="Device Model"- value={deviceInfo.model}- colors={colors}- />- <TechRow- label="Device Brand"- value={deviceInfo.brand}- colors={colors}- />+ <TechRow label="OS Version" value={`Android ${deviceInfo.systemVersion}`} colors={colors} />+ <TechRow label="API Level" value={deviceInfo.apiLevel} colors={colors} />+ <TechRow label="Device Model" value={deviceInfo.model} colors={colors} />+ <TechRow label="Device Brand" value={deviceInfo.brand} colors={colors} /><View style={styles.techRow}>- <Text- style={[styles.techLabel, { color: colors.textSecondary }]}- >- Device ID- </Text>- <Text style={[styles.techValue, { color: colors.text }]}>- {deviceInfo.deviceId}- </Text>+ <Text style={[styles.techLabel, { color: colors.textSecondary }]}>Device ID</Text>+ <Text style={[styles.techValue, { color: colors.text }]}>{deviceInfo.deviceId}</Text></View></Card></View>@@ -393,19 +293,19 @@ export function AboutScreen({}: ScreenProps) {<Footer /></ScrollView></Container>- );+ )}const styles = StyleSheet.create({scrollContent: {paddingHorizontal: 16,paddingBottom: 40,- paddingTop: 8,+ paddingTop: 8},header: {marginTop: 20,marginBottom: 28,- alignItems: "center",+ alignItems: "center"},appIconContainer: {width: 80,@@ -414,116 +314,116 @@ const styles = StyleSheet.create({alignItems: "center",justifyContent: "center",marginBottom: 16,- overflow: "hidden",+ overflow: "hidden"},appIcon: {width: 80,- height: 80,+ height: 80},title: {fontSize: 32,fontWeight: "700",- marginBottom: 8,+ marginBottom: 8},subtitle: {fontSize: 14,- fontWeight: "500",+ fontWeight: "500"},versionBadge: {paddingHorizontal: 12,paddingVertical: 4,- borderRadius: 12,+ borderRadius: 12},versionText: {color: "#FFFFFF",fontSize: 12,- fontWeight: "600",+ fontWeight: "600"},descriptionCard: {- marginBottom: 24,+ marginBottom: 24},tagline: {fontSize: 17,fontWeight: "700",- marginBottom: 8,+ marginBottom: 8},description: {fontSize: 15,- lineHeight: 22,+ lineHeight: 22},section: {- marginBottom: 24,+ marginBottom: 24},linkButton: {borderRadius: 12,marginBottom: 8,- overflow: "hidden",+ overflow: "hidden"},linkContent: {flexDirection: "row",alignItems: "center",- padding: 16,+ padding: 16},linkIcon: {fontSize: 28,- marginRight: 16,+ marginRight: 16},linkTextContainer: {- flex: 1,+ flex: 1},linkTitle: {fontSize: 16,fontWeight: "600",- marginBottom: 2,+ marginBottom: 2},linkSubtitle: {- fontSize: 13,+ fontSize: 13},chevron: {fontSize: 28,fontWeight: "300",- marginLeft: 8,+ marginLeft: 8},licenseHeader: {- marginBottom: 12,+ marginBottom: 12},licenseBadge: {fontSize: 16,- fontWeight: "700",+ fontWeight: "700"},licenseText: {fontSize: 14,- lineHeight: 20,+ lineHeight: 20},techRow: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- paddingVertical: 8,+ paddingVertical: 8},techLabel: {fontSize: 14,- fontWeight: "500",+ fontWeight: "500"},techValue: {fontSize: 14,- fontWeight: "600",+ fontWeight: "600"},debugHint: {fontSize: 11,marginTop: 8,- fontStyle: "italic",+ fontStyle: "italic"},debugBadge: {marginTop: 12,paddingHorizontal: 12,paddingVertical: 6,backgroundColor: "rgba(255, 152, 0, 0.2)",- borderRadius: 8,+ borderRadius: 8},debugText: {fontSize: 12,color: "#FF9800",- fontWeight: "600",- },-});+ fontWeight: "600"+ }+})diff --git a/src/screens/ApiSettingsScreen.tsx b/src/screens/ApiSettingsScreen.tsxindex 0a75cb8c..db75ae63 100644--- a/src/screens/ApiSettingsScreen.tsx+++ b/src/screens/ApiSettingsScreen.tsx@@ -3,31 +3,12 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useCallback, useEffect, useRef } from "react";-import {- Text,- StyleSheet,- TextInput,- View,- ScrollView,- TouchableOpacity,-} from "react-native";-import {- FieldMap,- DEFAULT_FIELD_MAP,- ScreenProps,- CustomField,- ApiTemplateName,- API_TEMPLATES,-} from "../types/global";-import { useTheme } from "../hooks/useTheme";-import { useTracking } from "../contexts/TrackingProvider";-import {- SectionTitle,- FloatingSaveIndicator,- Container,- Divider,-} from "../components";+import React, { useState, useCallback, useEffect, useRef } from "react"+import { Text, StyleSheet, TextInput, View, ScrollView, TouchableOpacity } from "react-native"+import { FieldMap, DEFAULT_FIELD_MAP, ScreenProps, CustomField, ApiTemplateName, API_TEMPLATES } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import { useTracking } from "../contexts/TrackingProvider"+import { SectionTitle, FloatingSaveIndicator, Container, Divider } from "../components"/** Field descriptions for UI display */const FIELD_DESCRIPTIONS: Record<keyof FieldMap, string> = {@@ -39,28 +20,28 @@ const FIELD_DESCRIPTIONS: Record<keyof FieldMap, string> = {batt: "Battery level percentage",bs: "Battery charging status",tst: "Timestamp",- bear: "Direction of travel (0-360°)",-};+ bear: "Direction of travel (0-360°)"+}const TEMPLATE_OPTIONS: { value: ApiTemplateName; label: string }[] = [{ value: "custom", label: "Custom" },{ value: "dawarich", label: "Dawarich" },{ value: "owntracks", label: "OwnTracks" },- { value: "reitti", label: "Reitti" },-];+ { value: "reitti", label: "Reitti" }+]/*** Returns the reference field map for the current template.* Used for "Modified" badge comparison and "Reset" actions.*/function getReferenceFieldMap(template: ApiTemplateName): FieldMap {- if (template === "custom") return DEFAULT_FIELD_MAP;- return API_TEMPLATES[template].fieldMap;+ if (template === "custom") return DEFAULT_FIELD_MAP+ return API_TEMPLATES[template].fieldMap}function getReferenceCustomFields(template: ApiTemplateName): CustomField[] {- if (template === "custom") return [];- return API_TEMPLATES[template].customFields;+ if (template === "custom") return []+ return API_TEMPLATES[template].customFields}/**@@ -68,134 +49,117 @@ function getReferenceCustomFields(template: ApiTemplateName): CustomField[] {* and custom static fields.*/export function ApiSettingsScreen({}: ScreenProps) {- const { settings, setSettings, restartTracking } = useTracking();- const { colors } = useTheme();-- const [localFieldMap, setLocalFieldMap] = useState<FieldMap>(- settings.fieldMap || DEFAULT_FIELD_MAP- );- const [localCustomFields, setLocalCustomFields] = useState<CustomField[]>(- settings.customFields || []- );- const [localTemplate, setLocalTemplate] = useState<ApiTemplateName>(- settings.apiTemplate || "custom"- );- const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);-- const [saving, setSaving] = useState(false);- const [saveSuccess, setSaveSuccess] = useState(false);-- const referenceFieldMap = getReferenceFieldMap(localTemplate);+ const { settings, setSettings, restartTracking } = useTracking()+ const { colors } = useTheme()++ const [localFieldMap, setLocalFieldMap] = useState<FieldMap>(settings.fieldMap || DEFAULT_FIELD_MAP)+ const [localCustomFields, setLocalCustomFields] = useState<CustomField[]>(settings.customFields || [])+ const [localTemplate, setLocalTemplate] = useState<ApiTemplateName>(settings.apiTemplate || "custom")+ const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)+ const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)++ const [saving, setSaving] = useState(false)+ const [saveSuccess, setSaveSuccess] = useState(false)++ const referenceFieldMap = getReferenceFieldMap(localTemplate)/*** Check if field has been modified from the current template's defaults*/const isModified = (key: keyof FieldMap): boolean => {- return localFieldMap[key] !== referenceFieldMap[key];- };+ return localFieldMap[key] !== referenceFieldMap[key]+ }/*** Saves all API config and restarts tracking if active*/const saveAllSettings = useCallback(- async (- newFieldMap: FieldMap,- newCustomFields: CustomField[],- newTemplate: ApiTemplateName- ) => {+ async (newFieldMap: FieldMap, newCustomFields: CustomField[], newTemplate: ApiTemplateName) => {// Sanitize: trim all field valuesconst sanitizedMap = Object.fromEntries(Object.entries(newFieldMap).map(([key, value]) => [key, value.trim()])- ) as FieldMap;+ ) as FieldMap// Prevent saving if any field mapping is emptyif (Object.values(sanitizedMap).some((v) => v === "")) {- return;+ return}// Sanitize custom fields: trim and remove entries with empty keysconst sanitizedCustomFields = newCustomFields.map((f) => ({ key: f.key.trim(), value: f.value.trim() }))- .filter((f) => f.key.length > 0);+ .filter((f) => f.key.length > 0)try {- setSaving(true);- setSaveSuccess(false);+ setSaving(true)+ setSaveSuccess(false)const newSettings = {...settings,fieldMap: sanitizedMap,customFields: sanitizedCustomFields,- apiTemplate: newTemplate,- };+ apiTemplate: newTemplate+ }- await setSettings(newSettings);+ await setSettings(newSettings)// Debounce the restart — only fires once after settings stabilize- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)restartTimeoutRef.current = setTimeout(async () => {try {- await restartTracking(newSettings);- setSaveSuccess(true);- setTimeout(() => setSaveSuccess(false), 2000);+ await restartTracking(newSettings)+ setSaveSuccess(true)+ setTimeout(() => setSaveSuccess(false), 2000)} catch (err) {- console.error("[ApiSettingsScreen] Restart failed:", err);+ console.error("[ApiSettingsScreen] Restart failed:", err)} finally {- setSaving(false);+ setSaving(false)}- }, 1500);+ }, 1500)} catch (err) {- setSaving(false);- console.error("[ApiSettingsScreen] Failed to save settings:", err);+ setSaving(false)+ console.error("[ApiSettingsScreen] Failed to save settings:", err)}},[settings, setSettings, restartTracking]- );+ )/*** Debounced save (1.5s delay)*/const debouncedSave = useCallback(- (- newFieldMap: FieldMap,- newCustomFields: CustomField[],- newTemplate: ApiTemplateName- ) => {+ (newFieldMap: FieldMap, newCustomFields: CustomField[], newTemplate: ApiTemplateName) => {if (saveTimeoutRef.current) {- clearTimeout(saveTimeoutRef.current);+ clearTimeout(saveTimeoutRef.current)}- saveTimeoutRef.current = setTimeout(- () => saveAllSettings(newFieldMap, newCustomFields, newTemplate),- 1500- );+ saveTimeoutRef.current = setTimeout(() => saveAllSettings(newFieldMap, newCustomFields, newTemplate), 1500)},[saveAllSettings]- );+ )/*** Handles template selection*/const handleTemplateChange = useCallback((template: ApiTemplateName) => {- setLocalTemplate(template);+ setLocalTemplate(template)if (template === "custom") {// Keep current field map and custom fields, just save the template change- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveAllSettings(localFieldMap, localCustomFields, template);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveAllSettings(localFieldMap, localCustomFields, template)} else {- const tmpl = API_TEMPLATES[template];- setLocalFieldMap(tmpl.fieldMap);- setLocalCustomFields(tmpl.customFields);+ const tmpl = API_TEMPLATES[template]+ setLocalFieldMap(tmpl.fieldMap)+ setLocalCustomFields(tmpl.customFields)// Save immediately on template change- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveAllSettings(tmpl.fieldMap, tmpl.customFields, template);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveAllSettings(tmpl.fieldMap, tmpl.customFields, template)}},[localFieldMap, localCustomFields, saveAllSettings]- );+ )/*** Handles field value changes with auto-save.@@ -203,133 +167,120 @@ export function ApiSettingsScreen({}: ScreenProps) {*/const handleFieldChange = useCallback((key: keyof FieldMap, value: string) => {- const newFieldMap = { ...localFieldMap, [key]: value };- setLocalFieldMap(newFieldMap);+ const newFieldMap = { ...localFieldMap, [key]: value }+ setLocalFieldMap(newFieldMap)- const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate;- if (newTemplate !== localTemplate) setLocalTemplate(newTemplate);+ const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate+ if (newTemplate !== localTemplate) setLocalTemplate(newTemplate)- debouncedSave(newFieldMap, localCustomFields, newTemplate);+ debouncedSave(newFieldMap, localCustomFields, newTemplate)},[localFieldMap, localCustomFields, localTemplate, debouncedSave]- );+ )/*** Reset single field to current template default*/const handleResetField = useCallback((key: keyof FieldMap) => {- const newFieldMap = { ...localFieldMap, [key]: referenceFieldMap[key] };- setLocalFieldMap(newFieldMap);+ const newFieldMap = { ...localFieldMap, [key]: referenceFieldMap[key] }+ setLocalFieldMap(newFieldMap)- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveAllSettings(newFieldMap, localCustomFields, localTemplate);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveAllSettings(newFieldMap, localCustomFields, localTemplate)},- [- localFieldMap,- localCustomFields,- localTemplate,- referenceFieldMap,- saveAllSettings,- ]- );+ [localFieldMap, localCustomFields, localTemplate, referenceFieldMap, saveAllSettings]+ )/*** Resets all fields to current template defaults*/const handleResetAll = useCallback(() => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)- const refFields = getReferenceCustomFields(localTemplate);- setLocalFieldMap(referenceFieldMap);- setLocalCustomFields(refFields);- saveAllSettings(referenceFieldMap, refFields, localTemplate);- }, [referenceFieldMap, localTemplate, saveAllSettings]);+ const refFields = getReferenceCustomFields(localTemplate)+ setLocalFieldMap(referenceFieldMap)+ setLocalCustomFields(refFields)+ saveAllSettings(referenceFieldMap, refFields, localTemplate)+ }, [referenceFieldMap, localTemplate, saveAllSettings])// --- Custom Fields handlers ---const handleAddCustomField = useCallback(() => {- const newFields = [...localCustomFields, { key: "", value: "" }];- setLocalCustomFields(newFields);- }, [localCustomFields]);+ const newFields = [...localCustomFields, { key: "", value: "" }]+ setLocalCustomFields(newFields)+ }, [localCustomFields])const handleCustomFieldChange = useCallback((index: number, field: "key" | "value", text: string) => {- const newFields = [...localCustomFields];- newFields[index] = { ...newFields[index], [field]: text };- setLocalCustomFields(newFields);+ const newFields = [...localCustomFields]+ newFields[index] = { ...newFields[index], [field]: text }+ setLocalCustomFields(newFields)- const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate;- if (newTemplate !== localTemplate) setLocalTemplate(newTemplate);+ const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate+ if (newTemplate !== localTemplate) setLocalTemplate(newTemplate)- debouncedSave(localFieldMap, newFields, newTemplate);+ debouncedSave(localFieldMap, newFields, newTemplate)},[localCustomFields, localFieldMap, localTemplate, debouncedSave]- );+ )const handleRemoveCustomField = useCallback((index: number) => {- const newFields = localCustomFields.filter((_, i) => i !== index);- setLocalCustomFields(newFields);+ const newFields = localCustomFields.filter((_, i) => i !== index)+ setLocalCustomFields(newFields)- const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate;- if (newTemplate !== localTemplate) setLocalTemplate(newTemplate);+ const newTemplate = localTemplate !== "custom" ? "custom" : localTemplate+ if (newTemplate !== localTemplate) setLocalTemplate(newTemplate)- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveAllSettings(localFieldMap, newFields, newTemplate);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveAllSettings(localFieldMap, newFields, newTemplate)},[localCustomFields, localFieldMap, localTemplate, saveAllSettings]- );+ )// Cleanup timeouts on unmountuseEffect(() => {return () => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);- };- }, []);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)+ }+ }, [])// Check if any field mapping is modified from the reference- const hasModifications = (- Object.keys(DEFAULT_FIELD_MAP) as Array<keyof FieldMap>- ).some((key) => isModified(key));+ const hasModifications = (Object.keys(DEFAULT_FIELD_MAP) as Array<keyof FieldMap>).some((key) => isModified(key))// Build example payload string showing all fieldsconst examplePayload = (() => {- const entries: string[] = [];+ const entries: string[] = []// Custom static fields firstlocalCustomFields.forEach((f) => {if (f.key) {- entries.push(` "${f.key}": "${f.value}"`);+ entries.push(` "${f.key}": "${f.value}"`)}- });+ })// All mapped fields with realistic example values- entries.push(` "${localFieldMap.lat}": 52.12345`);- entries.push(` "${localFieldMap.lon}": -2.12345`);- entries.push(` "${localFieldMap.acc}": 15`);- if (localFieldMap.alt) entries.push(` "${localFieldMap.alt}": 380`);- if (localFieldMap.vel) entries.push(` "${localFieldMap.vel}": 5`);- if (localFieldMap.batt) entries.push(` "${localFieldMap.batt}": 85`);- if (localFieldMap.bs) entries.push(` "${localFieldMap.bs}": 2`);- if (localFieldMap.tst) entries.push(` "${localFieldMap.tst}": 1739362800`);- if (localFieldMap.bear) entries.push(` "${localFieldMap.bear}": 180.0`);-- return "{\n" + entries.join(",\n") + "\n}";- })();+ entries.push(` "${localFieldMap.lat}": 52.12345`)+ entries.push(` "${localFieldMap.lon}": -2.12345`)+ entries.push(` "${localFieldMap.acc}": 15`)+ if (localFieldMap.alt) entries.push(` "${localFieldMap.alt}": 380`)+ if (localFieldMap.vel) entries.push(` "${localFieldMap.vel}": 5`)+ if (localFieldMap.batt) entries.push(` "${localFieldMap.batt}": 85`)+ if (localFieldMap.bs) entries.push(` "${localFieldMap.bs}": 2`)+ if (localFieldMap.tst) entries.push(` "${localFieldMap.tst}": 1739362800`)+ if (localFieldMap.bear) entries.push(` "${localFieldMap.bear}": 180.0`)++ return "{\n" + entries.join(",\n") + "\n}"+ })()return (<Container>- <ScrollView- contentContainerStyle={styles.scrollContent}- keyboardShouldPersistTaps="handled"- >+ <ScrollView contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled">{/* Header */}<View style={styles.header}>- <Text style={[styles.title, { color: colors.text }]}>- API Field Mapping- </Text>+ <Text style={[styles.title, { color: colors.text }]}>API Field Mapping</Text><Text style={[styles.subtitle, { color: colors.textSecondary }]}>Customize field names sent to your server</Text>@@ -340,7 +291,7 @@ export function ApiSettingsScreen({}: ScreenProps) {<SectionTitle>BACKEND TEMPLATE</SectionTitle><View style={styles.chipRow}>{TEMPLATE_OPTIONS.map(({ value, label }) => {- const isSelected = localTemplate === value;+ const isSelected = localTemplate === valuereturn (<TouchableOpacitykey={value}@@ -348,12 +299,12 @@ export function ApiSettingsScreen({}: ScreenProps) {styles.chip,{borderColor: colors.border,- backgroundColor: colors.background,+ backgroundColor: colors.background},isSelected && {borderColor: colors.primary,- backgroundColor: colors.primary + "20",- },+ backgroundColor: colors.primary + "20"+ }]}onPress={() => handleTemplateChange(value)}activeOpacity={0.7}@@ -362,20 +313,18 @@ export function ApiSettingsScreen({}: ScreenProps) {style={[styles.chipText,{- color: isSelected ? colors.primary : colors.text,- },+ color: isSelected ? colors.primary : colors.text+ }]}>{label}</Text></TouchableOpacity>- );+ )})}</View>{localTemplate !== "custom" && (- <Text- style={[styles.templateHint, { color: colors.textSecondary }]}- >+ <Text style={[styles.templateHint, { color: colors.textSecondary }]}>{API_TEMPLATES[localTemplate].description}</Text>)}@@ -386,107 +335,66 @@ export function ApiSettingsScreen({}: ScreenProps) {<View style={styles.sectionHeader}><SectionTitle>FIELD MAPPINGS</SectionTitle>{hasModifications && (- <TouchableOpacity- onPress={handleResetAll}- style={styles.resetAllButton}- >- <Text style={[styles.resetAllText, { color: colors.primary }]}>- RESET ALL- </Text>+ <TouchableOpacity onPress={handleResetAll} style={styles.resetAllButton}>+ <Text style={[styles.resetAllText, { color: colors.primary }]}>RESET ALL</Text></TouchableOpacity>)}</View>- <View- style={[- styles.fieldsCard,- { backgroundColor: colors.card, borderColor: colors.border },- ]}- >- {(Object.keys(DEFAULT_FIELD_MAP) as Array<keyof FieldMap>).map(- (key, index) => (- <View key={key}>- {/* Two-column layout */}- <View style={styles.fieldRow}>- {/* Left: Key info */}- <View style={styles.keyColumn}>- <View style={styles.keyHeader}>- <Text- style={[styles.fieldLabel, { color: colors.text }]}- >- {key.toUpperCase()}- </Text>- {isModified(key) && (- <View- style={[- styles.modifiedBadge,- { backgroundColor: colors.primary },- ]}- >- <Text style={styles.modifiedText}>Modified</Text>- </View>- )}- </View>- <Text- style={[- styles.fieldDescription,- { color: colors.textSecondary },- ]}- numberOfLines={1}- >- {FIELD_DESCRIPTIONS[key]}- </Text>+ <View style={[styles.fieldsCard, { backgroundColor: colors.card, borderColor: colors.border }]}>+ {(Object.keys(DEFAULT_FIELD_MAP) as Array<keyof FieldMap>).map((key, index) => (+ <View key={key}>+ {/* Two-column layout */}+ <View style={styles.fieldRow}>+ {/* Left: Key info */}+ <View style={styles.keyColumn}>+ <View style={styles.keyHeader}>+ <Text style={[styles.fieldLabel, { color: colors.text }]}>{key.toUpperCase()}</Text>+ {isModified(key) && (+ <View style={[styles.modifiedBadge, { backgroundColor: colors.primary }]}>+ <Text style={styles.modifiedText}>Modified</Text>+ </View>+ )}</View>+ <Text style={[styles.fieldDescription, { color: colors.textSecondary }]} numberOfLines={1}>+ {FIELD_DESCRIPTIONS[key]}+ </Text>+ </View>- {/* Right: Value input */}- <View style={styles.valueColumn}>- <View style={styles.inputRow}>- <TextInput- style={[- styles.fieldInput,- {- borderColor: isModified(key)- ? colors.primary- : colors.border,- color: colors.text,- backgroundColor: colors.background,- },- ]}- value={localFieldMap[key]}- onChangeText={(text) => handleFieldChange(key, text)}- placeholder={referenceFieldMap[key]}- placeholderTextColor={colors.placeholder}- autoCapitalize="none"- autoCorrect={false}- />- {isModified(key) && (- <TouchableOpacity- onPress={() => handleResetField(key)}- style={[- styles.resetButton,- { backgroundColor: colors.border },- ]}- >- <Text- style={[- styles.resetIcon,- { color: colors.textSecondary },- ]}- >- ↺- </Text>- </TouchableOpacity>- )}- </View>+ {/* Right: Value input */}+ <View style={styles.valueColumn}>+ <View style={styles.inputRow}>+ <TextInput+ style={[+ styles.fieldInput,+ {+ borderColor: isModified(key) ? colors.primary : colors.border,+ color: colors.text,+ backgroundColor: colors.background+ }+ ]}+ value={localFieldMap[key]}+ onChangeText={(text) => handleFieldChange(key, text)}+ placeholder={referenceFieldMap[key]}+ placeholderTextColor={colors.placeholder}+ autoCapitalize="none"+ autoCorrect={false}+ />+ {isModified(key) && (+ <TouchableOpacity+ onPress={() => handleResetField(key)}+ style={[styles.resetButton, { backgroundColor: colors.border }]}+ >+ <Text style={[styles.resetIcon, { color: colors.textSecondary }]}>↺</Text>+ </TouchableOpacity>+ )}</View></View>-- {index < Object.keys(DEFAULT_FIELD_MAP).length - 1 && (- <Divider />- )}</View>- )- )}++ {index < Object.keys(DEFAULT_FIELD_MAP).length - 1 && <Divider />}+ </View>+ ))}</View></View>@@ -496,16 +404,10 @@ export function ApiSettingsScreen({}: ScreenProps) {<SectionTitle>CUSTOM FIELDS</SectionTitle></View>- <View- style={[- styles.fieldsCard,- { backgroundColor: colors.card, borderColor: colors.border },- ]}- >+ <View style={[styles.fieldsCard, { backgroundColor: colors.card, borderColor: colors.border }]}>{localCustomFields.length === 0 ? (<Text style={[styles.emptyHint, { color: colors.textSecondary }]}>- No custom fields. Add static key-value pairs to include in every- payload.+ No custom fields. Add static key-value pairs to include in every payload.</Text>) : (localCustomFields.map((field, index) => (@@ -517,13 +419,11 @@ export function ApiSettingsScreen({}: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={field.key}- onChangeText={(text) =>- handleCustomFieldChange(index, "key", text)- }+ onChangeText={(text) => handleCustomFieldChange(index, "key", text)}placeholder="Key"placeholderTextColor={colors.placeholder}autoCapitalize="none"@@ -535,13 +435,11 @@ export function ApiSettingsScreen({}: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={field.value}- onChangeText={(text) =>- handleCustomFieldChange(index, "value", text)- }+ onChangeText={(text) => handleCustomFieldChange(index, "value", text)}placeholder="Value"placeholderTextColor={colors.placeholder}autoCapitalize="none"@@ -549,19 +447,9 @@ export function ApiSettingsScreen({}: ScreenProps) {/><TouchableOpacityonPress={() => handleRemoveCustomField(index)}- style={[- styles.removeButton,- { backgroundColor: colors.error + "15" },- ]}+ style={[styles.removeButton, { backgroundColor: colors.error + "15" }]}>- <Text- style={[- styles.removeButtonText,- { color: colors.error },- ]}- >- X- </Text>+ <Text style={[styles.removeButtonText, { color: colors.error }]}>X</Text></TouchableOpacity></View>{index < localCustomFields.length - 1 && <Divider />}@@ -569,13 +457,8 @@ export function ApiSettingsScreen({}: ScreenProps) {)))}- <TouchableOpacity- onPress={handleAddCustomField}- style={[styles.addButton, { borderColor: colors.border }]}- >- <Text style={[styles.addButtonText, { color: colors.primary }]}>- + Add Field- </Text>+ <TouchableOpacity onPress={handleAddCustomField} style={[styles.addButton, { borderColor: colors.border }]}>+ <Text style={[styles.addButtonText, { color: colors.primary }]}>+ Add Field</Text></TouchableOpacity></View></View>@@ -588,13 +471,11 @@ export function ApiSettingsScreen({}: ScreenProps) {styles.exampleCard,{backgroundColor: colors.backgroundElevated,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}>- <Text style={[styles.exampleCode, { color: colors.textSecondary }]}>- {examplePayload}- </Text>+ <Text style={[styles.exampleCode, { color: colors.textSecondary }]}>{examplePayload}</Text></View></View>@@ -607,121 +488,117 @@ export function ApiSettingsScreen({}: ScreenProps) {</ScrollView>{/* Floating Save Indicator */}- <FloatingSaveIndicator- saving={saving}- success={saveSuccess}- colors={colors}- />+ <FloatingSaveIndicator saving={saving} success={saveSuccess} colors={colors} /></Container>- );+ )}const styles = StyleSheet.create({scrollContent: {paddingHorizontal: 16,- paddingBottom: 40,+ paddingBottom: 40},header: {marginTop: 20,- marginBottom: 20,+ marginBottom: 20},title: {fontSize: 28,fontWeight: "700",letterSpacing: -0.5,- marginBottom: 4,+ marginBottom: 4},subtitle: {fontSize: 14,- lineHeight: 20,+ lineHeight: 20},section: {- marginBottom: 24,+ marginBottom: 24},chipRow: {flexDirection: "row",- gap: 8,+ gap: 8},chip: {flex: 1,borderWidth: 2,borderRadius: 10,paddingVertical: 10,- alignItems: "center",+ alignItems: "center"},chipText: {fontSize: 12,- fontWeight: "700",+ fontWeight: "700"},templateHint: {fontSize: 12,- marginTop: 8,+ marginTop: 8},fieldsSection: {- marginBottom: 20,+ marginBottom: 20},sectionHeader: {flexDirection: "row",justifyContent: "space-between",- alignItems: "center",+ alignItems: "center"},resetAllButton: {paddingVertical: 4,- paddingHorizontal: 8,+ paddingHorizontal: 8},resetAllText: {fontSize: 11,fontWeight: "700",- letterSpacing: 0.5,+ letterSpacing: 0.5},fieldsCard: {padding: 12,borderRadius: 10,- borderWidth: 1,+ borderWidth: 1},fieldRow: {flexDirection: "row",paddingVertical: 10,- gap: 12,+ gap: 12},keyColumn: {flex: 1,- justifyContent: "center",+ justifyContent: "center"},keyHeader: {flexDirection: "row",alignItems: "center",gap: 6,- marginBottom: 2,+ marginBottom: 2},fieldLabel: {fontSize: 13,fontWeight: "700",- letterSpacing: 0.5,+ letterSpacing: 0.5},modifiedBadge: {paddingHorizontal: 6,paddingVertical: 2,- borderRadius: 4,+ borderRadius: 4},modifiedText: {fontSize: 9,fontWeight: "700",color: "#FFFFFF",- letterSpacing: 0.3,+ letterSpacing: 0.3},fieldDescription: {fontSize: 11,- lineHeight: 15,+ lineHeight: 15},valueColumn: {flex: 1,- justifyContent: "center",+ justifyContent: "center"},inputRow: {flexDirection: "row",alignItems: "center",- gap: 6,+ gap: 6},fieldInput: {flex: 1,@@ -730,24 +607,24 @@ const styles = StyleSheet.create({paddingVertical: 8,borderRadius: 8,fontSize: 14,- fontFamily: "monospace",+ fontFamily: "monospace"},resetButton: {width: 32,height: 32,borderRadius: 16,justifyContent: "center",- alignItems: "center",+ alignItems: "center"},resetIcon: {fontSize: 18,- fontWeight: "600",+ fontWeight: "600"},customFieldRow: {flexDirection: "row",alignItems: "center",gap: 8,- paddingVertical: 8,+ paddingVertical: 8},customFieldInput: {flex: 1,@@ -756,18 +633,18 @@ const styles = StyleSheet.create({paddingVertical: 8,borderRadius: 8,fontSize: 14,- fontFamily: "monospace",+ fontFamily: "monospace"},removeButton: {width: 32,height: 32,borderRadius: 16,justifyContent: "center",- alignItems: "center",+ alignItems: "center"},removeButtonText: {fontSize: 13,- fontWeight: "700",+ fontWeight: "700"},addButton: {paddingVertical: 12,@@ -775,36 +652,36 @@ const styles = StyleSheet.create({borderRadius: 10,borderWidth: 1.5,borderStyle: "dashed",- marginTop: 8,+ marginTop: 8},addButtonText: {fontSize: 14,- fontWeight: "600",+ fontWeight: "600"},emptyHint: {fontSize: 13,textAlign: "center",- paddingVertical: 8,+ paddingVertical: 8},exampleSection: {- marginBottom: 20,+ marginBottom: 20},exampleCard: {padding: 14,borderRadius: 8,- borderWidth: 1,+ borderWidth: 1},exampleCode: {fontSize: 12,fontFamily: "monospace",- lineHeight: 18,+ lineHeight: 18},footer: {paddingVertical: 16,- alignItems: "center",+ alignItems: "center"},footerText: {fontSize: 11,- textAlign: "center",- },-});+ textAlign: "center"+ }+})diff --git a/src/screens/AuthSettingsScreen.tsx b/src/screens/AuthSettingsScreen.tsxindex cbb99e47..836d5680 100644--- a/src/screens/AuthSettingsScreen.tsx+++ b/src/screens/AuthSettingsScreen.tsx@@ -3,185 +3,162 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useCallback, useEffect, useRef } from "react";-import {- Text,- StyleSheet,- TextInput,- View,- ScrollView,- TouchableOpacity,-} from "react-native";-import {- AuthConfig,- AuthType,- DEFAULT_AUTH_CONFIG,- ScreenProps,-} from "../types/global";-import { useTheme } from "../hooks/useTheme";-import { useTracking } from "../contexts/TrackingProvider";-import {- SectionTitle,- FloatingSaveIndicator,- Container,- Card,- Divider,-} from "../components";-import NativeLocationService from "../services/NativeLocationService";+import React, { useState, useCallback, useEffect, useRef } from "react"+import { Text, StyleSheet, TextInput, View, ScrollView, TouchableOpacity } from "react-native"+import { AuthConfig, AuthType, DEFAULT_AUTH_CONFIG, ScreenProps } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import { useTracking } from "../contexts/TrackingProvider"+import { SectionTitle, FloatingSaveIndicator, Container, Card, Divider } from "../components"+import NativeLocationService from "../services/NativeLocationService"-const AUTOSAVE_DEBOUNCE_MS = 1500;+const AUTOSAVE_DEBOUNCE_MS = 1500const AUTH_TYPES: { value: AuthType; label: string }[] = [{ value: "none", label: "None" },{ value: "basic", label: "Basic Auth" },- { value: "bearer", label: "Bearer Token" },-];+ { value: "bearer", label: "Bearer Token" }+]/*** Screen for configuring endpoint authentication and custom headers.*/export function AuthSettingsScreen({}: ScreenProps) {- const { colors } = useTheme();- const { restartTracking, settings } = useTracking();+ const { colors } = useTheme()+ const { restartTracking, settings } = useTracking()- const [config, setConfig] = useState<AuthConfig>(DEFAULT_AUTH_CONFIG);- const [loading, setLoading] = useState(true);- const [saving, setSaving] = useState(false);- const [saveSuccess, setSaveSuccess] = useState(false);- const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const [config, setConfig] = useState<AuthConfig>(DEFAULT_AUTH_CONFIG)+ const [loading, setLoading] = useState(true)+ const [saving, setSaving] = useState(false)+ const [saveSuccess, setSaveSuccess] = useState(false)+ const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)+ const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)// Load config on mountuseEffect(() => {- (async () => {+ ;(async () => {try {- const saved = await NativeLocationService.getAuthConfig();- setConfig(saved);+ const saved = await NativeLocationService.getAuthConfig()+ setConfig(saved)} catch (err) {- console.error("[AuthSettingsScreen] Failed to load auth config:", err);+ console.error("[AuthSettingsScreen] Failed to load auth config:", err)} finally {- setLoading(false);+ setLoading(false)}- })();- }, []);+ })()+ }, [])// CleanupuseEffect(() => {return () => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);- };- }, []);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)+ }+ }, [])const saveConfig = useCallback(async (newConfig: AuthConfig) => {- setSaving(true);+ setSaving(true)try {- await NativeLocationService.saveAuthConfig(newConfig);+ await NativeLocationService.saveAuthConfig(newConfig)// Debounce the restart — only fires once after settings stabilize- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)restartTimeoutRef.current = setTimeout(async () => {try {- await restartTracking(settings);- setSaveSuccess(true);- setTimeout(() => setSaveSuccess(false), 2000);+ await restartTracking(settings)+ setSaveSuccess(true)+ setTimeout(() => setSaveSuccess(false), 2000)} catch (err) {- console.error("[AuthSettingsScreen] Restart failed:", err);+ console.error("[AuthSettingsScreen] Restart failed:", err)} finally {- setSaving(false);+ setSaving(false)}- }, AUTOSAVE_DEBOUNCE_MS);+ }, AUTOSAVE_DEBOUNCE_MS)} catch (err) {- setSaving(false);- console.error("[AuthSettingsScreen] Save failed:", err);+ setSaving(false)+ console.error("[AuthSettingsScreen] Save failed:", err)}},[restartTracking, settings]- );+ )const debouncedSave = useCallback((newConfig: AuthConfig) => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveTimeoutRef.current = setTimeout(- () => saveConfig(newConfig),- AUTOSAVE_DEBOUNCE_MS- );+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveTimeoutRef.current = setTimeout(() => saveConfig(newConfig), AUTOSAVE_DEBOUNCE_MS)},[saveConfig]- );+ )const updateConfig = useCallback((partial: Partial<AuthConfig>) => {- const next = { ...config, ...partial };- setConfig(next);- debouncedSave(next);+ const next = { ...config, ...partial }+ setConfig(next)+ debouncedSave(next)},[config, debouncedSave]- );+ )const handleAuthTypeChange = useCallback((authType: AuthType) => {- const next = { ...config, authType };- setConfig(next);+ const next = { ...config, authType }+ setConfig(next)// Immediate save for auth type change- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveConfig(next);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveConfig(next)},[config, saveConfig]- );+ )// Custom headers as array for rendering- const headerEntries = Object.entries(config.customHeaders);+ const headerEntries = Object.entries(config.customHeaders)const addHeader = useCallback(() => {updateConfig({- customHeaders: { ...config.customHeaders, "": "" },- });- }, [config, updateConfig]);+ customHeaders: { ...config.customHeaders, "": "" }+ })+ }, [config, updateConfig])const updateHeaderKey = useCallback((oldKey: string, newKey: string, index: number) => {- const entries = Object.entries(config.customHeaders);- entries[index] = [newKey, entries[index][1]];- const newHeaders = Object.fromEntries(entries);- updateConfig({ customHeaders: newHeaders });+ const entries = Object.entries(config.customHeaders)+ entries[index] = [newKey, entries[index][1]]+ const newHeaders = Object.fromEntries(entries)+ updateConfig({ customHeaders: newHeaders })},[config, updateConfig]- );+ )const updateHeaderValue = useCallback((key: string, value: string, index: number) => {- const entries = Object.entries(config.customHeaders);- entries[index] = [entries[index][0], value];- const newHeaders = Object.fromEntries(entries);- updateConfig({ customHeaders: newHeaders });+ const entries = Object.entries(config.customHeaders)+ entries[index] = [entries[index][0], value]+ const newHeaders = Object.fromEntries(entries)+ updateConfig({ customHeaders: newHeaders })},[config, updateConfig]- );+ )const removeHeader = useCallback((index: number) => {- const entries = Object.entries(config.customHeaders);- entries.splice(index, 1);- const next = { ...config, customHeaders: Object.fromEntries(entries) };- setConfig(next);- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveConfig(next);+ const entries = Object.entries(config.customHeaders)+ entries.splice(index, 1)+ const next = { ...config, customHeaders: Object.fromEntries(entries) }+ setConfig(next)+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveConfig(next)},[config, saveConfig]- );+ )if (loading) {return (<Container><View style={styles.loadingContainer}>- <Text style={[styles.loadingText, { color: colors.textSecondary }]}>- Loading...- </Text>+ <Text style={[styles.loadingText, { color: colors.textSecondary }]}>Loading...</Text></View></Container>- );+ )}return (@@ -193,12 +170,8 @@ export function AuthSettingsScreen({}: ScreenProps) {>{/* Header */}<View style={styles.header}>- <Text style={[styles.title, { color: colors.text }]}>- Authentication & Headers- </Text>- <Text style={[styles.subtitle, { color: colors.textSecondary }]}>- Secure your endpoint connection- </Text>+ <Text style={[styles.title, { color: colors.text }]}>Authentication & Headers</Text>+ <Text style={[styles.subtitle, { color: colors.textSecondary }]}>Secure your endpoint connection</Text></View>{/* Authentication Section */}@@ -208,7 +181,7 @@ export function AuthSettingsScreen({}: ScreenProps) {{/* Auth type picker */}<View style={styles.chipRow}>{AUTH_TYPES.map(({ value, label }) => {- const isSelected = config.authType === value;+ const isSelected = config.authType === valuereturn (<TouchableOpacitykey={value}@@ -216,12 +189,12 @@ export function AuthSettingsScreen({}: ScreenProps) {styles.chip,{borderColor: colors.border,- backgroundColor: colors.background,+ backgroundColor: colors.background},isSelected && {borderColor: colors.primary,- backgroundColor: colors.primary + "20",- },+ backgroundColor: colors.primary + "20"+ }]}onPress={() => handleAuthTypeChange(value)}activeOpacity={0.7}@@ -230,14 +203,14 @@ export function AuthSettingsScreen({}: ScreenProps) {style={[styles.chipText,{- color: isSelected ? colors.primary : colors.text,- },+ color: isSelected ? colors.primary : colors.text+ }]}>{label}</Text></TouchableOpacity>- );+ )})}</View>@@ -246,17 +219,15 @@ export function AuthSettingsScreen({}: ScreenProps) {<><Divider /><View style={styles.fieldGroup}>- <Text style={[styles.fieldLabel, { color: colors.text }]}>- Username- </Text>+ <Text style={[styles.fieldLabel, { color: colors.text }]}>Username</Text><TextInputstyle={[styles.input,{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={config.username}onChangeText={(v) => updateConfig({ username: v })}@@ -266,23 +237,15 @@ export function AuthSettingsScreen({}: ScreenProps) {autoCorrect={false}/>- <Text- style={[- styles.fieldLabel,- styles.fieldLabelSpaced,- { color: colors.text },- ]}- >- Password- </Text>+ <Text style={[styles.fieldLabel, styles.fieldLabelSpaced, { color: colors.text }]}>Password</Text><TextInputstyle={[styles.input,{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={config.password}onChangeText={(v) => updateConfig({ password: v })}@@ -301,17 +264,15 @@ export function AuthSettingsScreen({}: ScreenProps) {<><Divider /><View style={styles.fieldGroup}>- <Text style={[styles.fieldLabel, { color: colors.text }]}>- Token- </Text>+ <Text style={[styles.fieldLabel, { color: colors.text }]}>Token</Text><TextInputstyle={[styles.input,{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={config.bearerToken}onChangeText={(v) => updateConfig({ bearerToken: v })}@@ -332,9 +293,7 @@ export function AuthSettingsScreen({}: ScreenProps) {<SectionTitle>Custom Headers</SectionTitle><Card>{headerEntries.length === 0 ? (- <Text style={[styles.emptyHint, { color: colors.textSecondary }]}>- No custom headers configured- </Text>+ <Text style={[styles.emptyHint, { color: colors.textSecondary }]}>No custom headers configured</Text>) : (headerEntries.map(([key, value], index) => (<View key={index}>@@ -347,8 +306,8 @@ export function AuthSettingsScreen({}: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={key}onChangeText={(v) => updateHeaderKey(key, v, index)}@@ -363,8 +322,8 @@ export function AuthSettingsScreen({}: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={value}onChangeText={(v) => updateHeaderValue(key, v, index)}@@ -376,20 +335,10 @@ export function AuthSettingsScreen({}: ScreenProps) {</View><TouchableOpacityonPress={() => removeHeader(index)}- style={[- styles.removeButton,- { backgroundColor: colors.error + "15" },- ]}+ style={[styles.removeButton, { backgroundColor: colors.error + "15" }]}activeOpacity={0.7}>- <Text- style={[- styles.removeButtonText,- { color: colors.error },- ]}- >- X- </Text>+ <Text style={[styles.removeButtonText, { color: colors.error }]}>X</Text></TouchableOpacity></View></View>@@ -403,9 +352,7 @@ export function AuthSettingsScreen({}: ScreenProps) {onPress={addHeader}activeOpacity={0.7}>- <Text style={[styles.addButtonText, { color: colors.primary }]}>- + Add Header- </Text>+ <Text style={[styles.addButtonText, { color: colors.primary }]}>+ Add Header</Text></TouchableOpacity><Text style={[styles.hint, { color: colors.textSecondary }]}>@@ -422,108 +369,104 @@ export function AuthSettingsScreen({}: ScreenProps) {</View></ScrollView>- <FloatingSaveIndicator- saving={saving}- success={saveSuccess}- colors={colors}- />+ <FloatingSaveIndicator saving={saving} success={saveSuccess} colors={colors} /></Container>- );+ )}const styles = StyleSheet.create({scrollContent: {paddingHorizontal: 20,paddingTop: 16,- paddingBottom: 40,+ paddingBottom: 40},loadingContainer: {flex: 1,justifyContent: "center",- alignItems: "center",+ alignItems: "center"},loadingText: {- fontSize: 15,+ fontSize: 15},header: {- marginBottom: 20,+ marginBottom: 20},title: {fontSize: 28,fontWeight: "700",letterSpacing: -0.5,- marginBottom: 4,+ marginBottom: 4},subtitle: {fontSize: 14,- lineHeight: 20,+ lineHeight: 20},section: {- marginBottom: 24,+ marginBottom: 24},chipRow: {flexDirection: "row",- gap: 10,+ gap: 10},chip: {flex: 1,borderWidth: 2,borderRadius: 10,paddingVertical: 12,- alignItems: "center",+ alignItems: "center"},chipText: {fontSize: 13,- fontWeight: "700",+ fontWeight: "700"},fieldGroup: {- marginTop: 4,+ marginTop: 4},fieldLabel: {fontSize: 15,fontWeight: "600",- marginBottom: 8,+ marginBottom: 8},fieldLabelSpaced: {- marginTop: 14,+ marginTop: 14},input: {borderWidth: 1.5,padding: 14,borderRadius: 12,- fontSize: 15,+ fontSize: 15},emptyHint: {fontSize: 14,textAlign: "center",- paddingVertical: 8,+ paddingVertical: 8},headerRow: {flexDirection: "row",alignItems: "center",gap: 8,- paddingVertical: 8,+ paddingVertical: 8},headerInputs: {flex: 1,- gap: 8,+ gap: 8},headerInput: {borderWidth: 1.5,padding: 12,borderRadius: 10,- fontSize: 14,+ fontSize: 14},removeButton: {width: 36,height: 36,borderRadius: 18,justifyContent: "center",- alignItems: "center",+ alignItems: "center"},removeButtonText: {fontSize: 14,- fontWeight: "700",+ fontWeight: "700"},addButton: {paddingVertical: 14,@@ -531,23 +474,23 @@ const styles = StyleSheet.create({borderRadius: 12,borderWidth: 1.5,borderStyle: "dashed",- marginTop: 4,+ marginTop: 4},addButtonText: {fontSize: 15,- fontWeight: "600",+ fontWeight: "600"},hint: {fontSize: 12,marginTop: 10,- textAlign: "center",+ textAlign: "center"},footer: {paddingVertical: 16,- alignItems: "center",+ alignItems: "center"},footerText: {fontSize: 11,- textAlign: "center",- },-});+ textAlign: "center"+ }+})diff --git a/src/screens/DashboardScreen.tsx b/src/screens/DashboardScreen.tsxindex f9d84dae..3ed77d7c 100644--- a/src/screens/DashboardScreen.tsx+++ b/src/screens/DashboardScreen.tsx@@ -3,19 +3,13 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useEffect, useState, useCallback, useRef } from "react";-import {- StyleSheet,- View,- ScrollView,- DeviceEventEmitter,- Animated,-} from "react-native";-import { ScreenProps, DatabaseStats } from "../types/global";-import { useTheme } from "../hooks/useTheme";-import NativeLocationService from "../services/NativeLocationService";-import { useTracking } from "../contexts/TrackingProvider";-import { useFocusEffect } from "@react-navigation/native";+import React, { useEffect, useState, useCallback, useRef } from "react"+import { StyleSheet, View, ScrollView, DeviceEventEmitter, Animated } from "react-native"+import { ScreenProps, DatabaseStats } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import NativeLocationService from "../services/NativeLocationService"+import { useTracking } from "../contexts/TrackingProvider"+import { useFocusEffect } from "@react-navigation/native"import {Button,ServerConnection,@@ -23,138 +17,130 @@ import {CoordinateDisplay,Container,QuickAccess,- DatabaseStatistics,-} from "../components";+ DatabaseStatistics+} from "../components"/** Stats refresh intervals */-const STATS_REFRESH_IDLE = 30 * 1000;+const STATS_REFRESH_IDLE = 30 * 1000export function DashboardScreen({ navigation }: ScreenProps) {- const { coords, settings, tracking, startTracking, stopTracking } =- useTracking();- const { colors } = useTheme();+ const { coords, settings, tracking, startTracking, stopTracking } = useTracking()+ const { colors } = useTheme()const [stats, setStats] = useState<DatabaseStats>({queued: 0,sent: 0,total: 0,today: 0,- databaseSizeMB: 0,- });+ databaseSizeMB: 0+ })- const prevStats = useRef(stats);- const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(- null- );- const [scrollEnabled, setScrollEnabled] = useState(true);+ const prevStats = useRef(stats)+ const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(null)+ const [scrollEnabled, setScrollEnabled] = useState(true)// Animation for button- const buttonScale = useRef(new Animated.Value(1)).current;+ const buttonScale = useRef(new Animated.Value(1)).current- const isInSilentZone = !!currentSilentZone;+ const isInSilentZone = !!currentSilentZoneconst handleStart = async () => {// Bounce animationAnimated.sequence([Animated.spring(buttonScale, {toValue: 0.92,- useNativeDriver: true,+ useNativeDriver: true}),Animated.spring(buttonScale, {toValue: 1,useNativeDriver: true,- friction: 3,- }),- ]).start();+ friction: 3+ })+ ]).start()- await startTracking();- setTimeout(updateStats, 500);- };+ await startTracking()+ setTimeout(updateStats, 500)+ }const handleStop = async () => {Animated.sequence([Animated.spring(buttonScale, {toValue: 0.92,- useNativeDriver: true,+ useNativeDriver: true}),Animated.spring(buttonScale, {toValue: 1,useNativeDriver: true,- friction: 3,- }),- ]).start();+ friction: 3+ })+ ]).start()- await stopTracking();- updateStats();- };+ await stopTracking()+ updateStats()+ }const updateStats = useCallback(async () => {try {- const nativeStats = await NativeLocationService.getStats();+ const nativeStats = await NativeLocationService.getStats()const hasChanged =nativeStats.queued !== prevStats.current.queued ||nativeStats.sent !== prevStats.current.sent ||- nativeStats.today !== prevStats.current.today;+ nativeStats.today !== prevStats.current.todayif (hasChanged) {- setStats(nativeStats);- prevStats.current = nativeStats;+ setStats(nativeStats)+ prevStats.current = nativeStats}} catch (err) {- console.error("[Dashboard] Failed to update stats:", err);+ console.error("[Dashboard] Failed to update stats:", err)}- }, []);+ }, [])const updateSilentZone = useCallback(async () => {try {- const zoneName = await NativeLocationService.checkCurrentSilentZone();- setCurrentSilentZone(zoneName);+ const zoneName = await NativeLocationService.checkCurrentSilentZone()+ setCurrentSilentZone(zoneName)} catch (err) {- console.error("[Dashboard] Failed to update silent zone:", err);- setCurrentSilentZone(null);+ console.error("[Dashboard] Failed to update silent zone:", err)+ setCurrentSilentZone(null)}- }, []);+ }, [])useFocusEffect(useCallback(() => {- updateStats();- updateSilentZone();+ updateStats()+ updateSilentZone()- const interval = tracking- ? Math.max(settings.interval * 1000, 2000)- : STATS_REFRESH_IDLE;+ const interval = tracking ? Math.max(settings.interval * 1000, 2000) : STATS_REFRESH_IDLE- const statsTimer = setInterval(updateStats, interval);+ const statsTimer = setInterval(updateStats, interval)return () => {- clearInterval(statsTimer);- };+ clearInterval(statsTimer)+ }}, [tracking, updateStats, updateSilentZone, settings.interval])- );+ )useEffect(() => {- const listener = DeviceEventEmitter.addListener(- "geofenceUpdated",- updateSilentZone- );- return () => listener.remove();- }, [updateSilentZone]);+ const listener = DeviceEventEmitter.addListener("geofenceUpdated", updateSilentZone)+ return () => listener.remove()+ }, [updateSilentZone])useEffect(() => {const silentZoneListener = DeviceEventEmitter.addListener("onSilentZoneChange",(data: { entered: boolean; zoneName: string | null }) => {if (data.entered) {- setCurrentSilentZone(data.zoneName);+ setCurrentSilentZone(data.zoneName)} else {- setCurrentSilentZone(null);+ setCurrentSilentZone(null)}}- );+ )- return () => silentZoneListener.remove();- }, []);+ return () => silentZoneListener.remove()+ }, [])return (<Container>@@ -181,10 +167,7 @@ export function DashboardScreen({ navigation }: ScreenProps) {{/* Tracking Control Button */}<Animated.View- style={[- styles.controlButtonContainer,- { transform: [{ scale: buttonScale }] },- ]}+ style={[styles.controlButtonContainer, { transform: [{ scale: buttonScale }] }]}pointerEvents="box-none"><Button@@ -192,8 +175,8 @@ export function DashboardScreen({ navigation }: ScreenProps) {styles.controlButton,{backgroundColor: tracking ? colors.error : colors.primary,- shadowColor: tracking ? colors.error : colors.primary,- },+ shadowColor: tracking ? colors.error : colors.primary+ }]}color="#f8f7f7"onPress={tracking ? handleStop : handleStart}@@ -216,40 +199,37 @@ export function DashboardScreen({ navigation }: ScreenProps) {<DatabaseStatistics stats={stats} />{/* Server Connection */}- <ServerConnection- endpoint={settings.endpoint}- navigation={navigation}- />+ <ServerConnection endpoint={settings.endpoint} navigation={navigation} />{/* Quick Access */}<QuickAccess navigation={navigation} /></View></ScrollView></Container>- );+ )}const styles = StyleSheet.create({scrollContent: {- flexGrow: 1,+ flexGrow: 1},mapSection: {height: 480,- position: "relative",+ position: "relative"},mapWrapper: {position: "absolute",top: 0,left: 0,right: 0,- bottom: 0,+ bottom: 0},controlButtonContainer: {position: "absolute",bottom: 24,left: 0,right: 0,- alignItems: "center",+ alignItems: "center"},controlButton: {flexDirection: "row",@@ -262,15 +242,15 @@ const styles = StyleSheet.create({shadowOpacity: 0.4,shadowRadius: 12,elevation: 12,- minWidth: 200,+ minWidth: 200},content: {flex: 1,paddingTop: 20,paddingHorizontal: 16,- paddingBottom: 24,+ paddingBottom: 24},metricsSection: {- marginBottom: 20,- },-});+ marginBottom: 20+ }+})diff --git a/src/screens/DataManagementScreen.tsx b/src/screens/DataManagementScreen.tsxindex 43af517d..a408e96b 100644--- a/src/screens/DataManagementScreen.tsx+++ b/src/screens/DataManagementScreen.tsx@@ -3,7 +3,7 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useCallback, useEffect, useRef } from "react";+import React, { useState, useCallback, useEffect, useRef } from "react"import {Text,StyleSheet,@@ -12,176 +12,159 @@ import {TouchableOpacity,TextInput,KeyboardAvoidingView,- Platform,-} from "react-native";-import { useFocusEffect } from "@react-navigation/native";-import { ScreenProps, DatabaseStats } from "../types/global";-import { useTheme } from "../hooks/useTheme";-import NativeLocationService from "../services/NativeLocationService";-import {- Button,- SectionTitle,- Card,- Container,- Divider,- FloatingSaveIndicator,-} from "../components";+ Platform+} from "react-native"+import { useFocusEffect } from "@react-navigation/native"+import { ScreenProps, DatabaseStats } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import NativeLocationService from "../services/NativeLocationService"+import { Button, SectionTitle, Card, Container, Divider, FloatingSaveIndicator } from "../components"export function DataManagementScreen({}: ScreenProps) {- const { colors } = useTheme();+ const { colors } = useTheme()const [stats, setStats] = useState<DatabaseStats>({queued: 0,sent: 0,total: 0,today: 0,- databaseSizeMB: 0,- });+ databaseSizeMB: 0+ })- const [daysInput, setDaysInput] = useState("90");- const [isProcessing, setIsProcessing] = useState(false);- const [feedback, setFeedback] = useState<string | null>(null);- const feedbackTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const [daysInput, setDaysInput] = useState("90")+ const [isProcessing, setIsProcessing] = useState(false)+ const [feedback, setFeedback] = useState<string | null>(null)+ const feedbackTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)// Update statsconst updateStats = useCallback(async () => {try {- const nativeStats = await NativeLocationService.getStats();- setStats(nativeStats);+ const nativeStats = await NativeLocationService.getStats()+ setStats(nativeStats)} catch (err) {- console.error("[DataManagementScreen] Failed to update stats:", err);+ console.error("[DataManagementScreen] Failed to update stats:", err)}- }, []);+ }, [])// Auto-refresh stats when screen is focuseduseFocusEffect(useCallback(() => {- updateStats();- const interval = setInterval(updateStats, 3000);- return () => clearInterval(interval);+ updateStats()+ const interval = setInterval(updateStats, 3000)+ return () => clearInterval(interval)}, [updateStats])- );+ )// Cleanup timeout on unmountuseEffect(() => {return () => {if (feedbackTimeoutRef.current) {- clearTimeout(feedbackTimeoutRef.current);+ clearTimeout(feedbackTimeoutRef.current)}- };- }, []);+ }+ }, [])// Show feedback messageconst showFeedback = useCallback((message: string, duration = 2000) => {if (feedbackTimeoutRef.current) {- clearTimeout(feedbackTimeoutRef.current);+ clearTimeout(feedbackTimeoutRef.current)}- setFeedback(message);- feedbackTimeoutRef.current = setTimeout(() => setFeedback(null), duration);- }, []);+ setFeedback(message)+ feedbackTimeoutRef.current = setTimeout(() => setFeedback(null), duration)+ }, [])// Manual flushconst handleManualFlush = useCallback(async () => {- if (isProcessing || stats.queued === 0) return;+ if (isProcessing || stats.queued === 0) returntry {- setIsProcessing(true);- showFeedback("⏳ Syncing locations...", 30000); // Long timeout+ setIsProcessing(true)+ showFeedback("⏳ Syncing locations...", 30000) // Long timeout- await NativeLocationService.manualFlush();+ await NativeLocationService.manualFlush()// Wait a bit for the sync to start, then update statssetTimeout(async () => {- await updateStats();- setIsProcessing(false);- showFeedback("✅ Sync initiated successfully!");- }, 2000);+ await updateStats()+ setIsProcessing(false)+ showFeedback("✅ Sync initiated successfully!")+ }, 2000)} catch (err) {- console.error("[DataManagementScreen] Manual flush error:", err);- setIsProcessing(false);- showFeedback("❌ Failed to sync queue");+ console.error("[DataManagementScreen] Manual flush error:", err)+ setIsProcessing(false)+ showFeedback("❌ Failed to sync queue")}- }, [stats.queued, isProcessing, updateStats, showFeedback]);+ }, [stats.queued, isProcessing, updateStats, showFeedback])// Generic delete handlerconst handleDeleteAction = useCallback(- async (- action: () => Promise<number | void>,- successMessage: (count: number) => string- ) => {- setIsProcessing(true);+ async (action: () => Promise<number | void>, successMessage: (count: number) => string) => {+ setIsProcessing(true)try {- const deleted = await action();- await updateStats();+ const deleted = await action()+ await updateStats()if (typeof deleted === "number") {- showFeedback(successMessage(deleted));+ showFeedback(successMessage(deleted))}} catch (err) {- console.error("[DataManagementScreen] Delete action failed:", err);- showFeedback("❌ Action failed");+ console.error("[DataManagementScreen] Delete action failed:", err)+ showFeedback("❌ Action failed")} finally {- setIsProcessing(false);+ setIsProcessing(false)}},[updateStats, showFeedback]- );+ )const handleClearSentHistory = useCallback(() => {handleDeleteAction(() => NativeLocationService.clearSentHistory().then(() => stats.sent),(count) => `✅ Cleared ${count} sent location${count !== 1 ? "s" : ""}`- );- }, [handleDeleteAction, stats.sent]);+ )+ }, [handleDeleteAction, stats.sent])const handleClearQueue = useCallback(() => {handleDeleteAction(() => NativeLocationService.clearQueue(),(count) => `✅ Cleared ${count} queued location${count !== 1 ? "s" : ""}`- );- }, [handleDeleteAction]);+ )+ }, [handleDeleteAction])const handleDeleteOlderThan = useCallback(() => {- const days = parseInt(daysInput, 10);+ const days = parseInt(daysInput, 10)if (isNaN(days) || days <= 0) {- showFeedback("⚠️ Please enter a valid number of days");- return;+ showFeedback("⚠️ Please enter a valid number of days")+ return}handleDeleteAction(() => NativeLocationService.deleteOlderThan(days),(count) => `✅ Deleted ${count} old location${count !== 1 ? "s" : ""}`- );- }, [daysInput, handleDeleteAction, showFeedback]);+ )+ }, [daysInput, handleDeleteAction, showFeedback])const handleVacuum = useCallback(async () => {- setIsProcessing(true);+ setIsProcessing(true)try {- await NativeLocationService.vacuumDatabase();- await updateStats();- showFeedback("✅ Database optimized");+ await NativeLocationService.vacuumDatabase()+ await updateStats()+ showFeedback("✅ Database optimized")} catch (err) {- console.error("[DataManagementScreen] Vacuum failed:", err);- showFeedback("❌ Optimization failed");+ console.error("[DataManagementScreen] Vacuum failed:", err)+ showFeedback("❌ Optimization failed")} finally {- setIsProcessing(false);+ setIsProcessing(false)}- }, [updateStats, showFeedback]);+ }, [updateStats, showFeedback])return (<Container>- <KeyboardAvoidingView- style={styles.keyboardAvoid}- behavior={Platform.OS === "ios" ? "padding" : undefined}- >+ <KeyboardAvoidingView style={styles.keyboardAvoid} behavior={Platform.OS === "ios" ? "padding" : undefined}><ScrollView contentContainerStyle={styles.scrollContent}>{/* Header */}<View style={styles.header}>- <Text style={[styles.title, { color: colors.text }]}>- Data Management- </Text>- <Text style={[styles.subtitle, { color: colors.textSecondary }]}>- Manage your local location database- </Text>+ <Text style={[styles.title, { color: colors.text }]}>Data Management</Text>+ <Text style={[styles.subtitle, { color: colors.textSecondary }]}>Manage your local location database</Text></View>{/* Stats */}@@ -193,22 +176,11 @@ export function DataManagementScreen({}: ScreenProps) {["Sent", stats.sent.toLocaleString(), colors.success],["Queued", stats.queued.toLocaleString(), colors.warning],["Today", stats.today.toLocaleString(), colors.info],- [- "Storage",- `${stats.databaseSizeMB.toFixed(2)} MB`,- colors.primary,- ],+ ["Storage", `${stats.databaseSizeMB.toFixed(2)} MB`, colors.primary]].map(([label, value, color], i, arr) => (<React.Fragment key={i}><View style={styles.statRow}>- <Text- style={[- styles.statLabel,- { color: colors.textSecondary },- ]}- >- {label}- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>{label}</Text><Text style={[styles.statValue, { color }]}>{value}</Text></View>{i < arr.length - 1 && <Divider />}@@ -230,9 +202,7 @@ export function DataManagementScreen({}: ScreenProps) {<Text style={[styles.hint, { color: colors.textLight }]}>{stats.queued === 0? "Queue is empty"- : `Trigger immediate sync of ${stats.queued} queued location${- stats.queued !== 1 ? "s" : ""- }`}+ : `Trigger immediate sync of ${stats.queued} queued location${stats.queued !== 1 ? "s" : ""}`}</Text></Card></View>@@ -267,9 +237,7 @@ export function DataManagementScreen({}: ScreenProps) {{/* Delete Older Than */}<View style={styles.actionColumn}>- <Text style={[styles.actionLabel, { color: colors.text }]}>- Delete Old Locations- </Text>+ <Text style={[styles.actionLabel, { color: colors.text }]}>Delete Old Locations</Text><Text style={[styles.actionHint, { color: colors.textLight }]}>Remove locations older than specified days</Text>@@ -280,8 +248,8 @@ export function DataManagementScreen({}: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.backgroundElevated,- },+ backgroundColor: colors.backgroundElevated+ }]}keyboardType="numeric"value={daysInput}@@ -289,16 +257,9 @@ export function DataManagementScreen({}: ScreenProps) {placeholder="90"placeholderTextColor={colors.placeholder}/>- <Text- style={[styles.daysLabel, { color: colors.textSecondary }]}- >- days- </Text>+ <Text style={[styles.daysLabel, { color: colors.textSecondary }]}>days</Text><Button- style={[- { backgroundColor: colors.errorLight },- isProcessing && styles.buttonDisabled,- ]}+ style={[{ backgroundColor: colors.errorLight }, isProcessing && styles.buttonDisabled]}onPress={handleDeleteOlderThan}disabled={isProcessing}title="Delete"@@ -314,9 +275,7 @@ export function DataManagementScreen({}: ScreenProps) {disabled={isProcessing}activeOpacity={0.7}>- <Text style={[styles.actionLabel, { color: colors.text }]}>- Optimize Database- </Text>+ <Text style={[styles.actionLabel, { color: colors.text }]}>Optimize Database</Text><Text style={[styles.actionHint, { color: colors.textLight }]}>Reclaim unused space and improve performance</Text>@@ -329,15 +288,10 @@ export function DataManagementScreen({}: ScreenProps) {</ScrollView>{/* Floating Feedback */}- <FloatingSaveIndicator- saving={isProcessing}- success={false}- message={feedback}- colors={colors}- />+ <FloatingSaveIndicator saving={isProcessing} success={false} message={feedback} colors={colors} /></KeyboardAvoidingView></Container>- );+ )}// --- Reusable ActionRow Component ---@@ -348,119 +302,109 @@ const ActionRow = ({textColor,value,onPress,- disabled,+ disabled}: {- label: string;- hint: string;- color: string;- textColor: string;- value: string;- onPress: () => void;- disabled: boolean;+ label: string+ hint: string+ color: string+ textColor: string+ value: string+ onPress: () => void+ disabled: boolean}) => (- <TouchableOpacity- style={styles.actionRow}- onPress={onPress}- disabled={disabled}- activeOpacity={0.7}- >+ <TouchableOpacity style={styles.actionRow} onPress={onPress} disabled={disabled} activeOpacity={0.7}><View style={styles.actionInfo}><Text style={[styles.actionLabel, { color }]}>{label}</Text><Text style={[styles.actionHint, { color: textColor }]}>{hint}</Text></View>- <View- style={[- styles.actionBadge,- { backgroundColor: color + "20", borderColor: color },- ]}- >+ <View style={[styles.actionBadge, { backgroundColor: color + "20", borderColor: color }]}><Text style={[styles.actionBadgeText, { color }]}>{value}</Text></View></TouchableOpacity>-);+)const styles = StyleSheet.create({keyboardAvoid: {- flex: 1,+ flex: 1},scrollContent: {paddingHorizontal: 16,- paddingBottom: 40,+ paddingBottom: 40},header: {marginTop: 20,- marginBottom: 24,+ marginBottom: 24},title: {fontSize: 28,fontWeight: "700",- marginBottom: 4,+ marginBottom: 4},subtitle: {fontSize: 14,- lineHeight: 20,+ lineHeight: 20},section: {- marginBottom: 24,+ marginBottom: 24},statRow: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- paddingVertical: 8,+ paddingVertical: 8},statLabel: {fontSize: 14,- fontWeight: "500",+ fontWeight: "500"},statValue: {fontSize: 16,- fontWeight: "700",+ fontWeight: "700"},hint: {fontSize: 12,textAlign: "center",fontStyle: "italic",lineHeight: 16,- marginTop: 8,+ marginTop: 8},actionRow: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- paddingVertical: 12,+ paddingVertical: 12},actionColumn: {- paddingVertical: 12,+ paddingVertical: 12},actionInfo: {- flex: 1,+ flex: 1},actionLabel: {fontSize: 15,fontWeight: "600",- marginBottom: 4,+ marginBottom: 4},actionHint: {fontSize: 12,lineHeight: 16,- marginTop: 2,+ marginTop: 2},actionBadge: {paddingHorizontal: 12,paddingVertical: 6,borderRadius: 16,- borderWidth: 1,+ borderWidth: 1},actionBadgeText: {fontSize: 13,- fontWeight: "700",+ fontWeight: "700"},daysInputRow: {flexDirection: "row",alignItems: "center",marginTop: 12,- gap: 8,+ gap: 8},daysInput: {flex: 1,@@ -468,13 +412,13 @@ const styles = StyleSheet.create({padding: 10,borderRadius: 8,fontSize: 15,- textAlign: "center",+ textAlign: "center"},daysLabel: {fontSize: 15,- fontWeight: "500",+ fontWeight: "500"},buttonDisabled: {- opacity: 0.5,- },-});+ opacity: 0.5+ }+})diff --git a/src/screens/ExportDataScreen.tsx b/src/screens/ExportDataScreen.tsxindex 6cb5b912..1e179b4b 100644--- a/src/screens/ExportDataScreen.tsx+++ b/src/screens/ExportDataScreen.tsx@@ -3,219 +3,191 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useEffect, useCallback, useRef } from "react";-import {- Text,- StyleSheet,- View,- Alert,- ActivityIndicator,- ScrollView,- TouchableOpacity,-} from "react-native";-import { Container, Card, SectionTitle, Divider } from "../components";-import { useTheme } from "../hooks/useTheme";-import { ThemeColors, LocationCoords } from "../types/global";-import NativeLocationService from "../services/NativeLocationService";--type ExportFormat = "csv" | "geojson" | "gpx" | "kml";+import React, { useState, useEffect, useCallback, useRef } from "react"+import { Text, StyleSheet, View, Alert, ActivityIndicator, ScrollView, TouchableOpacity } from "react-native"+import { Container, Card, SectionTitle, Divider } from "../components"+import { useTheme } from "../hooks/useTheme"+import { ThemeColors, LocationCoords } from "../types/global"+import NativeLocationService from "../services/NativeLocationService"++type ExportFormat = "csv" | "geojson" | "gpx" | "kml"interface ExportStats {- totalLocations: number;+ totalLocations: number}-const LARGE_FILE_THRESHOLD = 10 * 1024 * 1024; // 10 MB+const LARGE_FILE_THRESHOLD = 10 * 1024 * 1024 // 10 MBconst formatBytes = (bytes: number): string => {- if (bytes < 1024) return `${bytes} B`;- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;-};+ if (bytes < 1024) return `${bytes} B`+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`+}const getByteSize = (content: string): number => {- return new Blob([content]).size;-};+ return new Blob([content]).size+}export function ExportDataScreen() {- const { colors } = useTheme();- const [exporting, setExporting] = useState(false);- const [exportProgress, setExportProgress] = useState<string>("");+ const { colors } = useTheme()+ const [exporting, setExporting] = useState(false)+ const [exportProgress, setExportProgress] = useState<string>("")const [stats, setStats] = useState<ExportStats>({- totalLocations: 0,- });- const [selectedFormat, setSelectedFormat] = useState<ExportFormat | null>(- null- );- const [fileSize, setFileSize] = useState<string | null>(null);- const cachedData = useRef<LocationCoords[]>([]);+ totalLocations: 0+ })+ const [selectedFormat, setSelectedFormat] = useState<ExportFormat | null>(null)+ const [fileSize, setFileSize] = useState<string | null>(null)+ const cachedData = useRef<LocationCoords[]>([])const loadStats = useCallback(async () => {try {- const data = await NativeLocationService.getExportData();+ const data = await NativeLocationService.getExportData()if (data && data.length > 0) {cachedData.current = data.map((item) => ({...item,- timestamp: item.timestamp ? item.timestamp * 1000 : Date.now(),- }));+ timestamp: item.timestamp ? item.timestamp * 1000 : Date.now()+ }))- setStats({ totalLocations: data.length });+ setStats({ totalLocations: data.length })}} catch (error) {- console.error("[ExportDataScreen] Failed to load stats:", error);+ console.error("[ExportDataScreen] Failed to load stats:", error)}- }, []);+ }, [])useEffect(() => {- loadStats();- }, [loadStats]);+ loadStats()+ }, [loadStats])useEffect(() => {if (!selectedFormat || cachedData.current.length === 0) {- setFileSize(null);- return;+ setFileSize(null)+ return}- const converters: Record<ExportFormat, (data: LocationCoords[]) => string> =- {- csv: convertToCSV,- geojson: convertToGeoJSON,- gpx: convertToGPX,- kml: convertToKML,- };+ const converters: Record<ExportFormat, (data: LocationCoords[]) => string> = {+ csv: convertToCSV,+ geojson: convertToGeoJSON,+ gpx: convertToGPX,+ kml: convertToKML+ }- const content = converters[selectedFormat](cachedData.current);- setFileSize(formatBytes(getByteSize(content)));- }, [selectedFormat]);+ const content = converters[selectedFormat](cachedData.current)+ setFileSize(formatBytes(getByteSize(content)))+ }, [selectedFormat])const handleExport = async (format: ExportFormat) => {if (stats.totalLocations === 0) {- Alert.alert(- "No Data",- "There are no locations in the database to export."- );- return;+ Alert.alert("No Data", "There are no locations in the database to export.")+ return}- setExporting(true);- setExportProgress("Preparing export...");+ setExporting(true)+ setExportProgress("Preparing export...")try {- const normalizedData = cachedData.current;+ const normalizedData = cachedData.current- setExportProgress(`Converting ${normalizedData.length} locations...`);+ setExportProgress(`Converting ${normalizedData.length} locations...`)- let content = "";- let fileExtension = "";- let mimeType = "";+ let content = ""+ let fileExtension = ""+ let mimeType = ""switch (format) {case "csv":- content = convertToCSV(normalizedData);- fileExtension = ".csv";- mimeType = "text/csv";- break;+ content = convertToCSV(normalizedData)+ fileExtension = ".csv"+ mimeType = "text/csv"+ breakcase "geojson":- content = convertToGeoJSON(normalizedData);- fileExtension = ".geojson";- mimeType = "application/json";- break;+ content = convertToGeoJSON(normalizedData)+ fileExtension = ".geojson"+ mimeType = "application/json"+ breakcase "gpx":- content = convertToGPX(normalizedData);- fileExtension = ".gpx";- mimeType = "application/gpx+xml";- break;+ content = convertToGPX(normalizedData)+ fileExtension = ".gpx"+ mimeType = "application/gpx+xml"+ breakcase "kml":- content = convertToKML(normalizedData);- fileExtension = ".kml";- mimeType = "application/vnd.google-earth.kml+xml";- break;+ content = convertToKML(normalizedData)+ fileExtension = ".kml"+ mimeType = "application/vnd.google-earth.kml+xml"+ break}- const fileSize = getByteSize(content);+ const fileSize = getByteSize(content)if (fileSize > LARGE_FILE_THRESHOLD) {- setExporting(false);- setExportProgress("");+ setExporting(false)+ setExportProgress("")const confirmed = await new Promise<boolean>((resolve) => {Alert.alert("Large Export",- `The export file is ${formatBytes(- fileSize- )}. This may take a moment to save and share. Continue?`,+ `The export file is ${formatBytes(fileSize)}. This may take a moment to save and share. Continue?`,[{text: "Cancel",style: "cancel",- onPress: () => resolve(false),+ onPress: () => resolve(false)},- { text: "Continue", onPress: () => resolve(true) },+ { text: "Continue", onPress: () => resolve(true) }],{ cancelable: false }- );- });+ )+ })if (!confirmed) {- setSelectedFormat(null);- return;+ setSelectedFormat(null)+ return}- setExporting(true);+ setExporting(true)}- const fileName = `colota_export_${Date.now()}${fileExtension}`;+ const fileName = `colota_export_${Date.now()}${fileExtension}`- setExportProgress(`Saving file (${formatBytes(fileSize)})...`);+ setExportProgress(`Saving file (${formatBytes(fileSize)})...`)- const filePath = await NativeLocationService.writeFile(fileName, content);+ const filePath = await NativeLocationService.writeFile(fileName, content)- setExporting(false);- setExportProgress("");+ setExporting(false)+ setExportProgress("")- await new Promise<void>((resolve) => setTimeout(resolve, 300));+ await new Promise<void>((resolve) => setTimeout(resolve, 300))try {- await NativeLocationService.shareFile(- filePath,- mimeType,- `Colota Export - ${stats.totalLocations} locations`- );+ await NativeLocationService.shareFile(filePath, mimeType, `Colota Export - ${stats.totalLocations} locations`)} catch (shareError: any) {- console.warn("[ExportDataScreen] Share error:", shareError);+ console.warn("[ExportDataScreen] Share error:", shareError)}setTimeout(async () => {try {- await NativeLocationService.deleteFile(filePath);+ await NativeLocationService.deleteFile(filePath)} catch (err) {- console.warn("[ExportDataScreen] Failed to cleanup temp file:", err);+ console.warn("[ExportDataScreen] Failed to cleanup temp file:", err)}- }, 2000);+ }, 2000)} catch (error) {- console.error("[ExportDataScreen] Export failed:", error);- Alert.alert(- "Export Failed",- "Unable to export your data. Please try again."- );+ console.error("[ExportDataScreen] Export failed:", error)+ Alert.alert("Export Failed", "Unable to export your data. Please try again.")} finally {- setExporting(false);- setExportProgress("");- setSelectedFormat(null);+ setExporting(false)+ setExportProgress("")+ setSelectedFormat(null)}- };+ }return (<Container>- <ScrollView- contentContainerStyle={styles.scrollContent}- showsVerticalScrollIndicator={false}- >+ <ScrollView contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false}>{/* Header */}<View style={styles.header}>- <Text style={[styles.title, { color: colors.text }]}>- Export Data- </Text>+ <Text style={[styles.title, { color: colors.text }]}>Export Data</Text></View>{/* Stats Card */}@@ -224,31 +196,21 @@ export function ExportDataScreen() {styles.statsContainer,{backgroundColor: colors.card,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}><View style={styles.statsGrid}><View style={styles.statItem}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- Total- </Text>- <Text style={[styles.statValue, { color: colors.primary }]}>- {stats.totalLocations.toLocaleString()}- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>Total</Text>+ <Text style={[styles.statValue, { color: colors.primary }]}>{stats.totalLocations.toLocaleString()}</Text></View>- <View- style={[styles.statsDivider, { backgroundColor: colors.border }]}- />+ <View style={[styles.statsDivider, { backgroundColor: colors.border }]} /><View style={styles.statItem}>- <Text style={[styles.statLabel, { color: colors.textSecondary }]}>- File Size- </Text>- <Text style={[styles.statValue, { color: colors.success }]}>- {fileSize ?? "–"}- </Text>+ <Text style={[styles.statLabel, { color: colors.textSecondary }]}>File Size</Text>+ <Text style={[styles.statValue, { color: colors.success }]}>{fileSize ?? "–"}</Text></View></View></View>@@ -317,9 +279,9 @@ export function ExportDataScreen() {style={[styles.exportButton,{- backgroundColor: colors.primary,+ backgroundColor: colors.primary},- exporting && styles.disabledButton,+ exporting && styles.disabledButton]}onPress={() => handleExport(selectedFormat)}disabled={exporting || stats.totalLocations === 0}@@ -328,9 +290,7 @@ export function ExportDataScreen() {<View style={styles.exportContent}><Text style={styles.exportIcon}>📤</Text><View style={styles.exportText}>- <Text style={[styles.exportTitle, { color: "#fff" }]}>- Export {selectedFormat.toUpperCase()}- </Text>+ <Text style={[styles.exportTitle, { color: "#fff" }]}>Export {selectedFormat.toUpperCase()}</Text><Text style={[styles.exportSubtitle, { color: "#fff" }]}>{stats.totalLocations.toLocaleString()} locations{fileSize ? ` • ${fileSize}` : ""}@@ -347,17 +307,13 @@ export function ExportDataScreen() {<View style={[styles.loader, { backgroundColor: colors.overlay }]}><View style={[styles.loaderCard, { backgroundColor: colors.card }]}><ActivityIndicator size="large" color={colors.primary} />- <Text style={[styles.loaderTitle, { color: colors.text }]}>- Exporting Data- </Text>- <Text style={[styles.loaderText, { color: colors.textSecondary }]}>- {exportProgress}- </Text>+ <Text style={[styles.loaderTitle, { color: colors.text }]}>Exporting Data</Text>+ <Text style={[styles.loaderText, { color: colors.textSecondary }]}>{exportProgress}</Text></View></View>)}</Container>- );+ )}// --- Format Option Component ---@@ -370,68 +326,44 @@ const FormatOption = ({extension,selected,onPress,- colors,+ colors}: {- icon: string;- title: string;- subtitle: string;- description: string;- extension: string;- selected: boolean;- onPress: () => void;- colors: ThemeColors;+ icon: string+ title: string+ subtitle: string+ description: string+ extension: string+ selected: boolean+ onPress: () => void+ colors: ThemeColors}) => {- const backgroundColor = selected ? colors.primary + "12" : "transparent";- const radioBgColor = selected ? colors.primary + "20" : "transparent";+ const backgroundColor = selected ? colors.primary + "12" : "transparent"+ const radioBgColor = selected ? colors.primary + "20" : "transparent"return (- <TouchableOpacity- style={[styles.formatOption, { backgroundColor }]}- onPress={onPress}- activeOpacity={0.7}- >- {selected && (- <View- style={[styles.selectionBar, { backgroundColor: colors.primary }]}- />- )}+ <TouchableOpacity style={[styles.formatOption, { backgroundColor }]} onPress={onPress} activeOpacity={0.7}>+ {selected && <View style={[styles.selectionBar, { backgroundColor: colors.primary }]} />}<View style={styles.formatContent}><View style={styles.leftContent}><Text style={styles.formatIcon}>{icon}</Text><View style={styles.textContent}><View style={styles.titleRow}>- <Text style={[styles.formatTitle, { color: colors.text }]}>- {title}- </Text>+ <Text style={[styles.formatTitle, { color: colors.text }]}>{title}</Text><Viewstyle={[styles.extensionBadge,{- backgroundColor: selected- ? colors.primary + "20"- : colors.primary + "15",- borderColor: selected- ? colors.primary + "60"- : colors.primary + "30",- },+ backgroundColor: selected ? colors.primary + "20" : colors.primary + "15",+ borderColor: selected ? colors.primary + "60" : colors.primary + "30"+ }]}>- <Text style={[styles.extensionText, { color: colors.primary }]}>- {extension}- </Text>+ <Text style={[styles.extensionText, { color: colors.primary }]}>{extension}</Text></View></View>- <Text- style={[styles.formatSubtitle, { color: colors.textSecondary }]}- >- {subtitle}- </Text>- <Text- style={[styles.formatDescription, { color: colors.textLight }]}- >- {description}- </Text>+ <Text style={[styles.formatSubtitle, { color: colors.textSecondary }]}>{subtitle}</Text>+ <Text style={[styles.formatDescription, { color: colors.textLight }]}>{description}</Text></View></View>@@ -440,30 +372,25 @@ const FormatOption = ({styles.radio,{borderColor: selected ? colors.primary : colors.border,- backgroundColor: radioBgColor,- },+ backgroundColor: radioBgColor+ }]}>- {selected && (- <View- style={[styles.radioInner, { backgroundColor: colors.primary }]}- />- )}+ {selected && <View style={[styles.radioInner, { backgroundColor: colors.primary }]} />}</View></View></TouchableOpacity>- );-};+ )+}// --- Format Conversion Functions ---const convertToCSV = (data: LocationCoords[]): string => {- const headers =- "id,timestamp,iso_time,latitude,longitude,accuracy,altitude,speed,battery\n";+ const headers = "id,timestamp,iso_time,latitude,longitude,accuracy,altitude,speed,battery\n"const rows = data.map((item, i) => {- const timestamp = item.timestamp ?? Date.now();- const isoTime = new Date(timestamp).toISOString();+ const timestamp = item.timestamp ?? Date.now()+ const isoTime = new Date(timestamp).toISOString()return [i,item.timestamp,@@ -473,25 +400,23 @@ const convertToCSV = (data: LocationCoords[]): string => {item.accuracy,item.altitude ?? 0,item.speed ?? 0,- item.battery ?? 0,- ].join(",");+ item.battery ?? 0+ ].join(",")})- .join("\n");- return headers + rows;-};+ .join("\n")+ return headers + rows+}const convertToGeoJSON = (data: LocationCoords[]): string => {const features = data.map((item, i) => {- const timestamp = item.timestamp ? new Date(item.timestamp) : new Date();- const timeStr = isNaN(timestamp.getTime())- ? new Date().toISOString()- : timestamp.toISOString();+ const timestamp = item.timestamp ? new Date(item.timestamp) : new Date()+ const timeStr = isNaN(timestamp.getTime()) ? new Date().toISOString() : timestamp.toISOString()return {type: "Feature",geometry: {type: "Point",- coordinates: [item.longitude || 0, item.latitude || 0],+ coordinates: [item.longitude || 0, item.latitude || 0]},properties: {id: i,@@ -499,20 +424,20 @@ const convertToGeoJSON = (data: LocationCoords[]): string => {altitude: item.altitude,speed: item.speed,battery: item.battery,- time: timeStr,- },- };- });+ time: timeStr+ }+ }+ })return JSON.stringify({type: "FeatureCollection",- features,+ features},null,2- );-};+ )+}const convertToGPX = (data: LocationCoords[]): string => {let gpx = `<?xml version="1.0" encoding="UTF-8"?>@@ -523,15 +448,13 @@ const convertToGPX = (data: LocationCoords[]): string => {</metadata><trk><name>Colota Track Export</name>- <trkseg>`;+ <trkseg>`data.forEach((item) => {- const timestamp = item.timestamp ?? Date.now();- const isoTime = new Date(timestamp).toISOString();+ const timestamp = item.timestamp ?? Date.now()+ const isoTime = new Date(timestamp).toISOString()gpx += `- <trkpt lat="${item.latitude.toFixed(6)}" lon="${item.longitude.toFixed(- 6- )}">+ <trkpt lat="${item.latitude.toFixed(6)}" lon="${item.longitude.toFixed(6)}"><ele>${item.altitude || 0}</ele><time>${isoTime}</time><extensions>@@ -539,15 +462,15 @@ const convertToGPX = (data: LocationCoords[]): string => {<speed>${item.speed || 0}</speed><battery>${item.battery || 0}</battery></extensions>- </trkpt>`;- });+ </trkpt>`+ })gpx += `</trkseg></trk>-</gpx>`;- return gpx;-};+</gpx>`+ return gpx+}const convertToKML = (data: LocationCoords[]): string => {let kml = `<?xml version="1.0" encoding="UTF-8"?>@@ -567,147 +490,138 @@ const convertToKML = (data: LocationCoords[]): string => {<LineString><tessellate>1</tessellate><coordinates>- ${data- .map(- (item) =>- `${item.longitude},${item.latitude},${item.altitude || 0}`- )- .join("\n ")}+ ${data.map((item) => `${item.longitude},${item.latitude},${item.altitude || 0}`).join("\n ")}</coordinates></LineString>- </Placemark>`;+ </Placemark>`data.forEach((item) => {- const timestamp = item.timestamp ?? Date.now();- const isoTime = new Date(timestamp).toISOString();+ const timestamp = item.timestamp ?? Date.now()+ const isoTime = new Date(timestamp).toISOString()kml += `<Placemark><TimeStamp><when>${isoTime}</when></TimeStamp>- <description>Accuracy: ${item.accuracy}m, Speed: ${- item.speed- }m/s</description>+ <description>Accuracy: ${item.accuracy}m, Speed: ${item.speed}m/s</description><Point>- <coordinates>${item.longitude},${item.latitude},${- item.altitude || 0- }</coordinates>+ <coordinates>${item.longitude},${item.latitude},${item.altitude || 0}</coordinates></Point>- </Placemark>`;- });+ </Placemark>`+ })kml += `</Document>-</kml>`;- return kml;-};+</kml>`+ return kml+}const styles = StyleSheet.create({scrollContent: {- paddingBottom: 40,+ paddingBottom: 40},header: {marginTop: 20,marginBottom: 20,- paddingHorizontal: 20,+ paddingHorizontal: 20},title: {fontSize: 28,fontWeight: "700",- letterSpacing: -0.5,+ letterSpacing: -0.5},statsContainer: {borderRadius: 16,borderWidth: 2,marginHorizontal: 20,marginBottom: 24,- overflow: "hidden",+ overflow: "hidden"},statsGrid: {flexDirection: "row",- padding: 20,+ padding: 20},statItem: {flex: 1,- alignItems: "center",+ alignItems: "center"},statLabel: {fontSize: 12,fontWeight: "600",textTransform: "uppercase",letterSpacing: 0.8,- marginBottom: 8,+ marginBottom: 8},statValue: {fontSize: 20,fontWeight: "700",letterSpacing: -0.5,- textAlign: "center",+ textAlign: "center"},statsDivider: {width: 1,marginHorizontal: 12,- opacity: 0.3,+ opacity: 0.3},section: {paddingHorizontal: 20,- marginBottom: 24,+ marginBottom: 24},formatOption: {paddingVertical: 8,paddingHorizontal: 0,- position: "relative",+ position: "relative"},selectionBar: {position: "absolute",left: -20,top: 0,bottom: 0,- width: 4,+ width: 4},formatContent: {flexDirection: "row",- alignItems: "center",+ alignItems: "center"},leftContent: {flex: 1,flexDirection: "row",alignItems: "center",- gap: 14,+ gap: 14},formatIcon: {- fontSize: 28,+ fontSize: 28},textContent: {- flex: 1,+ flex: 1},titleRow: {flexDirection: "row",alignItems: "center",gap: 8,- marginBottom: 2,+ marginBottom: 2},formatTitle: {fontSize: 16,fontWeight: "600",- letterSpacing: -0.2,+ letterSpacing: -0.2},extensionBadge: {paddingHorizontal: 8,paddingVertical: 3,borderRadius: 6,- borderWidth: 1,+ borderWidth: 1},extensionText: {fontSize: 10,fontWeight: "700",- letterSpacing: 0.3,+ letterSpacing: 0.3},formatSubtitle: {fontSize: 13,- marginBottom: 2,+ marginBottom: 2},formatDescription: {fontSize: 12,- lineHeight: 16,+ lineHeight: 16},radio: {width: 24,@@ -716,15 +630,15 @@ const styles = StyleSheet.create({borderWidth: 2,justifyContent: "center",alignItems: "center",- marginLeft: 12,+ marginLeft: 12},radioInner: {width: 12,height: 12,- borderRadius: 6,+ borderRadius: 6},exportSection: {- paddingHorizontal: 20,+ paddingHorizontal: 20},exportButton: {borderRadius: 14,@@ -732,36 +646,36 @@ const styles = StyleSheet.create({shadowOffset: { width: 0, height: 2 },shadowOpacity: 0.1,shadowRadius: 4,- elevation: 3,+ elevation: 3},exportContent: {flexDirection: "row",- alignItems: "center",+ alignItems: "center"},exportIcon: {fontSize: 28,- marginRight: 14,+ marginRight: 14},exportText: {- flex: 1,+ flex: 1},exportTitle: {fontSize: 17,fontWeight: "600",- marginBottom: 2,+ marginBottom: 2},exportSubtitle: {fontSize: 13,- opacity: 0.9,+ opacity: 0.9},disabledButton: {- opacity: 0.5,+ opacity: 0.5},loader: {...StyleSheet.absoluteFillObject,zIndex: 999,justifyContent: "center",- alignItems: "center",+ alignItems: "center"},loaderCard: {padding: 32,@@ -771,16 +685,16 @@ const styles = StyleSheet.create({shadowOpacity: 0.3,shadowRadius: 8,elevation: 8,- minWidth: 240,+ minWidth: 240},loaderTitle: {fontSize: 16,fontWeight: "600",marginTop: 16,- marginBottom: 8,+ marginBottom: 8},loaderText: {fontSize: 13,- textAlign: "center",- },-});+ textAlign: "center"+ }+})diff --git a/src/screens/GeofenceScreen.tsx b/src/screens/GeofenceScreen.tsxindex 17a33c56..dcec6f66 100644--- a/src/screens/GeofenceScreen.tsx+++ b/src/screens/GeofenceScreen.tsx@@ -3,13 +3,7 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, {- useState,- useEffect,- useRef,- useMemo,- useCallback,-} from "react";+import React, { useState, useEffect, useRef, useMemo, useCallback } from "react"import {View,Text,@@ -19,99 +13,94 @@ import {FlatList,Alert,Switch,- DeviceEventEmitter,-} from "react-native";-import { WebView } from "react-native-webview";-import { useTheme } from "../hooks/useTheme";-import NativeLocationService from "../services/NativeLocationService";-import { Geofence, ScreenProps } from "../types/global";-import { useTracking } from "../contexts/TrackingProvider";-import { Container, SectionTitle, Card } from "../components";-import { MapCenterButton } from "../components/features/map/MapCenterButton";+ DeviceEventEmitter+} from "react-native"+import { WebView } from "react-native-webview"+import { useTheme } from "../hooks/useTheme"+import NativeLocationService from "../services/NativeLocationService"+import { Geofence, ScreenProps } from "../types/global"+import { useTracking } from "../contexts/TrackingProvider"+import { Container, SectionTitle, Card } from "../components"+import { MapCenterButton } from "../components/features/map/MapCenterButton"export function GeofenceScreen({}: ScreenProps) {- const { coords, tracking } = useTracking();- const { colors, mode } = useTheme();- const isDark = mode === "dark";-- const [geofences, setGeofences] = useState<Geofence[]>([]);- const [newName, setNewName] = useState("");- const [newRadius, setNewRadius] = useState("50");- const [placingGeofence, setPlacingGeofence] = useState(false);- const [isCentered, setIsCentered] = useState(true);- const [mapReady, setMapReady] = useState(false);- const [hasInitialCoords, setHasInitialCoords] = useState(false);- const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(- null- );-- const webviewRef = useRef<WebView>(null);+ const { coords, tracking } = useTracking()+ const { colors, mode } = useTheme()+ const isDark = mode === "dark"++ const [geofences, setGeofences] = useState<Geofence[]>([])+ const [newName, setNewName] = useState("")+ const [newRadius, setNewRadius] = useState("50")+ const [placingGeofence, setPlacingGeofence] = useState(false)+ const [isCentered, setIsCentered] = useState(true)+ const [mapReady, setMapReady] = useState(false)+ const [hasInitialCoords, setHasInitialCoords] = useState(false)+ const [currentSilentZone, setCurrentSilentZone] = useState<string | null>(null)++ const webviewRef = useRef<WebView>(null)const initialCenter = useRef<{- latitude: number;- longitude: number;- accuracy: number;- } | null>(null);+ latitude: number+ longitude: number+ accuracy: number+ } | null>(null)// Set initial map center: use live coords, fall back to last known from DB, then defaultuseEffect(() => {- if (hasInitialCoords) return;+ if (hasInitialCoords) returnif (coords) {initialCenter.current = {latitude: coords.latitude,longitude: coords.longitude,- accuracy: coords.accuracy ?? 0,- };- setHasInitialCoords(true);- return;+ accuracy: coords.accuracy ?? 0+ }+ setHasInitialCoords(true)+ return}NativeLocationService.getMostRecentLocation().then((latest) => {- if (initialCenter.current) return;+ if (initialCenter.current) returninitialCenter.current = latest? {latitude: latest.latitude,longitude: latest.longitude,- accuracy: latest.accuracy ?? 0,+ accuracy: latest.accuracy ?? 0}- : { latitude: 0, longitude: 0, accuracy: 0 };- setHasInitialCoords(true);- });- }, [coords, hasInitialCoords]);+ : { latitude: 0, longitude: 0, accuracy: 0 }+ setHasInitialCoords(true)+ })+ }, [coords, hasInitialCoords])// Load geofencesconst loadGeofences = useCallback(async () => {try {- const data = await NativeLocationService.getGeofences();- setGeofences(data);+ const data = await NativeLocationService.getGeofences()+ setGeofences(data)} catch (err) {- console.error("[GeofenceScreen] Failed to load geofences:", err);+ console.error("[GeofenceScreen] Failed to load geofences:", err)}- }, []);+ }, [])useEffect(() => {- loadGeofences();- }, [loadGeofences]);+ loadGeofences()+ }, [loadGeofences])// Check for silent zoneuseEffect(() => {const checkSilentZone = async () => {try {- const zoneName = await NativeLocationService.checkCurrentSilentZone();- setCurrentSilentZone(zoneName);+ const zoneName = await NativeLocationService.checkCurrentSilentZone()+ setCurrentSilentZone(zoneName)} catch (err) {- console.error("[GeofenceScreen] Failed to check silent zone:", err);+ console.error("[GeofenceScreen] Failed to check silent zone:", err)}- };+ }- checkSilentZone();- const listener = DeviceEventEmitter.addListener(- "geofenceUpdated",- checkSilentZone- );- return () => listener.remove();- }, []);+ checkSilentZone()+ const listener = DeviceEventEmitter.addListener("geofenceUpdated", checkSilentZone)+ return () => listener.remove()+ }, [])// Update user positionuseEffect(() => {@@ -121,11 +110,11 @@ export function GeofenceScreen({}: ScreenProps) {action: "update_user_pos",coords,tracking,- isPaused: !!currentSilentZone,+ isPaused: !!currentSilentZone})- );+ )}- }, [coords, mapReady, tracking, currentSilentZone]);+ }, [coords, mapReady, tracking, currentSilentZone])// Update geofencesuseEffect(() => {@@ -133,19 +122,19 @@ export function GeofenceScreen({}: ScreenProps) {webviewRef.current.postMessage(JSON.stringify({action: "update_geofences",- geofences,+ geofences})- );+ )}- }, [geofences, mapReady]);+ }, [geofences, mapReady])const onMessage = useCallback(async (event: any) => {try {- const data = JSON.parse(event.nativeEvent.data);+ const data = JSON.parse(event.nativeEvent.data)- if (data.type === "MAP_READY") setMapReady(true);- if (data.type === "CENTERED") setIsCentered(data.value);+ if (data.type === "MAP_READY") setMapReady(true)+ if (data.type === "CENTERED") setIsCentered(data.value)if (data.action === "map_click") {try {@@ -155,80 +144,76 @@ export function GeofenceScreen({}: ScreenProps) {lon: data.longitude,radius: Number(newRadius),enabled: true,- pauseTracking: true,- });-- setNewName("");- setNewRadius("50");- setPlacingGeofence(false);- await loadGeofences();- DeviceEventEmitter.emit("geofenceUpdated");+ pauseTracking: true+ })++ setNewName("")+ setNewRadius("50")+ setPlacingGeofence(false)+ await loadGeofences()+ DeviceEventEmitter.emit("geofenceUpdated")} catch {- Alert.alert("Error", "Failed to create geofence.");+ Alert.alert("Error", "Failed to create geofence.")}}} catch (err) {- console.error("[GeofenceScreen] Message error:", err);+ console.error("[GeofenceScreen] Message error:", err)}},[newName, newRadius, loadGeofences]- );+ )const startPlacingGeofence = useCallback(() => {if (!newName.trim()) {- Alert.alert("Missing Name", "Please enter a name.");- return;+ Alert.alert("Missing Name", "Please enter a name.")+ return}- const radius = Number(newRadius);+ const radius = Number(newRadius)if (!radius || radius <= 0) {- Alert.alert("Invalid Radius", "Please enter a valid radius.");- return;+ Alert.alert("Invalid Radius", "Please enter a valid radius.")+ return}- setPlacingGeofence(true);- webviewRef.current?.postMessage(- JSON.stringify({ action: "place_geofence", radius })- );- }, [newName, newRadius]);+ setPlacingGeofence(true)+ webviewRef.current?.postMessage(JSON.stringify({ action: "place_geofence", radius }))+ }, [newName, newRadius])const handleCenterMe = useCallback(() => {if (coords) {- webviewRef.current?.postMessage(- JSON.stringify({ action: "center_map", coords })- );+ webviewRef.current?.postMessage(JSON.stringify({ action: "center_map", coords }))}- }, [coords]);+ }, [coords])const togglePause = useCallback(async (id: number, value: boolean) => {try {await NativeLocationService.updateGeofence({id,- pauseTracking: value,- });- await loadGeofences();- DeviceEventEmitter.emit("geofenceUpdated");- await NativeLocationService.recheckZoneSettings();+ pauseTracking: value+ })+ await loadGeofences()+ DeviceEventEmitter.emit("geofenceUpdated")+ await NativeLocationService.recheckZoneSettings()} catch {- Alert.alert("Error", "Failed to update geofence.");+ Alert.alert("Error", "Failed to update geofence.")}},[loadGeofences]- );+ )const handleZoomToGeofence = useCallback((item: Geofence) => {- if (!webviewRef.current) return;+ if (!webviewRef.current) returnwebviewRef.current.postMessage(JSON.stringify({action: "zoom_to_geofence",lat: item.lat,lon: item.lon,- radius: item.radius,+ radius: item.radius})- );- }, []);+ )+ }, [])const handleDelete = useCallback((item: Geofence) => {@@ -239,26 +224,26 @@ export function GeofenceScreen({}: ScreenProps) {style: "destructive",onPress: async () => {try {- await NativeLocationService.deleteGeofence(item.id!);- await loadGeofences();- DeviceEventEmitter.emit("geofenceUpdated");+ await NativeLocationService.deleteGeofence(item.id!)+ await loadGeofences()+ DeviceEventEmitter.emit("geofenceUpdated")} catch {- Alert.alert("Error", "Failed to delete geofence.");+ Alert.alert("Error", "Failed to delete geofence.")}- },- },- ]);+ }+ }+ ])},[loadGeofences]- );+ )const html = useMemo(() => {- if (!hasInitialCoords || !initialCenter.current) return "";+ if (!hasInitialCoords || !initialCenter.current) return ""- const lon = initialCenter.current.longitude;- const lat = initialCenter.current.latitude;- const hasRealCoords = lat !== 0 || lon !== 0;- const initialZoom = hasRealCoords ? 17 : 2;+ const lon = initialCenter.current.longitude+ const lat = initialCenter.current.latitude+ const hasRealCoords = lat !== 0 || lon !== 0+ const initialZoom = hasRealCoords ? 17 : 2return `<!DOCTYPE html>@@ -345,9 +330,7 @@ export function GeofenceScreen({}: ScreenProps) {}.ol-attribution {- background: ${- isDark ? "rgba(0,0,0,0.85)" : "rgba(255,255,255,0.95)"- } !important;+ background: ${isDark ? "rgba(0,0,0,0.85)" : "rgba(255,255,255,0.95)"} !important;border-radius: ${colors.borderRadius}px !important;padding: 4px 8px !important;font-size: 11px !important;@@ -365,11 +348,7 @@ export function GeofenceScreen({}: ScreenProps) {text-decoration: none !important;}- ${- isDark- ? ".ol-layer canvas { filter: brightness(0.6) contrast(1.2) saturate(0.8); }"- : ""- }+ ${isDark ? ".ol-layer canvas { filter: brightness(0.6) contrast(1.2) saturate(0.8); }" : ""}</style></head><body>@@ -433,9 +412,7 @@ export function GeofenceScreen({}: ScreenProps) {feature.setStyle(new ol.style.Style({stroke: new ol.style.Stroke({- color: zone.pauseTracking ? "${colors.warning}" : "${- colors.info- }",+ color: zone.pauseTracking ? "${colors.warning}" : "${colors.info}",width: 2,lineDash: zone.pauseTracking ? null : [5, 5]}),@@ -452,9 +429,7 @@ export function GeofenceScreen({}: ScreenProps) {text: zone.name,font: "bold 12px sans-serif",fill: new ol.style.Fill({- color: zone.pauseTracking ? "${colors.warning}" : "${- colors.info- }"+ color: zone.pauseTracking ? "${colors.warning}" : "${colors.info}"}),stroke: new ol.style.Stroke({ color: "#fff", width: 3 }),offsetY: -25@@ -520,9 +495,7 @@ export function GeofenceScreen({}: ScreenProps) {if (markerIcon && markerPulse) {const isActive = data.tracking && !data.isPaused;- const markerColor = data.isPaused ? "${colors.textDisabled}" : "${- colors.primary- }";+ const markerColor = data.isPaused ? "${colors.textDisabled}" : "${colors.primary}";markerIcon.style.background = markerColor;markerPulse.style.borderColor = markerColor;markerPulse.style.display = isActive ? "block" : "none";@@ -586,39 +559,27 @@ export function GeofenceScreen({}: ScreenProps) {</script></body></html>-`;- }, [colors, isDark, hasInitialCoords]);+`+ }, [colors, isDark, hasInitialCoords])const renderItem = useCallback(({ item }: { item: Geofence }) => (<Card style={styles.card}><View style={styles.row}>- <TouchableOpacity- style={styles.info}- onPress={() => handleZoomToGeofence(item)}- activeOpacity={0.7}- >- <Text style={[styles.name, { color: colors.text }]}>- {item.name}- </Text>- <Text style={[styles.radius, { color: colors.textSecondary }]}>- {item.radius}m • Tap to view- </Text>+ <TouchableOpacity style={styles.info} onPress={() => handleZoomToGeofence(item)} activeOpacity={0.7}>+ <Text style={[styles.name, { color: colors.text }]}>{item.name}</Text>+ <Text style={[styles.radius, { color: colors.textSecondary }]}>{item.radius}m • Tap to view</Text></TouchableOpacity><View style={styles.actions}><View style={styles.pauseSwitch}>- <Text- style={[styles.pauseLabel, { color: colors.textSecondary }]}- >- Pause- </Text>+ <Text style={[styles.pauseLabel, { color: colors.textSecondary }]}>Pause</Text><Switchvalue={item.pauseTracking}onValueChange={(val) => togglePause(item.id!, val)}trackColor={{false: colors.border,- true: colors.warning + "80",+ true: colors.warning + "80"}}thumbColor={item.pauseTracking ? colors.warning : "#f4f3f4"}/>@@ -626,22 +587,17 @@ export function GeofenceScreen({}: ScreenProps) {<TouchableOpacityonPress={() => handleDelete(item)}- style={[- styles.deleteBtn,- { backgroundColor: colors.error + "15" },- ]}+ style={[styles.deleteBtn, { backgroundColor: colors.error + "15" }]}activeOpacity={0.7}>- <Text style={[styles.deleteText, { color: colors.error }]}>- ✕- </Text>+ <Text style={[styles.deleteText, { color: colors.error }]}>✕</Text></TouchableOpacity></View></View></Card>),[colors, handleDelete, togglePause, handleZoomToGeofence]- );+ )return (<Container>@@ -651,17 +607,14 @@ export function GeofenceScreen({}: ScreenProps) {originWhitelist={["*"]}source={{html: html,- baseUrl: "file:///android_asset/",+ baseUrl: "file:///android_asset/"}}style={styles.webview}scrollEnabled={false}onMessage={onMessage}/>- <MapCenterButton- visible={!isCentered && tracking}- onPress={handleCenterMe}- />+ <MapCenterButton visible={!isCentered && tracking} onPress={handleCenterMe} /></View><FlatList@@ -680,19 +633,15 @@ export function GeofenceScreen({}: ScreenProps) {<View style={styles.inputRow}><View style={[styles.inputGroup, styles.inputGroupName]}>- <Text- style={[styles.label, { color: colors.textSecondary }]}- >- Name- </Text>+ <Text style={[styles.label, { color: colors.textSecondary }]}>Name</Text><TextInputstyle={[styles.input,{backgroundColor: colors.background,color: colors.text,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}placeholder="Home, Office..."placeholderTextColor={colors.placeholder}@@ -702,11 +651,7 @@ export function GeofenceScreen({}: ScreenProps) {</View><View style={[styles.inputGroup, styles.inputGroupRadius]}>- <Text- style={[styles.label, { color: colors.textSecondary }]}- >- Radius (m)- </Text>+ <Text style={[styles.label, { color: colors.textSecondary }]}>Radius (m)</Text><TextInputstyle={[styles.input,@@ -714,8 +659,8 @@ export function GeofenceScreen({}: ScreenProps) {{backgroundColor: colors.background,color: colors.text,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}placeholder="50"placeholderTextColor={colors.placeholder}@@ -732,18 +677,14 @@ export function GeofenceScreen({}: ScreenProps) {disabled={placingGeofence}activeOpacity={0.7}>- <Text style={styles.placeBtnText}>- {placingGeofence ? "Tap Map to Place..." : "Place Geofence"}- </Text>+ <Text style={styles.placeBtnText}>{placingGeofence ? "Tap Map to Place..." : "Place Geofence"}</Text></TouchableOpacity></Card></View>{geofences.length > 0 && (<View style={styles.section}>- <SectionTitle>- Active Geofences ({geofences.length})- </SectionTitle>+ <SectionTitle>Active Geofences ({geofences.length})</SectionTitle></View>)}</>@@ -751,9 +692,7 @@ export function GeofenceScreen({}: ScreenProps) {ListEmptyComponent={geofences.length === 0 ? (<View style={styles.empty}>- <Text style={[styles.emptyText, { color: colors.textSecondary }]}>- No geofences yet- </Text>+ <Text style={[styles.emptyText, { color: colors.textSecondary }]}>No geofences yet</Text><Text style={[styles.emptyHint, { color: colors.textLight }]}>Create a geofence to pause tracking in specific areas</Text>@@ -763,55 +702,34 @@ export function GeofenceScreen({}: ScreenProps) {renderItem={renderItem}/></Container>- );+ )}const styles = StyleSheet.create({map: { height: 450, overflow: "hidden" },webview: { flex: 1 },- centerBtn: {- position: "absolute",- right: 12,- bottom: 12,- width: 44,- height: 44,- borderRadius: 22,- alignItems: "center",- justifyContent: "center",- borderWidth: 1,- shadowOffset: { width: 0, height: 2 },- shadowOpacity: 0.2,- shadowRadius: 3,- elevation: 3,- },- loading: { flex: 1, justifyContent: "center", alignItems: "center" },- loadingText: { fontSize: 16, fontWeight: "600" },list: { padding: 20, paddingBottom: 40 },section: { marginBottom: 16 },hint: { fontSize: 13, lineHeight: 18, marginBottom: 16 },inputRow: { flexDirection: "row", gap: 12, marginBottom: 16 },inputGroup: { flex: 1 },inputGroupName: {- flex: 2,+ flex: 2},inputGroupRadius: {flex: 0,- minWidth: 90,+ minWidth: 90},label: {fontSize: 12,fontWeight: "600",marginBottom: 6,textTransform: "uppercase",- letterSpacing: 0.5,+ letterSpacing: 0.5},input: { padding: 14, borderWidth: 1.5, borderRadius: 10, fontSize: 15 },inputCentered: {- textAlign: "center",- },- centerIcon: {- width: 28,- height: 28,+ textAlign: "center"},placeBtn: { padding: 16, borderRadius: 12, alignItems: "center" },placeBtnText: { color: "#f8f7f7", fontSize: 15, fontWeight: "600" },@@ -819,7 +737,7 @@ const styles = StyleSheet.create({row: {flexDirection: "row",alignItems: "center",- justifyContent: "space-between",+ justifyContent: "space-between"},info: { flex: 1, marginRight: 12 },name: { fontSize: 15, fontWeight: "600", marginBottom: 2 },@@ -830,14 +748,14 @@ const styles = StyleSheet.create({fontSize: 11,fontWeight: "600",textTransform: "uppercase",- letterSpacing: 0.3,+ letterSpacing: 0.3},deleteBtn: {width: 32,height: 32,borderRadius: 16,alignItems: "center",- justifyContent: "center",+ justifyContent: "center"},deleteText: { fontSize: 18, fontWeight: "600" },empty: { alignItems: "center", paddingVertical: 40 },@@ -846,6 +764,6 @@ const styles = StyleSheet.create({fontSize: 13,textAlign: "center",maxWidth: 260,- lineHeight: 18,- },-});+ lineHeight: 18+ }+})diff --git a/src/screens/LocationInspectorScreen.tsx b/src/screens/LocationInspectorScreen.tsxindex cf9fd4c1..5537d81f 100644--- a/src/screens/LocationInspectorScreen.tsx+++ b/src/screens/LocationInspectorScreen.tsx@@ -3,86 +3,76 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useEffect, useRef, useCallback, memo } from "react";-import {- View,- Text,- FlatList,- StyleSheet,- TouchableOpacity,- Switch,-} from "react-native";-import { Container, Card } from "../components";-import { useTheme } from "../hooks/useTheme";-import { ThemeColors } from "../types/global";-import NativeLocationService from "../services/NativeLocationService";+import React, { useState, useEffect, useRef, useCallback, memo } from "react"+import { View, Text, FlatList, StyleSheet, TouchableOpacity, Switch } from "react-native"+import { Container, Card } from "../components"+import { useTheme } from "../hooks/useTheme"+import { ThemeColors } from "../types/global"+import NativeLocationService from "../services/NativeLocationService"// Typesinterface LocationData {- id?: number;- location_id?: number;- timestamp?: number;- created_at?: number;- latitude: number;- longitude: number;- altitude?: number;- speed?: number;- accuracy?: number;- bearing?: number;- battery: number;- battery_status: number;- last_error?: string;+ id?: number+ location_id?: number+ timestamp?: number+ created_at?: number+ latitude: number+ longitude: number+ altitude?: number+ speed?: number+ accuracy?: number+ bearing?: number+ battery: number+ battery_status: number+ last_error?: string}interface LocationItemProps {- item: LocationData;- colors: ThemeColors;- isQueue: boolean;+ item: LocationData+ colors: ThemeColors+ isQueue: boolean}interface MetricProps {- label: string;- value: string;- colors: ThemeColors;+ label: string+ value: string+ colors: ThemeColors}interface TabProps {- label: string;- active: boolean;- onPress: () => void;- colors: ThemeColors;+ label: string+ active: boolean+ onPress: () => void+ colors: ThemeColors}-type TableType = "locations" | "queue";+type TableType = "locations" | "queue"/*** Memoized row component to prevent re-renders during scrolling*/const LocationItem = memo(({ item, colors, isQueue }: LocationItemProps) => {const getBatteryStatus = (status: number): string => {- console.log("batterystatus" + status);switch (status) {case 0:- return "Unknown";+ return "Unknown"case 1:- return "Unplugged";+ return "Unplugged"case 2:- return "Charging";+ return "Charging"case 3:- return "Full";+ return "Full"default:- return "Unknown";+ return "Unknown"}- };+ }- const timestamp = item.timestamp || item.created_at || Date.now();+ const timestamp = item.timestamp || item.created_at || Date.now()return (<Card style={styles.itemCard}><View style={styles.row}>- <Text style={[styles.id, { color: colors.primary }]}>- #{item.id || item.location_id}- </Text>+ <Text style={[styles.id, { color: colors.primary }]}>#{item.id || item.location_id}</Text><Text style={[styles.time, { color: colors.textSecondary }]}>{new Date(timestamp * 1000).toLocaleTimeString()}</Text>@@ -93,133 +83,92 @@ const LocationItem = memo(({ item, colors, isQueue }: LocationItemProps) => {</Text><View style={[styles.metricsGrid, { borderTopColor: colors.border }]}>- <Metric- label="Altitude"- value={`${item.altitude?.toFixed(1) ?? 0}m`}- colors={colors}- />- <Metric- label="Speed"- value={`${item.speed?.toFixed(1) ?? 0}m/s`}- colors={colors}- />- <Metric- label="Accuracy"- value={`±${item.accuracy?.toFixed(1) ?? 0}m`}- colors={colors}- />- <Metric- label="Bearing"- value={`${item.bearing?.toFixed(0) ?? 0}°`}- colors={colors}- />+ <Metric label="Altitude" value={`${item.altitude?.toFixed(1) ?? 0}m`} colors={colors} />+ <Metric label="Speed" value={`${item.speed?.toFixed(1) ?? 0}m/s`} colors={colors} />+ <Metric label="Accuracy" value={`±${item.accuracy?.toFixed(1) ?? 0}m`} colors={colors} />+ <Metric label="Bearing" value={`${item.bearing?.toFixed(0) ?? 0}°`} colors={colors} /></View>- <View- style={[- styles.metricsGrid,- styles.batteryGrid,- { borderTopColor: colors.border },- ]}- >+ <View style={[styles.metricsGrid, styles.batteryGrid, { borderTopColor: colors.border }]}><Metric label="Battery" value={`${item.battery}%`} colors={colors} />- <Metric- label="Battery Status"- value={getBatteryStatus(item.battery_status)}- colors={colors}- />+ <Metric label="Battery Status" value={getBatteryStatus(item.battery_status)} colors={colors} /><View style={styles.spacer} /><View style={styles.spacer} /></View>{isQueue && item.last_error && (- <Text style={[styles.errorText, { color: colors.error }]}>- ⚠ {item.last_error}- </Text>+ <Text style={[styles.errorText, { color: colors.error }]}>⚠ {item.last_error}</Text>)}</Card>- );-});+ )+})-LocationItem.displayName = "LocationItem";+LocationItem.displayName = "LocationItem"export function LocationInspectorScreen() {- const { colors } = useTheme();- const [activeTable, setActiveTable] = useState<TableType>("locations");- const [data, setData] = useState<LocationData[]>([]);- const [limit, setLimit] = useState(50);- const [page, setPage] = useState(0);- const [autoRefresh, setAutoRefresh] = useState(false);- const refreshInterval = useRef<ReturnType<typeof setInterval> | null>(null);+ const { colors } = useTheme()+ const [activeTable, setActiveTable] = useState<TableType>("locations")+ const [data, setData] = useState<LocationData[]>([])+ const [limit, setLimit] = useState(50)+ const [page, setPage] = useState(0)+ const [autoRefresh, setAutoRefresh] = useState(false)+ const refreshInterval = useRef<ReturnType<typeof setInterval> | null>(null)/** Fetches data based on current pagination and table selection */const fetchData = useCallback(async () => {try {- const offset = page * limit;- const result = await NativeLocationService.getTableData(- activeTable,- limit,- offset- );- setData(result || []);+ const offset = page * limit+ const result = await NativeLocationService.getTableData(activeTable, limit, offset)+ setData(result || [])} catch (err) {- console.error("[LocationInspector] Fetch error:", err);- setData([]);+ console.error("[LocationInspector] Fetch error:", err)+ setData([])}- }, [activeTable, limit, page]);+ }, [activeTable, limit, page])/** Fetch data when dependencies change */useEffect(() => {- fetchData();- }, [fetchData]);+ fetchData()+ }, [fetchData])/** Auto-refresh logic */useEffect(() => {if (autoRefresh) {- setPage(0); // Always show newest data in live mode- refreshInterval.current = setInterval(fetchData, 3000);+ setPage(0) // Always show newest data in live mode+ refreshInterval.current = setInterval(fetchData, 3000)} else {if (refreshInterval.current) {- clearInterval(refreshInterval.current);+ clearInterval(refreshInterval.current)}}return () => {if (refreshInterval.current) {- clearInterval(refreshInterval.current);+ clearInterval(refreshInterval.current)}- };- }, [autoRefresh, fetchData]);+ }+ }, [autoRefresh, fetchData])const handleTableChange = (table: TableType) => {- setActiveTable(table);- setPage(0);- };+ setActiveTable(table)+ setPage(0)+ }const handleLimitChange = (newLimit: number) => {- setLimit(newLimit);- setPage(0);- };+ setLimit(newLimit)+ setPage(0)+ }return (<Container>{/* Header with Live Mode Toggle */}<View style={styles.headerRow}>- <Text- style={[- styles.statusText,- { color: autoRefresh ? colors.primary : colors.textSecondary },- ]}- >+ <Text style={[styles.statusText, { color: autoRefresh ? colors.primary : colors.textSecondary }]}>{autoRefresh ? "● Live Mode" : "Manual Mode"}</Text><View style={styles.controls}><View style={styles.toggleContainer}>- <Text- style={[styles.controlLabel, { color: colors.textSecondary }]}- >- LIVE- </Text>+ <Text style={[styles.controlLabel, { color: colors.textSecondary }]}>LIVE</Text><Switchvalue={autoRefresh}onValueChange={setAutoRefresh}@@ -234,14 +183,12 @@ export function LocationInspectorScreen() {styles.refreshBtn,{backgroundColor: colors.card,- borderColor: colors.border,+ borderColor: colors.border},- autoRefresh && styles.refreshBtnDisabled,+ autoRefresh && styles.refreshBtnDisabled]}>- <Text style={[styles.btnText, { color: colors.primary }]}>- Refresh- </Text>+ <Text style={[styles.btnText, { color: colors.primary }]}>Refresh</Text></TouchableOpacity></View></View>@@ -257,18 +204,11 @@ export function LocationInspectorScreen() {styles.limitBtn,{backgroundColor: limit === v ? colors.primary : colors.card,- borderColor: colors.border,- },+ borderColor: colors.border+ }]}>- <Text- style={[- styles.limitBtnText,- { color: limit === v ? "#fff" : colors.text },- ]}- >- {v}- </Text>+ <Text style={[styles.limitBtnText, { color: limit === v ? "#fff" : colors.text }]}>{v}</Text></TouchableOpacity>))}</View>@@ -284,16 +224,14 @@ export function LocationInspectorScreen() {style={[styles.pageBtnText,{- color: page === 0 ? colors.textDisabled : colors.primary,- },+ color: page === 0 ? colors.textDisabled : colors.primary+ }]}>◀</Text></TouchableOpacity>- <Text style={[styles.pageIndicator, { color: colors.text }]}>- {page + 1}- </Text>+ <Text style={[styles.pageIndicator, { color: colors.text }]}>{page + 1}</Text><TouchableOpacityonPress={() => setPage((p) => p + 1)}disabled={data.length < limit}@@ -303,11 +241,8 @@ export function LocationInspectorScreen() {style={[styles.pageBtnText,{- color:- data.length < limit- ? colors.textDisabled- : colors.primary,- },+ color: data.length < limit ? colors.textDisabled : colors.primary+ }]}>▶@@ -338,61 +273,36 @@ export function LocationInspectorScreen() {data={data}contentContainerStyle={styles.listContent}keyExtractor={(item, index) => `${activeTable}-${item.id || index}`}- ListEmptyComponent={- <Text style={[styles.emptyText, { color: colors.textLight }]}>- No data available- </Text>- }- renderItem={({ item }) => (- <LocationItem- item={item}- colors={colors}- isQueue={activeTable === "queue"}- />- )}+ ListEmptyComponent={<Text style={[styles.emptyText, { color: colors.textLight }]}>No data available</Text>}+ renderItem={({ item }) => <LocationItem item={item} colors={colors} isQueue={activeTable === "queue"} />}initialNumToRender={10}maxToRenderPerBatch={10}windowSize={5}/></Container>- );+ )}// Subcomponentsconst Metric = ({ label, value, colors }: MetricProps) => (<View style={styles.metricItem}>- <Text style={[styles.metricLabel, { color: colors.textSecondary }]}>- {label}- </Text>+ <Text style={[styles.metricLabel, { color: colors.textSecondary }]}>{label}</Text><Text style={[styles.metricValue, { color: colors.text }]}>{value}</Text></View>-);+)const Tab = ({ label, active, onPress, colors }: TabProps) => {- const borderBottomColor = active ? colors.primary : "transparent";- const textColor = active ? colors.primary : colors.textSecondary;+ const borderBottomColor = active ? colors.primary : "transparent"+ const textColor = active ? colors.primary : colors.textSecondaryreturn (- <TouchableOpacity- onPress={onPress}- style={[- styles.tab,- active ? styles.tabActive : styles.tabInactive,- { borderBottomColor },- ]}- >- <Text- style={[- styles.tabText,- active ? styles.tabTextActive : styles.tabTextInactive,- { color: textColor },- ]}- >+ <TouchableOpacity onPress={onPress} style={[styles.tab, { borderBottomColor }]}>+ <Text style={[styles.tabText, active ? styles.tabTextActive : styles.tabTextInactive, { color: textColor }]}>{label}</Text></TouchableOpacity>- );-};+ )+}const styles = StyleSheet.create({headerRow: {@@ -400,38 +310,38 @@ const styles = StyleSheet.create({justifyContent: "space-between",alignItems: "center",paddingHorizontal: 12,- paddingTop: 12,+ paddingTop: 12},statusText: {fontSize: 11,- fontWeight: "600",+ fontWeight: "600"},controls: {flexDirection: "row",- alignItems: "center",+ alignItems: "center"},toggleContainer: {flexDirection: "row",alignItems: "center",- marginRight: 12,+ marginRight: 12},controlLabel: {fontSize: 10,fontWeight: "700",- marginRight: 6,+ marginRight: 6},refreshBtn: {paddingVertical: 6,paddingHorizontal: 12,borderRadius: 6,- borderWidth: 1,+ borderWidth: 1},refreshBtnDisabled: {- opacity: 0.5,+ opacity: 0.5},btnText: {fontSize: 12,- fontWeight: "bold",+ fontWeight: "bold"},limitBar: {flexDirection: "row",@@ -439,125 +349,119 @@ const styles = StyleSheet.create({alignItems: "center",paddingHorizontal: 12,marginTop: 12,- marginBottom: 12,+ marginBottom: 12},limitOptions: {- flexDirection: "row",+ flexDirection: "row"},limitBtn: {paddingVertical: 6,paddingHorizontal: 12,borderRadius: 6,marginRight: 6,- borderWidth: 1,+ borderWidth: 1},limitBtnText: {fontSize: 12,- fontWeight: "600",+ fontWeight: "600"},paginationRow: {flexDirection: "row",- alignItems: "center",+ alignItems: "center"},pageBtn: {- padding: 8,+ padding: 8},pageBtnText: {fontWeight: "bold",- fontSize: 16,+ fontSize: 16},pageIndicator: {fontSize: 14,fontWeight: "bold",- marginHorizontal: 8,+ marginHorizontal: 8},tabBar: {flexDirection: "row",- marginBottom: 12,+ marginBottom: 12},tab: {flex: 1,alignItems: "center",padding: 12,- borderBottomWidth: 2,- },- tabActive: {- // Additional styles for active tab if needed- },- tabInactive: {- // Additional styles for inactive tab if needed+ borderBottomWidth: 2},tabText: {- fontSize: 14,+ fontSize: 14},tabTextActive: {- fontWeight: "700",+ fontWeight: "700"},tabTextInactive: {- fontWeight: "400",+ fontWeight: "400"},listContent: {paddingHorizontal: 12,- paddingBottom: 20,+ paddingBottom: 20},itemCard: {marginBottom: 10,- padding: 12,+ padding: 12},row: {flexDirection: "row",justifyContent: "space-between",- marginBottom: 6,+ marginBottom: 6},id: {fontWeight: "bold",- fontSize: 12,+ fontSize: 12},time: {- fontSize: 11,+ fontSize: 11},coords: {fontFamily: "monospace",fontSize: 15,fontWeight: "600",- marginBottom: 8,+ marginBottom: 8},metricsGrid: {flexDirection: "row",justifyContent: "space-between",borderTopWidth: StyleSheet.hairlineWidth,paddingTop: 8,- marginTop: 4,+ marginTop: 4},batteryGrid: {paddingTop: 6,- marginTop: 2,+ marginTop: 2},metricItem: {flex: 1,- alignItems: "flex-start",+ alignItems: "flex-start"},metricLabel: {fontSize: 9,fontWeight: "bold",- textTransform: "uppercase",+ textTransform: "uppercase"},metricValue: {fontSize: 12,- marginTop: 2,+ marginTop: 2},spacer: {- flex: 1,+ flex: 1},emptyText: {textAlign: "center",marginTop: 40,fontSize: 14,- fontStyle: "italic",+ fontStyle: "italic"},errorText: {fontSize: 11,marginTop: 8,- fontStyle: "italic",- },-});+ fontStyle: "italic"+ }+})diff --git a/src/screens/SettingsScreen.tsx b/src/screens/SettingsScreen.tsxindex 01da3010..8ffe2b4e 100644--- a/src/screens/SettingsScreen.tsx+++ b/src/screens/SettingsScreen.tsx@@ -3,71 +3,49 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import React, { useState, useCallback, useEffect, useRef } from "react";-import {- Text,- StyleSheet,- TextInput,- Switch,- View,- ScrollView,- TouchableOpacity,- Animated,-} from "react-native";-import {- ScreenProps,- TRACKING_PRESETS,- SyncPreset,- SelectablePreset,- Settings,-} from "../types/global";-import { useTheme } from "../hooks/useTheme";-import NativeLocationService from "../services/NativeLocationService";-import { useTracking } from "../contexts/TrackingProvider";-import { FloatingSaveIndicator } from "../components/ui/FloatingSaveIndicator";-import {- Button,- SectionTitle,- Card,- Container,- Divider,- Footer,-} from "../components";-import { StatsCard, PresetOption, NumericInput } from "../components";--const AUTOSAVE_DEBOUNCE_MS = 1500;+import React, { useState, useCallback, useEffect, useRef } from "react"+import { Text, StyleSheet, TextInput, Switch, View, ScrollView, TouchableOpacity } from "react-native"+import { ScreenProps, TRACKING_PRESETS, SyncPreset, SelectablePreset, Settings } from "../types/global"+import { useTheme } from "../hooks/useTheme"+import NativeLocationService from "../services/NativeLocationService"+import { useTracking } from "../contexts/TrackingProvider"+import { FloatingSaveIndicator } from "../components/ui/FloatingSaveIndicator"+import { Button, SectionTitle, Card, Container, Divider, Footer } from "../components"+import { StatsCard, PresetOption, NumericInput } from "../components"++const AUTOSAVE_DEBOUNCE_MS = 1500function isPrivateHost(url: string) {try {// Strip protocol- const stripped = url.replace(/^https?:\/\//, "").split(/[/?#]/)[0];+ const stripped = url.replace(/^https?:\/\//, "").split(/[/?#]/)[0]// Extract host (before any port)- const host = stripped.split(":")[0];+ const host = stripped.split(":")[0]// Validate host: must be valid IP or hostnameconst ipRegex =- /^(127\.0\.0\.1|10\.(\d{1,3}\.){2}\d{1,3}|192\.168\.(\d{1,3}\.)\d{1,3}|172\.(1[6-9]|2\d|3[0-1])\.(\d{1,3}\.)\d{1,3})$/;- const hostnameRegex = /^localhost$/;+ /^(127\.0\.0\.1|10\.(\d{1,3}\.){2}\d{1,3}|192\.168\.(\d{1,3}\.)\d{1,3}|172\.(1[6-9]|2\d|3[0-1])\.(\d{1,3}\.)\d{1,3})$/+ const hostnameRegex = /^localhost$/- return ipRegex.test(host) || hostnameRegex.test(host);+ return ipRegex.test(host) || hostnameRegex.test(host)} catch {- return false;+ return false}}function isEndpointAllowed(url: string) {- if (!url) return false;+ if (!url) return false- const match = url.match(/^(https?):\/\/([^/:]+)(:\d+)?/);- if (!match) return false;+ const match = url.match(/^(https?):\/\/([^/:]+)(:\d+)?/)+ if (!match) return false- const protocol = match[1]; // http or https- const host = match[2];+ const protocol = match[1] // http or https+ const host = match[2]- if (protocol === "https") return true;- if (protocol === "http" && isPrivateHost(host)) return true;+ if (protocol === "https") return true+ if (protocol === "http" && isPrivateHost(host)) return true- return false;+ return false}/**@@ -75,277 +53,233 @@ function isEndpointAllowed(url: string) {* Features auto-save, presets, and advanced customization.*/export function SettingsScreen({ navigation }: ScreenProps) {- const { settings, setSettings, restartTracking } = useTracking();- const { mode, toggleTheme, colors } = useTheme();+ const { settings, setSettings, restartTracking } = useTracking()+ const { mode, toggleTheme, colors } = useTheme()// Stats- const [queueCount, setQueueCount] = useState(0);- const [sentCount, setSentCount] = useState(0);+ const [queueCount, setQueueCount] = useState(0)+ const [sentCount, setSentCount] = useState(0)// Inputs- const [intervalInput, setIntervalInput] = useState(- settings.interval.toString()- );- const [endpointInput, setEndpointInput] = useState(settings.endpoint || "");- const [distanceInput, setDistanceInput] = useState(- settings.distance?.toString() || "0"- );- const [accuracyTresholdInput, setAccuracyTresholdInput] = useState(- settings.accuracyThreshold.toString()- );+ const [intervalInput, setIntervalInput] = useState(settings.interval.toString())+ const [endpointInput, setEndpointInput] = useState(settings.endpoint || "")+ const [distanceInput, setDistanceInput] = useState(settings.distance?.toString() || "0")+ const [accuracyTresholdInput, setAccuracyTresholdInput] = useState(settings.accuracyThreshold.toString())// UI State- const [testing, setTesting] = useState(false);- const [testResponse, setTestResponse] = useState<string | null>(null);- const [testError, setTestError] = useState(false);- const [saving, setSaving] = useState(false);- const [saveSuccess, setSaveSuccess] = useState(false);- const [showAdvanced, setShowAdvanced] = useState(false);+ const [testing, setTesting] = useState(false)+ const [testResponse, setTestResponse] = useState<string | null>(null)+ const [testError, setTestError] = useState(false)+ const [saving, setSaving] = useState(false)+ const [saveSuccess, setSaveSuccess] = useState(false)+ const [showAdvanced, setShowAdvanced] = useState(false)- const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const advancedHeight = useRef(new Animated.Value(0)).current;+ const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)+ const restartTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)// Sync inputs with settings changesuseEffect(() => {- setIntervalInput(settings.interval.toString());- setDistanceInput(settings.distance?.toString() || "0");- setEndpointInput(settings.endpoint || "");- }, [- settings.interval,- settings.distance,- settings.endpoint,- settings.accuracyThreshold,- ]);-- // Animate advanced panel- useEffect(() => {- Animated.spring(advancedHeight, {- toValue: showAdvanced ? 1 : 0,- useNativeDriver: false,- tension: 50,- friction: 10,- }).start();- }, [showAdvanced, advancedHeight]);+ setIntervalInput(settings.interval.toString())+ setDistanceInput(settings.distance?.toString() || "0")+ setEndpointInput(settings.endpoint || "")+ }, [settings.interval, settings.distance, settings.endpoint, settings.accuracyThreshold])/** Update stats */const updateStats = useCallback(async () => {try {- const stats = await NativeLocationService.getStats();- setQueueCount(stats.queued);- setSentCount(stats.sent);+ const stats = await NativeLocationService.getStats()+ setQueueCount(stats.queued)+ setSentCount(stats.sent)} catch (err) {- console.error("[SettingsScreen] Failed to get stats:", err);+ console.error("[SettingsScreen] Failed to get stats:", err)}- }, []);+ }, [])/** Persist settings to SQLite and schedule a debounced restart */const saveAndRestart = useCallback(async (newSettings: Settings) => {- setSaving(true);+ setSaving(true)try {- await setSettings(newSettings);+ await setSettings(newSettings)} catch (err) {- console.error("[SettingsScreen] Save failed", err);+ console.error("[SettingsScreen] Save failed", err)}// Debounce the restart — only fires once after settings stabilize- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)restartTimeoutRef.current = setTimeout(async () => {try {- await restartTracking(newSettings);- setSaveSuccess(true);- setTimeout(() => setSaveSuccess(false), 2000);+ await restartTracking(newSettings)+ setSaveSuccess(true)+ setTimeout(() => setSaveSuccess(false), 2000)} catch (err) {- console.error("[SettingsScreen] Restart failed", err);+ console.error("[SettingsScreen] Restart failed", err)} finally {- setSaving(false);+ setSaving(false)}- }, AUTOSAVE_DEBOUNCE_MS);+ }, AUTOSAVE_DEBOUNCE_MS)},[setSettings, restartTracking]- );+ )const debouncedSave = useCallback((newSettings: Settings) => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveTimeoutRef.current = setTimeout(- () => saveAndRestart(newSettings),- AUTOSAVE_DEBOUNCE_MS- );+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveTimeoutRef.current = setTimeout(() => saveAndRestart(newSettings), AUTOSAVE_DEBOUNCE_MS)},[saveAndRestart]- );+ )const immediateSave = useCallback((newSettings: Settings) => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- saveAndRestart(newSettings);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ saveAndRestart(newSettings)},[saveAndRestart]- );+ )// Poll stats every 5 secondsuseEffect(() => {- updateStats();- const interval = setInterval(updateStats, 5000);- return () => clearInterval(interval);- }, [updateStats]);+ updateStats()+ const interval = setInterval(updateStats, 5000)+ return () => clearInterval(interval)+ }, [updateStats])// CleanupuseEffect(() => {return () => {- if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current);- if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current);- };- }, []);+ if (saveTimeoutRef.current) clearTimeout(saveTimeoutRef.current)+ if (restartTimeoutRef.current) clearTimeout(restartTimeoutRef.current)+ }+ }, [])/** Generic numeric input handler */const handleNumericChange = useCallback(- (- key: "interval" | "distance" | "accuracyTreshold",- value: string,- min: number = 0- ) => {- if (key === "interval") setIntervalInput(value);- if (key === "distance") setDistanceInput(value);- if (key === "accuracyTreshold") setAccuracyTresholdInput(value);-- const num = Number(value);+ (key: "interval" | "distance" | "accuracyTreshold", value: string, min: number = 0) => {+ if (key === "interval") setIntervalInput(value)+ if (key === "distance") setDistanceInput(value)+ if (key === "accuracyTreshold") setAccuracyTresholdInput(value)++ const num = Number(value)if (!isNaN(num) && num >= min) {- const next = { ...settings, [key]: num, syncPreset: "custom" as const };- setSettings(next);- debouncedSave(next);+ const next = { ...settings, [key]: num, syncPreset: "custom" as const }+ setSettings(next)+ debouncedSave(next)}},[settings, setSettings, debouncedSave]- );+ )/** Ensure valid numbers on blur */const handleNumericBlur = useCallback((key: "interval" | "distance" | "accuracyTreshold", min: number = 0) => {- const currentStr =- key === "interval"- ? intervalInput- : key === "distance"- ? distanceInput- : accuracyTresholdInput;- let val = Number(currentStr);+ const currentStr = key === "interval" ? intervalInput : key === "distance" ? distanceInput : accuracyTresholdInput+ let val = Number(currentStr)if (isNaN(val) || val < min) {- val = min;- if (key === "interval") setIntervalInput(min.toString());- if (key === "distance") setDistanceInput(min.toString());- if (key === "accuracyTreshold")- setAccuracyTresholdInput(min.toString());-- const next = { ...settings, [key]: val };- setSettings(next);- immediateSave(next);+ val = min+ if (key === "interval") setIntervalInput(min.toString())+ if (key === "distance") setDistanceInput(min.toString())+ if (key === "accuracyTreshold") setAccuracyTresholdInput(min.toString())++ const next = { ...settings, [key]: val }+ setSettings(next)+ immediateSave(next)}},- [- intervalInput,- distanceInput,- accuracyTresholdInput,- settings,- setSettings,- immediateSave,- ]- );+ [intervalInput, distanceInput, accuracyTresholdInput, settings, setSettings, immediateSave]+ )const handlePresetSelect = useCallback(async (preset: SyncPreset) => {if (preset === "custom") {- const next = { ...settings, syncPreset: "custom" as const };- setSettings(next);- immediateSave(next);- return;+ const next = { ...settings, syncPreset: "custom" as const }+ setSettings(next)+ immediateSave(next)+ return}- const config = TRACKING_PRESETS[preset];+ const config = TRACKING_PRESETS[preset]const next: Settings = {...settings,syncPreset: preset,interval: config.interval,distance: config.distance,syncInterval: config.syncInterval,- retryInterval: config.retryInterval,- };+ retryInterval: config.retryInterval+ }- immediateSave(next);+ immediateSave(next)},[settings, setSettings, immediateSave]- );+ )const handleTestEndpoint = useCallback(async () => {- if (!endpointInput) return;- setTesting(true);- setTestResponse(null);- setTestError(false);+ if (!endpointInput) return+ setTesting(true)+ setTestResponse(null)+ setTestError(false)try {- const recentLocation =- await NativeLocationService.getMostRecentLocation();+ const recentLocation = await NativeLocationService.getMostRecentLocation()if (!recentLocation) {- setTestResponse("No location available yet. Start tracking first.");- setTestError(true);- return;+ setTestResponse("No location available yet. Start tracking first.")+ setTestError(true)+ return}- const fieldMap = settings.fieldMap;+ const fieldMap = settings.fieldMapconst payload: Record<string, number | boolean> = {[fieldMap.lat]: recentLocation.latitude,[fieldMap.lon]: recentLocation.longitude,- [fieldMap.acc]: Math.round(recentLocation.accuracy),- };+ [fieldMap.acc]: Math.round(recentLocation.accuracy)+ }- if (fieldMap.alt) payload[fieldMap.alt] = 0;- if (fieldMap.vel) payload[fieldMap.vel] = 0;- if (fieldMap.batt) payload[fieldMap.batt] = 0;- if (fieldMap.bs) payload[fieldMap.bs] = 0;+ if (fieldMap.alt) payload[fieldMap.alt] = 0+ if (fieldMap.vel) payload[fieldMap.vel] = 0+ if (fieldMap.batt) payload[fieldMap.batt] = 0+ if (fieldMap.bs) payload[fieldMap.bs] = 0if (fieldMap.tst) {- payload[fieldMap.tst] = Math.floor(Date.now() / 1000);+ payload[fieldMap.tst] = Math.floor(Date.now() / 1000)}- let authHeaders: Record<string, string> = {};+ let authHeaders: Record<string, string> = {}try {- authHeaders = await NativeLocationService.getAuthHeaders();+ authHeaders = await NativeLocationService.getAuthHeaders()} catch {// proceed without auth headers}- console.log(payload);const response = await fetch(endpointInput, {method: "POST",headers: { "Content-Type": "application/json", ...authHeaders },- body: JSON.stringify(payload),- });+ body: JSON.stringify(payload)+ })if (response.ok) {- setTestResponse("✓ Connection successful");- const next = { ...settings, endpoint: endpointInput };- immediateSave(next);+ setTestResponse("✓ Connection successful")+ const next = { ...settings, endpoint: endpointInput }+ immediateSave(next)} else {- setTestResponse(`Failed: ${response.status}`);- setTestError(true);+ setTestResponse(`Failed: ${response.status}`)+ setTestError(true)}} catch (err: any) {- setTestResponse(err.message || "Connection failed");- setTestError(true);+ setTestResponse(err.message || "Connection failed")+ setTestError(true)} finally {- setTesting(false);- setTimeout(() => setTestResponse(null), 3000);+ setTesting(false)+ setTimeout(() => setTestResponse(null), 3000)}- }, [endpointInput, settings, immediateSave]);+ }, [endpointInput, settings, immediateSave])const handleOfflineModeChange = useCallback((enabled: boolean) => {- const next = { ...settings, isOfflineMode: enabled };- immediateSave(next);+ const next = { ...settings, isOfflineMode: enabled }+ immediateSave(next)},[settings, immediateSave]- );+ )return (<Container>@@ -376,21 +310,15 @@ export function SettingsScreen({ navigation }: ScreenProps) {{/* Offline Mode - Better visual hierarchy */}<View style={styles.settingRow}><View style={styles.settingContent}>- <Text style={[styles.settingLabel, { color: colors.text }]}>- Offline Mode- </Text>- <Text- style={[styles.settingHint, { color: colors.textSecondary }]}- >- Save locally, no network sync- </Text>+ <Text style={[styles.settingLabel, { color: colors.text }]}>Offline Mode</Text>+ <Text style={[styles.settingHint, { color: colors.textSecondary }]}>Save locally, no network sync</Text></View><Switchvalue={settings.isOfflineMode}onValueChange={handleOfflineModeChange}trackColor={{false: colors.border,- true: colors.primary + "80",+ true: colors.primary + "80"}}thumbColor={settings.isOfflineMode ? colors.primary : "#f4f3f4"}/>@@ -403,35 +331,27 @@ export function SettingsScreen({ navigation }: ScreenProps) {{/* Endpoint - Improved spacing and visual design */}<View style={styles.inputGroup}><View style={styles.inputHeader}>- <Text style={[styles.inputLabel, { color: colors.text }]}>- Server Endpoint- </Text>+ <Text style={[styles.inputLabel, { color: colors.text }]}>Server Endpoint</Text>{endpointInput && (<Viewstyle={[styles.protocolBadge,{- backgroundColor: endpointInput.startsWith(- "https://"- )+ backgroundColor: endpointInput.startsWith("https://")? colors.success + "20"- : colors.warning + "20",- },+ : colors.warning + "20"+ }]}><Textstyle={[styles.protocolText,{- color: endpointInput.startsWith("https://")- ? colors.success- : colors.warning,- },+ color: endpointInput.startsWith("https://") ? colors.success : colors.warning+ }]}>- {endpointInput.startsWith("https://")- ? "HTTPS"- : "HTTP"}+ {endpointInput.startsWith("https://") ? "HTTPS" : "HTTP"}</Text></View>)}@@ -443,8 +363,8 @@ export function SettingsScreen({ navigation }: ScreenProps) {{borderColor: colors.border,color: colors.text,- backgroundColor: colors.background,- },+ backgroundColor: colors.background+ }]}value={endpointInput}onChangeText={setEndpointInput}@@ -456,14 +376,11 @@ export function SettingsScreen({ navigation }: ScreenProps) {/>{/* Inline warning for non-private HTTP */}- {endpointInput.startsWith("http://") &&- !isPrivateHost(endpointInput) && (- <Text- style={[styles.httpWarning, { color: colors.warning }]}- >- HTTP only allowed for private IPs / localhost- </Text>- )}+ {endpointInput.startsWith("http://") && !isPrivateHost(endpointInput) && (+ <Text style={[styles.httpWarning, { color: colors.warning }]}>+ HTTP only allowed for private IPs / localhost+ </Text>+ )}</View>{/* Test button with improved styling */}@@ -471,13 +388,11 @@ export function SettingsScreen({ navigation }: ScreenProps) {style={[styles.testButton,{ backgroundColor: colors.primary },- (!endpointInput || !isEndpointAllowed(endpointInput)) &&- styles.disabledButton,+ (!endpointInput || !isEndpointAllowed(endpointInput)) && styles.disabledButton]}onPress={() => {- if (!endpointInput || !isEndpointAllowed(endpointInput))- return; // prevent action- handleTestEndpoint();+ if (!endpointInput || !isEndpointAllowed(endpointInput)) return // prevent action+ handleTestEndpoint()}}title={testing ? "Testing..." : "Test Connection"}color="#f8f7f7"@@ -490,17 +405,11 @@ export function SettingsScreen({ navigation }: ScreenProps) {styles.responseBox,{borderColor: testError ? colors.error : colors.success,- backgroundColor:- (testError ? colors.error : colors.success) + "15",- },+ backgroundColor: (testError ? colors.error : colors.success) + "15"+ }]}>- <Text- style={[- styles.responseText,- { color: testError ? colors.error : colors.success },- ]}- >+ <Text style={[styles.responseText, { color: testError ? colors.error : colors.success }]}>{testResponse}</Text></View>@@ -514,18 +423,12 @@ export function SettingsScreen({ navigation }: ScreenProps) {activeOpacity={0.6}><View style={styles.linkContent}>- <Text style={[styles.linkLabel, { color: colors.text }]}>- Authentication & Headers- </Text>- <Text- style={[styles.linkSub, { color: colors.textSecondary }]}- >+ <Text style={[styles.linkLabel, { color: colors.text }]}>Authentication & Headers</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>Basic auth, bearer tokens, custom headers</Text></View>- <Text style={[styles.linkArrow, { color: colors.textLight }]}>- ›- </Text>+ <Text style={[styles.linkArrow, { color: colors.textLight }]}>›</Text></TouchableOpacity></>)}@@ -538,33 +441,27 @@ export function SettingsScreen({ navigation }: ScreenProps) {<Card>{/* Presets with improved spacing */}<View style={styles.presetsContainer}>- {(Object.keys(TRACKING_PRESETS) as SelectablePreset[]).map(- (preset, index) => (- <View key={preset}>- <PresetOption- preset={preset}- isSelected={settings.syncPreset === preset}- onSelect={handlePresetSelect}- colors={colors}- />- {index < Object.keys(TRACKING_PRESETS).length - 1 && (- <View style={styles.presetSpacer} />- )}- </View>- )- )}+ {(Object.keys(TRACKING_PRESETS) as SelectablePreset[]).map((preset, index) => (+ <View key={preset}>+ <PresetOption+ preset={preset}+ isSelected={settings.syncPreset === preset}+ onSelect={handlePresetSelect}+ colors={colors}+ />+ {index < Object.keys(TRACKING_PRESETS).length - 1 && <View style={styles.presetSpacer} />}+ </View>+ ))}</View>{/* Advanced Toggle - Better button design */}<TouchableOpacitystyle={[styles.advancedToggle,- showAdvanced- ? styles.advancedToggleActive- : styles.advancedToggleInactive,+ showAdvanced ? styles.advancedToggleActive : styles.advancedToggleInactive,{- borderColor: showAdvanced ? colors.primary : colors.border,- },+ borderColor: showAdvanced ? colors.primary : colors.border+ }]}onPress={() => setShowAdvanced(!showAdvanced)}activeOpacity={0.7}@@ -585,25 +482,17 @@ export function SettingsScreen({ navigation }: ScreenProps) {styles.customBanner,{backgroundColor: colors.info + "15",- borderLeftColor: colors.info,- },+ borderLeftColor: colors.info+ }]}>- <Text- style={[styles.customBannerText, { color: colors.info }]}- >- 💡 Using custom configuration- </Text>+ <Text style={[styles.customBannerText, { color: colors.info }]}>💡 Using custom configuration</Text></View>)}{/* Tracking Parameters Group */}<View style={styles.paramGroup}>- <Text- style={[styles.paramGroupTitle, { color: colors.text }]}- >- Tracking Parameters- </Text>+ <Text style={[styles.paramGroupTitle, { color: colors.text }]}>Tracking Parameters</Text><NumericInputlabel="Tracking Interval"@@ -632,23 +521,12 @@ export function SettingsScreen({ navigation }: ScreenProps) {{/* Network Parameters Group */}<View style={styles.paramGroup}>- <Text- style={[styles.paramGroupTitle, { color: colors.text }]}- >- Network Settings- </Text>+ <Text style={[styles.paramGroupTitle, { color: colors.text }]}>Network Settings</Text>{/* Sync Interval */}<View style={styles.settingBlock}>- <Text style={[styles.blockLabel, { color: colors.text }]}>- Sync Interval- </Text>- <Text- style={[- styles.blockHint,- { color: colors.textSecondary },- ]}- >+ <Text style={[styles.blockLabel, { color: colors.text }]}>Sync Interval</Text>+ <Text style={[styles.blockHint, { color: colors.textSecondary }]}>How often to upload data to server</Text>@@ -658,9 +536,9 @@ export function SettingsScreen({ navigation }: ScreenProps) {0: "Instant",60: "1 min",300: "5 min",- 900: "15 min",- };- const isSelected = settings.syncInterval === sec;+ 900: "15 min"+ }+ const isSelected = settings.syncInterval === secreturn (<TouchableOpacity@@ -669,21 +547,21 @@ export function SettingsScreen({ navigation }: ScreenProps) {styles.gridOption,{borderColor: colors.border,- backgroundColor: colors.background,+ backgroundColor: colors.background},isSelected && {borderColor: colors.primary,- backgroundColor: colors.primary + "20",- },+ backgroundColor: colors.primary + "20"+ }]}onPress={() => {const next = {...settings,syncInterval: sec,- syncPreset: "custom" as const,- };- setSettings(next);- debouncedSave(next);+ syncPreset: "custom" as const+ }+ setSettings(next)+ debouncedSave(next)}}activeOpacity={0.7}>@@ -691,31 +569,22 @@ export function SettingsScreen({ navigation }: ScreenProps) {style={[styles.gridLabel,{- color: isSelected- ? colors.primary- : colors.text,- },+ color: isSelected ? colors.primary : colors.text+ }]}>{labels[sec]}</Text></TouchableOpacity>- );+ )})}</View></View>{/* Retry Interval */}<View style={styles.settingBlock}>- <Text style={[styles.blockLabel, { color: colors.text }]}>- Retry Interval- </Text>- <Text- style={[- styles.blockHint,- { color: colors.textSecondary },- ]}- >+ <Text style={[styles.blockLabel, { color: colors.text }]}>Retry Interval</Text>+ <Text style={[styles.blockHint, { color: colors.textSecondary }]}>Wait time before retrying failed uploads</Text>@@ -724,9 +593,9 @@ export function SettingsScreen({ navigation }: ScreenProps) {const labels: Record<number, string> = {30: "30s",300: "5m",- 900: "15m",- };- const isSelected = settings.retryInterval === sec;+ 900: "15m"+ }+ const isSelected = settings.retryInterval === secreturn (<TouchableOpacity@@ -735,21 +604,21 @@ export function SettingsScreen({ navigation }: ScreenProps) {styles.gridOption,{borderColor: colors.border,- backgroundColor: colors.background,+ backgroundColor: colors.background},isSelected && {borderColor: colors.primary,- backgroundColor: colors.primary + "20",- },+ backgroundColor: colors.primary + "20"+ }]}onPress={() => {const next = {...settings,retryInterval: sec,- syncPreset: "custom" as const,- };- setSettings(next);- debouncedSave(next);+ syncPreset: "custom" as const+ }+ setSettings(next)+ debouncedSave(next)}}activeOpacity={0.7}>@@ -757,25 +626,21 @@ export function SettingsScreen({ navigation }: ScreenProps) {style={[styles.gridLabel,{- color: isSelected- ? colors.primary- : colors.text,- },+ color: isSelected ? colors.primary : colors.text+ }]}>{labels[sec]}</Text></TouchableOpacity>- );+ )})}</View></View>{/* Max Retries */}<View style={styles.settingBlock}>- <Text style={[styles.blockLabel, { color: colors.text }]}>- Max Retry Attempts- </Text>+ <Text style={[styles.blockLabel, { color: colors.text }]}>Max Retry Attempts</Text><View style={styles.retryGrid}>{[3, 5, 10, 0].map((val) => (<TouchableOpacity@@ -784,21 +649,21 @@ export function SettingsScreen({ navigation }: ScreenProps) {styles.retryChip,{borderColor: colors.border,- backgroundColor: colors.background,+ backgroundColor: colors.background},settings.maxRetries === val && {borderColor: colors.primary,- backgroundColor: colors.primary + "20",- },+ backgroundColor: colors.primary + "20"+ }]}onPress={() => {const next = {...settings,maxRetries: val,- syncPreset: "custom" as const,- };- setSettings(next);- debouncedSave(next);+ syncPreset: "custom" as const+ }+ setSettings(next)+ debouncedSave(next)}}activeOpacity={0.7}>@@ -806,11 +671,8 @@ export function SettingsScreen({ navigation }: ScreenProps) {style={[styles.retryChipText,{- color:- settings.maxRetries === val- ? colors.primary- : colors.text,- },+ color: settings.maxRetries === val ? colors.primary : colors.text+ }]}>{val === 0 ? "∞" : val}@@ -818,13 +680,7 @@ export function SettingsScreen({ navigation }: ScreenProps) {</TouchableOpacity>))}</View>- <Text- style={[- styles.blockHint,- styles.retryHint,- { color: colors.textSecondary },- ]}- >+ <Text style={[styles.blockHint, styles.retryHint, { color: colors.textSecondary }]}>{settings.maxRetries === 0? "⚠️ Unlimited retries may cause queue buildup": `Give up after ${settings.maxRetries} failed attempts`}@@ -836,26 +692,13 @@ export function SettingsScreen({ navigation }: ScreenProps) {{/* Quality Parameters Group */}<View style={styles.paramGroup}>- <Text- style={[styles.paramGroupTitle, { color: colors.text }]}- >- Quality Filters- </Text>+ <Text style={[styles.paramGroupTitle, { color: colors.text }]}>Quality Filters</Text>{/* Accuracy Filter */}<View style={styles.settingRow}><View style={styles.settingContent}>- <Text- style={[styles.settingLabel, { color: colors.text }]}- >- Filter Inaccurate Locations- </Text>- <Text- style={[- styles.settingHint,- { color: colors.textSecondary },- ]}- >+ <Text style={[styles.settingLabel, { color: colors.text }]}>Filter Inaccurate Locations</Text>+ <Text style={[styles.settingHint, { color: colors.textSecondary }]}>Reject low-accuracy GPS readings</Text></View>@@ -864,18 +707,14 @@ export function SettingsScreen({ navigation }: ScreenProps) {onValueChange={(value) =>immediateSave({...settings,- filterInaccurateLocations: value,+ filterInaccurateLocations: value})}trackColor={{false: colors.border,- true: colors.primary + "80",+ true: colors.primary + "80"}}- thumbColor={- settings.filterInaccurateLocations- ? colors.primary- : "#f4f3f4"- }+ thumbColor={settings.filterInaccurateLocations ? colors.primary : "#f4f3f4"}/></View>@@ -884,9 +723,7 @@ export function SettingsScreen({ navigation }: ScreenProps) {<NumericInputlabel="Accuracy Threshold"value={accuracyTresholdInput}- onChange={(val) =>- handleNumericChange("accuracyTreshold", val, 50)- }+ onChange={(val) => handleNumericChange("accuracyTreshold", val, 50)}onBlur={() => handleNumericBlur("accuracyTreshold", 50)}unit="meters"placeholder="50"@@ -907,16 +744,14 @@ export function SettingsScreen({ navigation }: ScreenProps) {<Card><View style={styles.settingRow}><View style={styles.settingContent}>- <Text style={[styles.settingLabel, { color: colors.text }]}>- Dark Mode- </Text>+ <Text style={[styles.settingLabel, { color: colors.text }]}>Dark Mode</Text></View><Switchvalue={mode === "dark"}onValueChange={toggleTheme}trackColor={{false: colors.border,- true: colors.primary + "80",+ true: colors.primary + "80"}}thumbColor={mode === "dark" ? colors.primary : "#f4f3f4"}/>@@ -934,16 +769,10 @@ export function SettingsScreen({ navigation }: ScreenProps) {activeOpacity={0.6}><View style={styles.linkContent}>- <Text style={[styles.linkLabel, { color: colors.text }]}>- Data Management- </Text>- <Text style={[styles.linkSub, { color: colors.textSecondary }]}>- View queu and clear data- </Text>+ <Text style={[styles.linkLabel, { color: colors.text }]}>Data Management</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>View queue and clear data</Text></View>- <Text style={[styles.linkArrow, { color: colors.textLight }]}>- ›- </Text>+ <Text style={[styles.linkArrow, { color: colors.textLight }]}>›</Text></TouchableOpacity><Divider />@@ -954,16 +783,10 @@ export function SettingsScreen({ navigation }: ScreenProps) {activeOpacity={0.6}><View style={styles.linkContent}>- <Text style={[styles.linkLabel, { color: colors.text }]}>- API Field Mapping- </Text>- <Text style={[styles.linkSub, { color: colors.textSecondary }]}>- Customize JSON payload structure- </Text>+ <Text style={[styles.linkLabel, { color: colors.text }]}>API Field Mapping</Text>+ <Text style={[styles.linkSub, { color: colors.textSecondary }]}>Customize JSON payload structure</Text></View>- <Text style={[styles.linkArrow, { color: colors.textLight }]}>- ›- </Text>+ <Text style={[styles.linkArrow, { color: colors.textLight }]}>›</Text></TouchableOpacity></Card></View>@@ -972,104 +795,100 @@ export function SettingsScreen({ navigation }: ScreenProps) {<Footer /></ScrollView>- <FloatingSaveIndicator- saving={saving}- success={saveSuccess}- colors={colors}- />+ <FloatingSaveIndicator saving={saving} success={saveSuccess} colors={colors} /></Container>- );+ )}const styles = StyleSheet.create({scrollContent: {paddingHorizontal: 20,paddingTop: 16,- paddingBottom: 40,+ paddingBottom: 40},header: {- marginBottom: 20,+ marginBottom: 20},title: {fontSize: 28,fontWeight: "700",- letterSpacing: -0.5,+ letterSpacing: -0.5},section: {- marginBottom: 24,+ marginBottom: 24},settingRow: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- paddingVertical: 4,+ paddingVertical: 4},settingContent: {flex: 1,- marginRight: 16,+ marginRight: 16},settingLabel: {fontSize: 16,fontWeight: "600",- marginBottom: 2,+ marginBottom: 2},settingHint: {fontSize: 13,- lineHeight: 18,+ lineHeight: 18},inputGroup: {- marginBottom: 12,+ marginBottom: 12},inputHeader: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- marginBottom: 10,+ marginBottom: 10},inputLabel: {fontSize: 15,- fontWeight: "600",+ fontWeight: "600"},protocolBadge: {paddingHorizontal: 10,paddingVertical: 4,- borderRadius: 12,+ borderRadius: 12},protocolText: {fontSize: 11,- fontWeight: "700",+ fontWeight: "700"},input: {borderWidth: 1.5,padding: 16,borderRadius: 12,- fontSize: 15,+ fontSize: 15},testButton: {padding: 16,borderRadius: 12,alignItems: "center",- marginTop: 12,+ marginTop: 12},disabledButton: {- opacity: 0.5,+ opacity: 0.5},responseBox: {marginTop: 12,padding: 14,borderWidth: 1.5,borderRadius: 12,- alignItems: "center",+ alignItems: "center"},responseText: {fontSize: 14,- fontWeight: "600",+ fontWeight: "600"},presetsContainer: {- marginBottom: 16,+ marginBottom: 16},presetSpacer: {- height: 8,+ height: 8},advancedToggle: {paddingVertical: 14,@@ -1077,33 +896,33 @@ const styles = StyleSheet.create({alignItems: "center",borderRadius: 12,borderWidth: 1.5,- marginTop: 8,+ marginTop: 8},advancedToggleActive: {- backgroundColor: "transparent",+ backgroundColor: "transparent"},advancedToggleInactive: {- backgroundColor: "transparent",+ backgroundColor: "transparent"},advancedText: {fontSize: 15,- fontWeight: "600",+ fontWeight: "600"},advancedPanel: {- marginTop: 16,+ marginTop: 16},customBanner: {padding: 14,borderRadius: 10,marginBottom: 20,- borderLeftWidth: 4,+ borderLeftWidth: 4},customBannerText: {fontSize: 13,- fontWeight: "500",+ fontWeight: "500"},paramGroup: {- marginBottom: 4,+ marginBottom: 4},paramGroupTitle: {fontSize: 13,@@ -1111,86 +930,86 @@ const styles = StyleSheet.create({textTransform: "uppercase",letterSpacing: 1,marginBottom: 16,- opacity: 0.6,+ opacity: 0.6},settingBlock: {- marginBottom: 20,+ marginBottom: 20},blockLabel: {fontSize: 15,fontWeight: "600",- marginBottom: 4,+ marginBottom: 4},blockHint: {fontSize: 13,marginBottom: 12,- lineHeight: 18,+ lineHeight: 18},optionsGrid: {flexDirection: "row",gap: 8,- flexWrap: "wrap",+ flexWrap: "wrap"},gridOption: {minWidth: "22%",borderWidth: 2,borderRadius: 10,paddingVertical: 14,- alignItems: "center",+ alignItems: "center"},gridLabel: {fontSize: 14,- fontWeight: "600",+ fontWeight: "600"},retryGrid: {flexDirection: "row",- gap: 10,+ gap: 10},retryChip: {flex: 1,borderWidth: 2,borderRadius: 10,paddingVertical: 12,- alignItems: "center",+ alignItems: "center"},retryChipText: {fontSize: 16,- fontWeight: "700",+ fontWeight: "700"},retryHint: {- marginTop: 8,+ marginTop: 8},nestedSetting: {marginTop: 12,paddingLeft: 16,borderLeftWidth: 3,- borderLeftColor: "rgba(0,0,0,0.1)",+ borderLeftColor: "rgba(0,0,0,0.1)"},linkRow: {flexDirection: "row",justifyContent: "space-between",alignItems: "center",- paddingVertical: 12,+ paddingVertical: 12},linkContent: {- flex: 1,+ flex: 1},linkLabel: {fontSize: 16,fontWeight: "600",- marginBottom: 2,+ marginBottom: 2},linkSub: {- fontSize: 13,+ fontSize: 13},linkArrow: {fontSize: 28,fontWeight: "300",- marginLeft: 12,+ marginLeft: 12},httpWarning: {marginTop: 6,fontSize: 12,- fontWeight: "500",- },-});+ fontWeight: "500"+ }+})diff --git a/src/screens/index.ts b/src/screens/index.tsindex 82293c46..54741d81 100644--- a/src/screens/index.ts+++ b/src/screens/index.ts@@ -3,12 +3,12 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-export { ApiSettingsScreen } from "./ApiSettingsScreen";-export { AuthSettingsScreen } from "./AuthSettingsScreen";-export { DashboardScreen } from "./DashboardScreen";-export { DataManagementScreen } from "./DataManagementScreen";-export { ExportDataScreen } from "./ExportDataScreen";-export { GeofenceScreen } from "./GeofenceScreen";-export { LocationInspectorScreen } from "./LocationInspectorScreen";-export { SettingsScreen } from "./SettingsScreen";-export { AboutScreen } from "./AboutScreen";+export { ApiSettingsScreen } from "./ApiSettingsScreen"+export { AuthSettingsScreen } from "./AuthSettingsScreen"+export { DashboardScreen } from "./DashboardScreen"+export { DataManagementScreen } from "./DataManagementScreen"+export { ExportDataScreen } from "./ExportDataScreen"+export { GeofenceScreen } from "./GeofenceScreen"+export { LocationInspectorScreen } from "./LocationInspectorScreen"+export { SettingsScreen } from "./SettingsScreen"+export { AboutScreen } from "./AboutScreen"diff --git a/src/services/LocationServicePermission.ts b/src/services/LocationServicePermission.tsindex a7775725..698c90d8 100644--- a/src/services/LocationServicePermission.ts+++ b/src/services/LocationServicePermission.ts@@ -3,24 +3,24 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { Platform, PermissionsAndroid, Alert } from "react-native";-import NativeLocationService from "./NativeLocationService";+import { Platform, PermissionsAndroid, Alert } from "react-native"+import NativeLocationService from "./NativeLocationService"/*** Permission status for location tracking*/export interface PermissionStatus {- location: boolean;- background: boolean;- notifications: boolean;- batteryOptimized: boolean;+ location: boolean+ background: boolean+ notifications: boolean+ batteryOptimized: boolean}/** Android version for background location (Android 10) */-const ANDROID_10 = 29;+const ANDROID_10 = 29/** Android version for notifications (Android 13) */-const ANDROID_13 = 33;+const ANDROID_13 = 33/*** Requests all necessary permissions for location tracking.@@ -43,34 +43,30 @@ const ANDROID_13 = 33;* ```*/export async function ensurePermissions(): Promise<boolean> {- if (Platform.OS !== "android") return true;+ if (Platform.OS !== "android") return truetry {// 1. Fine location (required)- if (!(await requestFineLocation())) return false;+ if (!(await requestFineLocation())) return false// 2. Background location (Android 10+)if (Platform.Version >= ANDROID_10) {- if (!(await requestBackgroundLocation())) return false;+ if (!(await requestBackgroundLocation())) return false}// 3. Notifications (Android 13+)if (Platform.Version >= ANDROID_13) {- if (!(await requestNotificationPermission())) return false;+ if (!(await requestNotificationPermission())) return false}// 4. Battery optimization exemption (optional but recommended)- await requestBatteryOptimizationExemption();+ await requestBatteryOptimizationExemption()- return true;+ return true} catch (err) {- console.error("[PermissionService] Permission request error:", err);- Alert.alert(- "Permission Error",- "Failed to request permissions. Please try again.",- [{ text: "OK" }]- );- return false;+ console.error("[PermissionService] Permission request error:", err)+ Alert.alert("Permission Error", "Failed to request permissions. Please try again.", [{ text: "OK" }])+ return false}}@@ -78,80 +74,66 @@ export async function ensurePermissions(): Promise<boolean> {* Requests fine location permission*/async function requestFineLocation(): Promise<boolean> {- const result = await PermissionsAndroid.request(- PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,- {- title: "Location Permission",- message: "Colota needs access to your location to track your position.",- buttonPositive: "Allow",- buttonNegative: "Deny",- }- );+ const result = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, {+ title: "Location Permission",+ message: "Colota needs access to your location to track your position.",+ buttonPositive: "Allow",+ buttonNegative: "Deny"+ })if (result !== PermissionsAndroid.RESULTS.GRANTED) {- Alert.alert(- "Permission Required",- "Location permission is required for this app to function.",- [{ text: "OK" }]- );- return false;+ Alert.alert("Permission Required", "Location permission is required for this app to function.", [{ text: "OK" }])+ return false}- return true;+ return true}/*** Requests background location permission (Android 10+)*/async function requestBackgroundLocation(): Promise<boolean> {- const result = await PermissionsAndroid.request(- PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,- {- title: "Background Location Permission",- message:- "To track your location continuously, Colota needs permission to access your location in the background, even when you are not actively using it.",- buttonPositive: "Allow",- buttonNegative: "Deny",- }- );+ const result = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION, {+ title: "Background Location Permission",+ message:+ "To track your location continuously, Colota needs permission to access your location in the background, even when you are not actively using it.",+ buttonPositive: "Allow",+ buttonNegative: "Deny"+ })if (result !== PermissionsAndroid.RESULTS.GRANTED) {Alert.alert("Background Permission Denied","Background location permission is needed for continuous tracking. The app may stop when closed or in the background.",[{ text: "OK" }]- );- return false;+ )+ return false}- return true;+ return true}/*** Requests notification permission (Android 13+)*/async function requestNotificationPermission(): Promise<boolean> {- const result = await PermissionsAndroid.request(- PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS,- {- title: "Notification Permission",- message:- "Colota needs permission to show notifications while tracking your location.",- buttonPositive: "Allow",- buttonNegative: "Deny",- }- );+ const result = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS, {+ title: "Notification Permission",+ message: "Colota needs permission to show notifications while tracking your location.",+ buttonPositive: "Allow",+ buttonNegative: "Deny"+ })if (result !== PermissionsAndroid.RESULTS.GRANTED) {Alert.alert("Notification Permission Denied","Without notification permission, you will not see tracking status updates.",[{ text: "OK" }]- );- return false;+ )+ return false}- return true;+ return true}/**@@ -159,16 +141,12 @@ async function requestNotificationPermission(): Promise<boolean> {*/async function requestBatteryOptimizationExemption(): Promise<void> {try {- const isOptimized =- await NativeLocationService.isIgnoringBatteryOptimizations();+ const isOptimized = await NativeLocationService.isIgnoringBatteryOptimizations()if (!isOptimized) {- await NativeLocationService.requestIgnoreBatteryOptimizations();+ await NativeLocationService.requestIgnoreBatteryOptimizations()}} catch (err) {- console.error(- "[PermissionService] Battery optimization request failed:",- err- );+ console.error("[PermissionService] Battery optimization request failed:", err)// Non-critical, don't block}}@@ -190,65 +168,56 @@ export async function checkPermissions(): Promise<PermissionStatus> {location: true,background: true,notifications: true,- batteryOptimized: true,- };+ batteryOptimized: true+ }}- const [location, background, notifications, batteryOptimized] =- await Promise.all([- checkFineLocation(),- checkBackgroundLocation(),- checkNotifications(),- checkBatteryOptimization(),- ]);+ const [location, background, notifications, batteryOptimized] = await Promise.all([+ checkFineLocation(),+ checkBackgroundLocation(),+ checkNotifications(),+ checkBatteryOptimization()+ ])return {location,background,notifications,- batteryOptimized,- };+ batteryOptimized+ }}/*** Check fine location permission*/async function checkFineLocation(): Promise<boolean> {- return await PermissionsAndroid.check(- PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION- );+ return await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION)}/*** Gets Android version as a number*/function getAndroidVersion(): number {- if (Platform.OS !== "android") return 0;- return typeof Platform.Version === "number"- ? Platform.Version- : parseInt(Platform.Version, 10) || 0;+ if (Platform.OS !== "android") return 0+ return typeof Platform.Version === "number" ? Platform.Version : parseInt(Platform.Version, 10) || 0}/*** Check background location permission (Android 10+)*/async function checkBackgroundLocation(): Promise<boolean> {- if (getAndroidVersion() < ANDROID_10) return true;+ if (getAndroidVersion() < ANDROID_10) return true- return await PermissionsAndroid.check(- PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION- );+ return await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION)}/*** Check notification permission (Android 13+)*/async function checkNotifications(): Promise<boolean> {- if (getAndroidVersion() < ANDROID_13) return true;+ if (getAndroidVersion() < ANDROID_13) return true- return await PermissionsAndroid.check(- PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS- );+ return await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS)}/**@@ -256,48 +225,9 @@ async function checkNotifications(): Promise<boolean> {*/async function checkBatteryOptimization(): Promise<boolean> {try {- return await NativeLocationService.isIgnoringBatteryOptimizations();+ return await NativeLocationService.isIgnoringBatteryOptimizations()} catch (err) {- console.error(- "[PermissionService] Battery optimization check failed:",- err- );- return false;+ console.error("[PermissionService] Battery optimization check failed:", err)+ return false}}--/**- * Checks if all required permissions are granted.- */-export async function hasAllPermissions(): Promise<boolean> {- const status = await checkPermissions();- return (- status.location &&- status.background &&- status.notifications &&- status.batteryOptimized- );-}--/**- * Gets list of missing permission names.- *- * @example- * ```ts- * const missing = await getMissingPermissions();- * if (missing.length > 0) {- * console.log(`Missing: ${missing.join(', ')}`);- * }- * ```- */-export async function getMissingPermissions(): Promise<string[]> {- const status = await checkPermissions();- const missing: string[] = [];-- if (!status.location) missing.push("Location");- if (!status.background) missing.push("Background Location");- if (!status.notifications) missing.push("Notifications");- if (!status.batteryOptimized) missing.push("Battery Optimization");-- return missing;-}diff --git a/src/services/NativeLocationService.ts b/src/services/NativeLocationService.tsindex 94e48726..a02fbe0e 100644--- a/src/services/NativeLocationService.ts+++ b/src/services/NativeLocationService.ts@@ -3,10 +3,10 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { NativeModules } from "react-native";-import { AuthConfig, DatabaseStats, Geofence, Settings } from "../types/global";+import { NativeModules } from "react-native"+import { AuthConfig, DatabaseStats, Geofence, Settings } from "../types/global"-const { LocationServiceModule, BuildConfigModule } = NativeModules;+const { LocationServiceModule, BuildConfigModule } = NativeModules/*** Native location service bridge.@@ -24,25 +24,19 @@ class NativeLocationService {*/private static ensureModule(): void {if (!LocationServiceModule) {- throw new Error(- "[NativeLocationService] Module not available. Check native linking."- );+ throw new Error("[NativeLocationService] Module not available. Check native linking.")}}/*** Wraps async native calls with error handling*/- private static async safeExecute<T>(- operation: () => Promise<T>,- fallback: T,- errorPrefix: string- ): Promise<T> {+ private static async safeExecute<T>(operation: () => Promise<T>, fallback: T, errorPrefix: string): Promise<T> {try {- return await operation();+ return await operation()} catch (error) {- console.error(`[NativeLocationService] ${errorPrefix}:`, error);- return fallback;+ console.error(`[NativeLocationService] ${errorPrefix}:`, error)+ return fallback}}@@ -55,7 +49,7 @@ class NativeLocationService {* @param settings Configuration for GPS polling and data transmission*/static async start(settings: Settings): Promise<void> {- this.ensureModule();+ this.ensureModule()const config = {interval: settings.interval * 1000, // s → ms@@ -67,19 +61,19 @@ class NativeLocationService {maxRetries: settings.maxRetries,filterInaccurateLocations: settings.filterInaccurateLocations,accuracyThreshold: settings.accuracyThreshold,- isOfflineMode: settings.isOfflineMode,- };+ isOfflineMode: settings.isOfflineMode+ }console.log(`[NativeLocationService] Starting service - interval: ${settings.interval}s, distance: ${settings.distance}m, sync: ${settings.syncInterval}s`- );+ )try {- await LocationServiceModule.startService(config);- console.log("[NativeLocationService] Service started");+ await LocationServiceModule.startService(config)+ console.log("[NativeLocationService] Service started")} catch (error) {- console.error("[NativeLocationService] Start failed:", error);- throw error;+ console.error("[NativeLocationService] Start failed:", error)+ throw error}}@@ -88,33 +82,29 @@ class NativeLocationService {*/static stop(): void {if (!LocationServiceModule) {- console.warn("[NativeLocationService] Module not available");- return;+ console.warn("[NativeLocationService] Module not available")+ return}- console.log("[NativeLocationService] Stopping service");- LocationServiceModule.stopService();+ console.log("[NativeLocationService] Stopping service")+ LocationServiceModule.stopService()}/*** Checks if the foreground service is currently running*/static async isServiceRunning(): Promise<boolean> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.isServiceRunning(),- false,- "isServiceRunning failed"- );+ this.ensureModule()+ return this.safeExecute(() => LocationServiceModule.isServiceRunning(), false, "isServiceRunning failed")}/*** Checks if tracking is enabled (from persistent settings)*/static async isTrackingActive(): Promise<boolean> {- this.ensureModule();- const state = await this.getSetting("tracking_enabled", "false");- return state === "true";+ this.ensureModule()+ const state = await this.getSetting("tracking_enabled", "false")+ return state === "true"}// ============================================================================@@ -126,15 +116,15 @@ class NativeLocationService {* @returns True if flush succeeded*/static async manualFlush(): Promise<boolean> {- this.ensureModule();- console.log("[NativeLocationService] Triggering manual flush");+ this.ensureModule()+ console.log("[NativeLocationService] Triggering manual flush")try {- const result = await LocationServiceModule.manualFlush();- console.log("[NativeLocationService] Flush completed");- return result;+ const result = await LocationServiceModule.manualFlush()+ console.log("[NativeLocationService] Flush completed")+ return result} catch (error) {- console.error("[NativeLocationService] Flush failed:", error);- throw error;+ console.error("[NativeLocationService] Flush failed:", error)+ throw error}}@@ -148,97 +138,41 @@ class NativeLocationService {* @param limit Maximum rows to return* @param offset Pagination offset*/- static async getTableData(- tableName: string,- limit: number,- offset: number = 0- ): Promise<any[]> {- this.ensureModule();+ static async getTableData(tableName: string, limit: number, offset: number = 0): Promise<any[]> {+ this.ensureModule()return this.safeExecute(() => LocationServiceModule.getTableData(tableName, limit, offset),[],`getTableData(${tableName}) failed`- );+ )}/*** Returns database health summary*/static async getStats(): Promise<DatabaseStats> {- this.ensureModule();- return LocationServiceModule.getStats();- }-- /**- * Gets count of locations waiting for transmission- */- static async getQueuedCount(): Promise<number> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getQueuedLocationsCount(),- 0,- "getQueuedCount failed"- );- }-- /**- * Gets count of successfully sent locations- */- static async getSentCount(): Promise<number> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getSentCount(),- 0,- "getSentCount failed"- );- }-- /**- * Gets count of locations captured today- */- static async getTodayCount(): Promise<number> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getTodayCount(),- 0,- "getTodayCount failed"- );- }-- /**- * Gets database file size in bytes- */- static async getDatabaseSize(): Promise<number> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getDatabaseSize(),- 0,- "getDatabaseSize failed"- );+ this.ensureModule()+ return LocationServiceModule.getStats()}/*** Fetches all locations for export*/static async getExportData(): Promise<any[]> {- this.ensureModule();+ this.ensureModule()return this.safeExecute(() => LocationServiceModule.getTableData("locations", 1000000, 0),[],"getExportData failed"- );+ )}/*** Gets the most recent location from the database*/static async getMostRecentLocation(): Promise<any | null> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getMostRecentLocation(),- null,- "getMostRecentLocation failed"- );+ this.ensureModule()+ return this.safeExecute(() => LocationServiceModule.getMostRecentLocation(), null, "getMostRecentLocation failed")}// ============================================================================@@ -249,9 +183,9 @@ class NativeLocationService {* Deletes all successfully sent locations*/static async clearSentHistory(): Promise<void> {- this.ensureModule();- console.log("[NativeLocationService] Clearing sent history");- await LocationServiceModule.clearSentHistory();+ this.ensureModule()+ console.log("[NativeLocationService] Clearing sent history")+ await LocationServiceModule.clearSentHistory()}/**@@ -259,9 +193,9 @@ class NativeLocationService {* @returns Count of deleted records*/static async clearQueue(): Promise<number> {- this.ensureModule();- console.log("[NativeLocationService] Clearing queue");- return LocationServiceModule.clearQueue();+ this.ensureModule()+ console.log("[NativeLocationService] Clearing queue")+ return LocationServiceModule.clearQueue()}/**@@ -269,9 +203,9 @@ class NativeLocationService {* @returns Count of deleted records*/static async clearAllLocations(): Promise<number> {- this.ensureModule();- console.log("[NativeLocationService] Clearing all locations");- return LocationServiceModule.clearAllLocations();+ this.ensureModule()+ console.log("[NativeLocationService] Clearing all locations")+ return LocationServiceModule.clearAllLocations()}/**@@ -280,20 +214,18 @@ class NativeLocationService {* @returns Count of deleted records*/static async deleteOlderThan(days: number): Promise<number> {- this.ensureModule();- console.log(- `[NativeLocationService] Deleting locations older than ${days} days`- );- return LocationServiceModule.deleteOlderThan(days);+ this.ensureModule()+ console.log(`[NativeLocationService] Deleting locations older than ${days} days`)+ return LocationServiceModule.deleteOlderThan(days)}/*** Runs SQLite VACUUM to reclaim disk space*/static async vacuumDatabase(): Promise<void> {- this.ensureModule();- console.log("[NativeLocationService] Vacuuming database");- await LocationServiceModule.vacuumDatabase();+ this.ensureModule()+ console.log("[NativeLocationService] Vacuuming database")+ await LocationServiceModule.vacuumDatabase()}// ============================================================================@@ -304,45 +236,37 @@ class NativeLocationService {* Fetches all geofences*/static async getGeofences(): Promise<Geofence[]> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getGeofences(),- [],- "getGeofences failed"- );+ this.ensureModule()+ return this.safeExecute(() => LocationServiceModule.getGeofences(), [], "getGeofences failed")}/*** Creates a new geofence* @returns Geofence ID*/- static async createGeofence(- geofence: Omit<Geofence, "id" | "createdAt">- ): Promise<number> {- this.ensureModule();- console.log("[NativeLocationService] Creating geofence:", geofence.name);+ static async createGeofence(geofence: Omit<Geofence, "id" | "createdAt">): Promise<number> {+ this.ensureModule()+ console.log("[NativeLocationService] Creating geofence:", geofence.name)return LocationServiceModule.createGeofence(geofence.name,geofence.lat,geofence.lon,geofence.radius,geofence.pauseTracking- );+ )}/*** Updates an existing geofence (partial updates supported)*/- static async updateGeofence(- update: Partial<Geofence> & { id: number }- ): Promise<boolean> {- this.ensureModule();+ static async updateGeofence(update: Partial<Geofence> & { id: number }): Promise<boolean> {+ this.ensureModule()if (!update.id) {- throw new Error("Geofence ID is required");+ throw new Error("Geofence ID is required")}- console.log("[NativeLocationService] Updating geofence:", update.id);+ console.log("[NativeLocationService] Updating geofence:", update.id)return LocationServiceModule.updateGeofence(update.id,update.name ?? null,@@ -351,16 +275,16 @@ class NativeLocationService {update.radius ?? null,update.enabled ?? null,update.pauseTracking ?? null- );+ )}/*** Deletes a geofence*/static async deleteGeofence(id: number): Promise<boolean> {- this.ensureModule();- console.log("[NativeLocationService] Deleting geofence:", id);- return LocationServiceModule.deleteGeofence(id);+ this.ensureModule()+ console.log("[NativeLocationService] Deleting geofence:", id)+ return LocationServiceModule.deleteGeofence(id)}/**@@ -368,12 +292,8 @@ class NativeLocationService {* @returns Silent zone name or null*/static async checkCurrentSilentZone(): Promise<string | null> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.checkCurrentSilentZone(),- null,- "checkCurrentSilentZone failed"- );+ this.ensureModule()+ return this.safeExecute(() => LocationServiceModule.checkCurrentSilentZone(), null, "checkCurrentSilentZone failed")}/**@@ -381,12 +301,12 @@ class NativeLocationService {* Use after modifying geofence pause settings to update notification instantly*/static async recheckZoneSettings(): Promise<void> {- this.ensureModule();- console.log("[NativeLocationService] Triggering zone settings recheck");+ this.ensureModule()+ console.log("[NativeLocationService] Triggering zone settings recheck")try {- await LocationServiceModule.recheckZoneSettings();+ await LocationServiceModule.recheckZoneSettings()} catch (error) {- console.error("[NativeLocationService] ❌ Recheck failed:", error);+ console.error("[NativeLocationService] ❌ Recheck failed:", error)}}@@ -398,31 +318,24 @@ class NativeLocationService {* Saves a persistent setting*/static async saveSetting(key: string, value: string): Promise<void> {- this.ensureModule();- await LocationServiceModule.saveSetting(key, value);+ this.ensureModule()+ await LocationServiceModule.saveSetting(key, value)}/*** Retrieves a setting by key*/- static async getSetting(- key: string,- defaultValue: string = ""- ): Promise<string | null> {- this.ensureModule();- return LocationServiceModule.getSetting(key, defaultValue || null);+ static async getSetting(key: string, defaultValue: string = ""): Promise<string | null> {+ this.ensureModule()+ return LocationServiceModule.getSetting(key, defaultValue || null)}/*** Retrieves all settings as key-value pairs*/static async getAllSettings(): Promise<Record<string, string>> {- this.ensureModule();- return this.safeExecute(- () => LocationServiceModule.getAllSettings(),- {},- "getAllSettings failed"- );+ this.ensureModule()+ return this.safeExecute(() => LocationServiceModule.getAllSettings(), {}, "getAllSettings failed")}// ============================================================================@@ -433,12 +346,12 @@ class NativeLocationService {* Checks if app is exempt from battery optimization*/static async isIgnoringBatteryOptimizations(): Promise<boolean> {- this.ensureModule();+ this.ensureModule()return this.safeExecute(() => LocationServiceModule.isIgnoringBatteryOptimizations(),false,"isIgnoringBatteryOptimizations failed"- );+ )}/**@@ -446,15 +359,13 @@ class NativeLocationService {* Opens system dialog for user approval*/static async requestIgnoreBatteryOptimizations(): Promise<boolean> {- this.ensureModule();- console.log(- "[NativeLocationService] Requesting battery optimization exemption"- );+ this.ensureModule()+ console.log("[NativeLocationService] Requesting battery optimization exemption")return this.safeExecute(() => LocationServiceModule.requestIgnoreBatteryOptimizations(),false,"requestIgnoreBatteryOptimizations failed"- );+ )}// ============================================================================@@ -466,20 +377,20 @@ class NativeLocationService {* @returns Build config object with SDK versions, tools versions, etc.*/static getBuildConfig(): {- MIN_SDK_VERSION: number;- TARGET_SDK_VERSION: number;- COMPILE_SDK_VERSION: number;- BUILD_TOOLS_VERSION: string;- KOTLIN_VERSION: string;- NDK_VERSION: string;- VERSION_NAME: string;- VERSION_CODE: number;+ MIN_SDK_VERSION: number+ TARGET_SDK_VERSION: number+ COMPILE_SDK_VERSION: number+ BUILD_TOOLS_VERSION: string+ KOTLIN_VERSION: string+ NDK_VERSION: string+ VERSION_NAME: string+ VERSION_CODE: number} | null {if (!BuildConfigModule) {- console.warn("[NativeLocationService] BuildConfigModule not available");- return null;+ console.warn("[NativeLocationService] BuildConfigModule not available")+ return null}- return BuildConfigModule;+ return BuildConfigModule}// ============================================================================@@ -490,44 +401,16 @@ class NativeLocationService {* Get all device information at once*/static async getDeviceInfo(): Promise<{- model: string;- brand: string;- manufacturer: string;- device: string;- deviceId: string;- systemVersion: string;- apiLevel: number;+ model: string+ brand: string+ manufacturer: string+ device: string+ deviceId: string+ systemVersion: string+ apiLevel: number}> {- this.ensureModule();- return LocationServiceModule.getDeviceInfo();- }-- /**- * Individual getters (for drop-in replacement compatibility)- */- static async getSystemVersion(): Promise<string> {- this.ensureModule();- return LocationServiceModule.getSystemVersion();- }-- static async getApiLevel(): Promise<number> {- this.ensureModule();- return LocationServiceModule.getApiLevel();- }-- static async getModel(): Promise<string> {- this.ensureModule();- return LocationServiceModule.getModel();- }-- static async getBrand(): Promise<string> {- this.ensureModule();- return LocationServiceModule.getBrand();- }-- static async getDeviceId(): Promise<string> {- this.ensureModule();- return LocationServiceModule.getDeviceId();+ this.ensureModule()+ return LocationServiceModule.getDeviceInfo()}// ============================================================================@@ -538,36 +421,32 @@ class NativeLocationService {* Writes content to a file in cache directory*/static async writeFile(fileName: string, content: string): Promise<string> {- this.ensureModule();- return LocationServiceModule.writeFile(fileName, content);+ this.ensureModule()+ return LocationServiceModule.writeFile(fileName, content)}/*** Shares a file using native share sheet*/- static async shareFile(- filePath: string,- mimeType: string,- title: string- ): Promise<boolean> {- this.ensureModule();- return LocationServiceModule.shareFile(filePath, mimeType, title);+ static async shareFile(filePath: string, mimeType: string, title: string): Promise<boolean> {+ this.ensureModule()+ return LocationServiceModule.shareFile(filePath, mimeType, title)}/*** Deletes a file*/static async deleteFile(filePath: string): Promise<boolean> {- this.ensureModule();- return LocationServiceModule.deleteFile(filePath);+ this.ensureModule()+ return LocationServiceModule.deleteFile(filePath)}/*** Gets cache directory path*/static async getCacheDirectory(): Promise<string> {- this.ensureModule();- return LocationServiceModule.getCacheDirectory();+ this.ensureModule()+ return LocationServiceModule.getCacheDirectory()}// ============================================================================@@ -578,38 +457,38 @@ class NativeLocationService {* Retrieves the full auth configuration from encrypted storage*/static async getAuthConfig(): Promise<AuthConfig> {- this.ensureModule();- const raw = await LocationServiceModule.getAllAuthConfig();+ this.ensureModule()+ const raw = await LocationServiceModule.getAllAuthConfig()return {authType: raw.authType || "none",username: raw.username || "",password: raw.password || "",bearerToken: raw.bearerToken || "",- customHeaders: raw.customHeaders ? JSON.parse(raw.customHeaders) : {},- };+ customHeaders: raw.customHeaders ? JSON.parse(raw.customHeaders) : {}+ }}/*** Saves auth configuration to encrypted storage*/static async saveAuthConfig(config: AuthConfig): Promise<boolean> {- this.ensureModule();+ this.ensureModule()return LocationServiceModule.saveAuthConfig({authType: config.authType,username: config.username,password: config.password,bearerToken: config.bearerToken,- customHeaders: JSON.stringify(config.customHeaders),- });+ customHeaders: JSON.stringify(config.customHeaders)+ })}/*** Returns computed auth + custom headers for HTTP requests*/static async getAuthHeaders(): Promise<Record<string, string>> {- this.ensureModule();- return LocationServiceModule.getAuthHeaders();+ this.ensureModule()+ return LocationServiceModule.getAuthHeaders()}}-export default NativeLocationService;+export default NativeLocationServicediff --git a/src/services/SettingsService.ts b/src/services/SettingsService.tsindex 253a303f..56fe26be 100644--- a/src/services/SettingsService.ts+++ b/src/services/SettingsService.ts@@ -3,8 +3,8 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import NativeLocationService from "./NativeLocationService";-import { Settings } from "../types/global";+import NativeLocationService from "./NativeLocationService"+import { Settings } from "../types/global"/*** Bridge between UI state and native SQLite configuration.@@ -17,54 +17,51 @@ export const SettingsService = {*/updateSetting: async (key: keyof Settings, value: any): Promise<boolean> => {try {- let stringValue: string;+ let stringValue: stringswitch (key) {case "interval":// UI: seconds → Native: milliseconds- stringValue = (Number(value) * 1000).toString();- break;+ stringValue = (Number(value) * 1000).toString()+ breakcase "fieldMap":case "customFields":// Object → JSON string- stringValue = JSON.stringify(value);- break;+ stringValue = JSON.stringify(value)+ breakcase "distance":// JS key: 'distance' → Native key: 'minUpdateDistance'- await NativeLocationService.saveSetting(- "minUpdateDistance",- value.toString()- );+ await NativeLocationService.saveSetting("minUpdateDistance", value.toString())// Also save as 'distance' for JS hydration- stringValue = value.toString();- break;+ stringValue = value.toString()+ breakcase "syncInterval":case "retryInterval":case "maxRetries":case "accuracyThreshold":// Already in correct format (numbers)- stringValue = String(value);- break;+ stringValue = String(value)+ breakcase "filterInaccurateLocations":case "isOfflineMode":// Boolean → "true"/"false"- stringValue = String(value);- break;+ stringValue = String(value)+ breakdefault:// Handles 'endpoint', 'syncPreset', etc.- stringValue = String(value);+ stringValue = String(value)}- await NativeLocationService.saveSetting(key, stringValue);- return true;+ await NativeLocationService.saveSetting(key, stringValue)+ return true} catch (err) {- console.error(`[SettingsService] Failed to save ${key}:`, err);- return false;+ console.error(`[SettingsService] Failed to save ${key}:`, err)+ return false}},@@ -72,16 +69,16 @@ export const SettingsService = {* Updates multiple settings in parallel*/updateMultiple: async (settingsUpdate: Partial<Settings>): Promise<void> => {- const keys = Object.keys(settingsUpdate);- console.log(`[SettingsService] Batch updating ${keys.length} settings`);+ const keys = Object.keys(settingsUpdate)+ console.log(`[SettingsService] Batch updating ${keys.length} settings`)const promises = Object.entries(settingsUpdate).map(([key, val]) =>SettingsService.updateSetting(key as keyof Settings, val)- );+ )- await Promise.all(promises);- console.log("[SettingsService] ✅ Batch update completed");- },-};+ await Promise.all(promises)+ console.log("[SettingsService] ✅ Batch update completed")+ }+}-export default SettingsService;+export default SettingsServicediff --git a/src/styles/colors.ts b/src/styles/colors.tsindex 3034ffe6..d30e4955 100644--- a/src/styles/colors.ts+++ b/src/styles/colors.ts@@ -3,7 +3,7 @@* Licensed under the GNU AGPLv3. See LICENSE in the project root for details.*/-import { ThemeColors } from "../types/global";+import { ThemeColors } from "../types/global"export const lightColors: ThemeColors = {// Brand (Deep Indigo for trust and uniqueness)@@ -55,8 +55,8 @@ export const lightColors: ThemeColors = {// Specialtransparent: "transparent",- borderRadius: 8,-};+ borderRadius: 8+}export const darkColors: ThemeColors = {// Brand@@ -108,5 +108,5 @@ export const darkColors: ThemeColors = {// Specialtransparent: "transparent",- borderRadius: 8,-};+ borderRadius: 8+}diff --git a/src/types/assets.d.ts b/src/types/assets.d.tsindex d7b3e08c..7be17ce0 100644--- a/src/types/assets.d.ts+++ b/src/types/assets.d.ts@@ -1,12 +1,12 @@declare module "*.png" {- const value: any;- export default value;+ const value: any+ export default value}declare module "*.css" {- const value: any;- export default value;+ const value: any+ export default value}declare module "*.js" {- const value: any;- export default value;+ const value: any+ export default value}diff --git a/src/types/global.ts b/src/types/global.tsindex c9115aac..88bee3d9 100644--- a/src/types/global.ts+++ b/src/types/global.ts@@ -8,64 +8,64 @@// ============================================================================export interface ScreenProps {- navigation: any;+ navigation: any}-export type ThemeMode = "light" | "dark";+export type ThemeMode = "light" | "dark"export interface ThemeColors {// Primary colors- primary: string;- primaryDark: string;- primaryLight: string;+ primary: string+ primaryDark: string+ primaryLight: string// Secondary colors- secondary: string;- secondaryDark: string;- secondaryLight: string;+ secondary: string+ secondaryDark: string+ secondaryLight: string// Semantic colors- success: string;- successDark: string;- successLight: string;- warning: string;- warningDark: string;- warningLight: string;- error: string;- errorDark: string;- errorLight: string;- info: string;- infoDark: string;- infoLight: string;+ success: string+ successDark: string+ successLight: string+ warning: string+ warningDark: string+ warningLight: string+ error: string+ errorDark: string+ errorLight: string+ info: string+ infoDark: string+ infoLight: string// Surfaces & backgrounds- background: string;- backgroundElevated: string;- card: string;- cardElevated: string;- surface: string;+ background: string+ backgroundElevated: string+ card: string+ cardElevated: string+ surface: string// Text colors- text: string;- textSecondary: string;- textLight: string;- textDisabled: string;+ text: string+ textSecondary: string+ textLight: string+ textDisabled: string// Borders & dividers- border: string;- borderLight: string;- divider: string;+ border: string+ borderLight: string+ divider: string// Interactive elements- placeholder: string;- link: string;- linkVisited: string;+ placeholder: string+ link: string+ linkVisited: string// Utility- overlay: string;- shadow: string;- transparent: string;- borderRadius: number;+ overlay: string+ shadow: string+ transparent: string+ borderRadius: number}// ============================================================================@@ -73,62 +73,62 @@ export interface ThemeColors {// ============================================================================export interface LocationCoords {- latitude: number;- longitude: number;- altitude?: number;- accuracy?: number;- speed?: number;- bearing?: number;- battery?: number;- battery_status?: number;- timestamp?: number;+ latitude: number+ longitude: number+ altitude?: number+ accuracy?: number+ speed?: number+ bearing?: number+ battery?: number+ battery_status?: number+ timestamp?: number}export interface Geofence {- id?: number;- name: string;- lat: number;- lon: number;- radius: number;- enabled: boolean;- pauseTracking: boolean;- createdAt?: number;+ id?: number+ name: string+ lat: number+ lon: number+ radius: number+ enabled: boolean+ pauseTracking: boolean+ createdAt?: number}/*** Result interface for location tracking hook*/export interface LocationTrackingResult {- coords: LocationCoords | null;- tracking: boolean;- startTracking: (overrideSettings?: Settings) => Promise<void>;- stopTracking: () => void;- restartTracking: (newSettings?: Settings) => Promise<void>;- reconnect: () => void;- settings: Settings;+ coords: LocationCoords | null+ tracking: boolean+ startTracking: (overrideSettings?: Settings) => Promise<void>+ stopTracking: () => void+ restartTracking: (newSettings?: Settings) => Promise<void>+ reconnect: () => void+ settings: Settings}// ============================================================================// API CONFIGURATION// ============================================================================-export type ServerStatus = "connected" | "error" | "notConfigured";+export type ServerStatus = "connected" | "error" | "notConfigured"export interface ServerConnectionProps {- endpoint: string | null;- navigation: any;+ endpoint: string | null+ navigation: any}export interface FieldMap {- lat: string;- lon: string;- acc: string;- alt?: string;- vel?: string;- batt?: string;- bs?: string;- tst?: string;- bear?: string;+ lat: string+ lon: string+ acc: string+ alt?: string+ vel?: string+ batt?: string+ bs?: string+ tst?: string+ bear?: string}export const DEFAULT_FIELD_MAP: FieldMap = {@@ -140,28 +140,25 @@ export const DEFAULT_FIELD_MAP: FieldMap = {batt: "batt",bs: "bs",tst: "tst",- bear: "bear",-} as const;+ bear: "bear"+} as constexport interface CustomField {- key: string;- value: string;+ key: string+ value: string}-export type ApiTemplateName = "custom" | "dawarich" | "owntracks" | "reitti";+export type ApiTemplateName = "custom" | "dawarich" | "owntracks" | "reitti"export interface ApiTemplate {- name: ApiTemplateName;- label: string;- description: string;- fieldMap: FieldMap;- customFields: CustomField[];+ name: ApiTemplateName+ label: string+ description: string+ fieldMap: FieldMap+ customFields: CustomField[]}-export const API_TEMPLATES: Record<- Exclude<ApiTemplateName, "custom">,- ApiTemplate-> = {+export const API_TEMPLATES: Record<Exclude<ApiTemplateName, "custom">, ApiTemplate> = {dawarich: {name: "dawarich",label: "Dawarich",@@ -175,9 +172,9 @@ export const API_TEMPLATES: Record<batt: "batt",bs: "bs",tst: "tst",- bear: "cog",+ bear: "cog"},- customFields: [{ key: "_type", value: "location" }],+ customFields: [{ key: "_type", value: "location" }]},owntracks: {name: "owntracks",@@ -192,12 +189,12 @@ export const API_TEMPLATES: Record<batt: "batt",bs: "bs",tst: "tst",- bear: "cog",+ bear: "cog"},customFields: [{ key: "_type", value: "location" },- { key: "tid", value: "AA" },- ],+ { key: "tid", value: "AA" }+ ]},reitti: {name: "reitti",@@ -212,27 +209,27 @@ export const API_TEMPLATES: Record<batt: "batt",bs: "bs",tst: "tst",- bear: "bear",+ bear: "bear"},- customFields: [{ key: "_type", value: "location" }],- },-};+ customFields: [{ key: "_type", value: "location" }]+ }+}// ============================================================================// PRESETS// ============================================================================-export type BatteryImpact = "Low" | "Medium" | "High";+export type BatteryImpact = "Low" | "Medium" | "High"export interface TrackingPresetConfig {- interval: number;- distance: number;- syncInterval: number;- retryInterval: number;- label: string;- emoji: string;- description: string;- batteryImpact: BatteryImpact;+ interval: number+ distance: number+ syncInterval: number+ retryInterval: number+ label: string+ emoji: string+ description: string+ batteryImpact: BatteryImpact}export const TRACKING_PRESETS = {@@ -244,7 +241,7 @@ export const TRACKING_PRESETS = {label: "Instant",emoji: "⚡",description: "Track every 5s • Send instantly",- batteryImpact: "High",+ batteryImpact: "High"},balanced: {interval: 30,@@ -254,7 +251,7 @@ export const TRACKING_PRESETS = {label: "Balanced",emoji: "⚖️",description: "Track every 30s • Batch 5 min",- batteryImpact: "Medium",+ batteryImpact: "Medium"},powersaver: {interval: 60,@@ -264,12 +261,12 @@ export const TRACKING_PRESETS = {label: "Power Saver",emoji: "🔋",description: "Track every 60s • Batch 15 min",- batteryImpact: "Low",- },-} as const satisfies Record<string, TrackingPresetConfig>;+ batteryImpact: "Low"+ }+} as const satisfies Record<string, TrackingPresetConfig>-export type SelectablePreset = keyof typeof TRACKING_PRESETS;-export type SyncPreset = SelectablePreset | "custom";+export type SelectablePreset = keyof typeof TRACKING_PRESETS+export type SyncPreset = SelectablePreset | "custom"// ============================================================================// SETTINGS@@ -277,25 +274,25 @@ export type SyncPreset = SelectablePreset | "custom";export interface Settings {// Tracking (GPS)- interval: number;- distance: number;- filterInaccurateLocations: boolean;- accuracyThreshold: number;+ interval: number+ distance: number+ filterInaccurateLocations: boolean+ accuracyThreshold: number// Endpoint & Mapping- endpoint: string;- fieldMap: FieldMap;- customFields: CustomField[];- apiTemplate: ApiTemplateName;+ endpoint: string+ fieldMap: FieldMap+ customFields: CustomField[]+ apiTemplate: ApiTemplateName// Sync & Upload- syncInterval: number;- retryInterval: number;- maxRetries: number;- isOfflineMode: boolean;+ syncInterval: number+ retryInterval: number+ maxRetries: number+ isOfflineMode: boolean// UI State- syncPreset: SyncPreset;+ syncPreset: SyncPreset}export const DEFAULT_SETTINGS: Settings = {@@ -311,21 +308,21 @@ export const DEFAULT_SETTINGS: Settings = {accuracyThreshold: 50,syncPreset: "instant",maxRetries: 5,- isOfflineMode: false,-} as const;+ isOfflineMode: false+} as const// ============================================================================// AUTHENTICATION// ============================================================================-export type AuthType = "none" | "basic" | "bearer";+export type AuthType = "none" | "basic" | "bearer"export interface AuthConfig {- authType: AuthType;- username: string;- password: string;- bearerToken: string;- customHeaders: Record<string, string>;+ authType: AuthType+ username: string+ password: string+ bearerToken: string+ customHeaders: Record<string, string>}export const DEFAULT_AUTH_CONFIG: AuthConfig = {@@ -333,61 +330,17 @@ export const DEFAULT_AUTH_CONFIG: AuthConfig = {username: "",password: "",bearerToken: "",- customHeaders: {},-};+ customHeaders: {}+}// ============================================================================// DATABASE// ============================================================================export interface DatabaseStats {- queued: number;- sent: number;- total: number;- today: number;- databaseSizeMB: number;+ queued: number+ sent: number+ total: number+ today: number+ databaseSizeMB: number}--// ============================================================================-// TYPE GUARDS-// ============================================================================--export const isValidCoords = (coords: unknown): coords is LocationCoords => {- if (typeof coords !== "object" || coords === null) return false;-- const c = coords as Partial<LocationCoords>;- return (- typeof c.latitude === "number" &&- typeof c.longitude === "number" &&- !isNaN(c.latitude) &&- !isNaN(c.longitude)- );-};--export const isValidSettings = (settings: unknown): settings is Settings => {- if (typeof settings !== "object" || settings === null) return false;-- const s = settings as Partial<Settings>;- return (- typeof s.interval === "number" &&- typeof s.endpoint === "string" &&- typeof s.syncInterval === "number" &&- typeof s.syncPreset === "string" &&- s.interval >= 0 &&- s.syncInterval >= 0- );-};--export const isValidFieldMap = (fieldMap: unknown): fieldMap is FieldMap => {- if (typeof fieldMap !== "object" || fieldMap === null) return false;-- const f = fieldMap as Partial<FieldMap>;- return (- typeof f.lat === "string" &&- typeof f.lon === "string" &&- typeof f.acc === "string" &&- f.lat.length > 0 &&- f.lon.length > 0 &&- f.acc.length > 0- );-};