2026-06-18 17:43:48 +02:00
|
|
|
/**
|
|
|
|
|
* Configuración de la app.
|
|
|
|
|
*
|
|
|
|
|
* BASE_URL: raíz de la API v1. En despliegue real apunta a `https://<host>/api/v1`.
|
|
|
|
|
* Ojo: desde un dispositivo físico/emulador "localhost" NO es la máquina de desarrollo:
|
|
|
|
|
* - Emulador Android: usa `http://10.0.2.2/...`
|
|
|
|
|
* - Dispositivo físico: usa la IP LAN del PC, p.ej. `http://192.168.1.50/...`
|
|
|
|
|
* Ajusta DEV_HOST a tu entorno o sobreescribe BASE_URL.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const DEV_HOST = 'http://10.0.2.2/construprogress/public';
|
|
|
|
|
|
|
|
|
|
export const BASE_URL = `${DEV_HOST}/api/v1`;
|
|
|
|
|
|
2026-06-18 18:30:44 +02:00
|
|
|
/** Raíz del host (para resolver URLs relativas de media, p.ej. `/storage/...`). */
|
|
|
|
|
export const ORIGIN = DEV_HOST;
|
|
|
|
|
|
|
|
|
|
/** Convierte una url de media (posiblemente relativa) en absoluta. */
|
|
|
|
|
export function absoluteUrl(url?: string | null): string | undefined {
|
|
|
|
|
if (!url) return undefined;
|
|
|
|
|
if (/^https?:\/\//i.test(url)) return url;
|
|
|
|
|
return `${ORIGIN}${url.startsWith('/') ? '' : '/'}${url}`;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-18 17:43:48 +02:00
|
|
|
/** Se envía en cada petición como cabecera X-App-Version (ver protocolo §7). */
|
|
|
|
|
export const APP_VERSION = '1.0.0';
|
|
|
|
|
|
|
|
|
|
/** Nombre de la BD SQLite local. */
|
|
|
|
|
export const DB_NAME = 'avante.db';
|
|
|
|
|
|
|
|
|
|
/** Ability que el backend exige al token (ver brief §2). */
|
|
|
|
|
export const TOKEN_ABILITY = 'mobile-sync';
|