mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-04-11 00:30:19 +02:00
Server heavy refactoring 4 (not functionnal)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user