mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-04-11 00:30:19 +02:00
Traduction + alias + routing + refactoring
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
// Constants
|
||||
import { SERVER_URL } from "../../constants";
|
||||
import { SERVER_URL } from "@/constants";
|
||||
|
||||
export const uploadTeamImage = async (id, imageUri) => {
|
||||
if (!imageUri || !id) return;
|
||||
|
||||
const data = new FormData();
|
||||
// @ts-ignore
|
||||
data.append('file', {
|
||||
uri: imageUri,
|
||||
name: 'photo.jpg',
|
||||
@@ -26,7 +27,7 @@ export const uploadTeamImage = async (id, imageUri) => {
|
||||
};
|
||||
|
||||
export const enemyImage = (id) => {
|
||||
if (!id) return require('../assets/images/missing_image.jpg');
|
||||
if (!id) return require('@/assets/images/missing_image.jpg');
|
||||
|
||||
return {uri: `${SERVER_URL}/photo/enemy?team=${id}`};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Socket
|
||||
import { io } from "socket.io-client";
|
||||
// Constants
|
||||
import { SOCKET_URL } from "../../constants";
|
||||
import { SOCKET_URL } from "@/constants";
|
||||
|
||||
export const socket = io(SOCKET_URL, {
|
||||
path: "/back/socket.io"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Services
|
||||
import { socket } from "./connection";
|
||||
import { socket } from "@/services/socket/connection";
|
||||
|
||||
const customEmit = (event, ...args) => {
|
||||
if (!socket?.connected) return false;
|
||||
@@ -21,7 +21,8 @@ const customEmitCallback = (event, ...args) => {
|
||||
|
||||
socket.emit(event, ...args, (response) => {
|
||||
clearTimeout(timeout);
|
||||
resolve(response.length > 1 ? response : response[0]);
|
||||
console.log("Received : ", response);
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import { defineTask, isTaskRegisteredAsync } from "expo-task-manager";
|
||||
import * as Location from 'expo-location';
|
||||
// Services
|
||||
import { emitUpdatePosition } from "../socket/emitters";
|
||||
import { emitUpdatePosition } from "@/services/socket/emitters";
|
||||
// Constants
|
||||
import { TASKS, LOCATION_PARAMETERS } from "../../constants";
|
||||
import { TASKS, LOCATION_PARAMETERS } from "@/constants";
|
||||
|
||||
|
||||
// Task
|
||||
@@ -15,6 +15,7 @@ defineTask(TASKS.BACKGROUND_LOCATION, async ({ data, error }) => {
|
||||
return;
|
||||
}
|
||||
if (data) {
|
||||
// @ts-ignore
|
||||
const { locations } = data;
|
||||
if (locations.length == 0) {
|
||||
console.log("No location measured.");
|
||||
|
||||
Reference in New Issue
Block a user