diff --git a/app/(tabs)/navigation.tsx b/app/(tabs)/navigation.tsx
index 393c605..55873a4 100644
--- a/app/(tabs)/navigation.tsx
+++ b/app/(tabs)/navigation.tsx
@@ -47,7 +47,7 @@ const GET_FILTERED_SUPERMARKETS = gql(`
`);
const NavigationScreen = () => {
- const { id, currentListId } = useAuth();
+ const { currentListId } = useAuth();
const { toast, toastOnError } = useToast();
const router = useRouter();
const { setState: setBackground } = useBackground();
@@ -116,7 +116,7 @@ const NavigationScreen = () => {
};
getLocation().catch(toastOnError);
- }, [toast, toastOnError]);
+ }, [currentListId, refetch, toast, toastOnError]);
const { totalQuantity, totalPrice } = useMemo(() => {
let quantity = 0;
@@ -140,6 +140,23 @@ const NavigationScreen = () => {
return () => setBackground(false);
}, [debouncedLoading, setBackground]);
+ if (!currentListId) {
+ return (
+
+
+
+
+ Oops, hold on!
+
+
+ It seems you don't have a shopping list selected. Create or select a
+ list to start in-store navigation.
+
+
+
+ );
+ }
+
if (debouncedLoading) {
return (
diff --git a/app/navigation-in-store/index.tsx b/app/navigation-in-store/index.tsx
index 6057ceb..67254df 100644
--- a/app/navigation-in-store/index.tsx
+++ b/app/navigation-in-store/index.tsx
@@ -11,7 +11,6 @@ import {
FillExtrusionLayer,
FillExtrusionLayerStyle,
Images,
- Light,
LineLayer,
Logger,
MapView,
@@ -157,7 +156,6 @@ const NavigationInStore = () => {
feature.geometry.coordinates[0] === point.geometry.coordinates[0] &&
feature.geometry.coordinates[1] === point.geometry.coordinates[1],
);
- // TODO: Add and EAN
return {
...productData
.filter((p) => !picked.includes(p.ean))
@@ -232,7 +230,6 @@ const NavigationInStore = () => {
};
useEffect(() => {
- let isMounted = true;
let resultListener: EmitterSubscription | null = null;
let errorListener: EmitterSubscription | null = null;
const a = async () => {
@@ -256,16 +253,6 @@ const NavigationInStore = () => {
const beaconId = data.id;
let filteredDistance = data.distance;
- //
- // if (!kalmanStates.current[beaconId]) {
- // // Inicialização do filtro
- // kalmanStates.current[beaconId] = {
- // x: filteredDistance,
- // P: INITIAL_P,
- // lastUpdate: now,
- //
- // };
- // }
if (!kalmanStates.current[beaconId]) {
// Inicialização com média de 3 leituras
const initialReadings = [filteredDistance];
@@ -338,7 +325,6 @@ const NavigationInStore = () => {
delete refs[key];
}
});
- isMounted = false;
resultListener?.remove();
errorListener?.remove();
stopScan().catch(toastOnError);
diff --git a/app/productSearch/index.tsx b/app/productSearch/index.tsx
index b82c634..43cd172 100644
--- a/app/productSearch/index.tsx
+++ b/app/productSearch/index.tsx
@@ -69,7 +69,7 @@ const Search = () => {
const insets = useSafeAreaInsets();
const router = useRouter();
const { toast, toastOnError } = useToast();
- const { id: userId, currentListId } = useAuth();
+ const { currentListId } = useAuth();
const nutriScoreBottomSheetRef = useRef(null);
const brandBottomSheetRef = useRef(null);
diff --git a/components/ListItem.tsx b/components/ListItem.tsx
index fde3720..31443bc 100644
--- a/components/ListItem.tsx
+++ b/components/ListItem.tsx
@@ -44,7 +44,6 @@ const ListItem = (props: ListItemProps) => {
const ContentWrapper =
item.type && item.type !== "NORMAL" ? LinearGradient : View;
- const ItemWrapper = type === "search" ? TouchableOpacity : View;
return (
) => {
...beaconPositions[id],
distance: distance * Math.pow(10, -5),
}));
- // console.log("MA pooints", points);
if (points.length < 3) return null;
// Implementação do algoritmo de mínimos quadrados
@@ -33,9 +32,6 @@ export const calculatePosition = (distances: Record) => {
let x = solution[0];
let y = solution[1];
- // Limitar aos limites do retângulo
- // TODO
-
return { x, y };
} catch (error) {
console.error("Erro ao calcular a posição:", error);