Server heavy refactoring 4 (not functionnal)

This commit is contained in:
Sebastien Riviere
2026-03-12 23:17:21 +01:00
parent e1b6c0e0c5
commit 1389dce132
95 changed files with 5320 additions and 27986 deletions

View File

@@ -1,5 +1,5 @@
// Constants
import { SERVER_URL } from "@/constants";
import { SERVER_URL } from "@/config";
export const uploadTeamImage = async (id, imageUri) => {
if (!imageUri || !id) return;

View File

@@ -1,7 +1,7 @@
// Socket
import { io } from "socket.io-client";
// Constants
import { SOCKET_URL } from "@/constants";
import { SOCKET_URL } from "@/config";
export const socket = io(SOCKET_URL, {
path: "/back/socket.io"

View File

@@ -35,22 +35,14 @@ export const emitLogout = () => {
return customEmit("logout");
};
export const emitSendPosition = () => {
return customEmit("send_position");
export const emitLocation = (location) => {
return customEmit("scan", location);
};
export const emitUpdatePosition = (location) => {
return customEmit("update_position", location);
export const emitScan = (location) => {
return customEmit("location", location);
};
export const emitCapture = (captureCode) => {
return customEmitCallback("capture", captureCode);
};
export const emitBattery = (level) => {
return customEmit("battery_update", level);
};
export const emitDeviceInfo = (infos) => {
return customEmit("device_info", infos);
};

View File

@@ -2,9 +2,9 @@
import { defineTask, isTaskRegisteredAsync } from "expo-task-manager";
import * as Location from 'expo-location';
// Services
import { emitUpdatePosition } from "@/services/socket/emitters";
import { emitScan } from "@/services/socket/emitters";
// Constants
import { TASKS, LOCATION_PARAMETERS } from "@/constants";
import { TASKS, LOCATION_PARAMETERS } from "@/config";
// Task
@@ -22,7 +22,7 @@ defineTask(TASKS.BACKGROUND_LOCATION, async ({ data, error }) => {
return;
}
const { latitude, longitude } = locations[0].coords;
emitUpdatePosition([latitude, longitude]);
emitScan([latitude, longitude]);
}
});