From b3db2bb8e2edbd37fa752042a307d03d11f398ea Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 1 Oct 2023 21:30:04 +0800 Subject: [PATCH] Turn off debug flags and fix student status deactivation on homepage --- src/components/Api/Api.tsx | 2 +- src/components/BackgroundTask/BackgroundTask.tsx | 2 +- src/components/DrawerSettings/CustomDrawerContent.tsx | 3 +-- src/routes/Home/Home.tsx | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Api/Api.tsx b/src/components/Api/Api.tsx index e6111a9..f5dc3d2 100644 --- a/src/components/Api/Api.tsx +++ b/src/components/Api/Api.tsx @@ -22,7 +22,7 @@ if (__DEV__) { } // Switch this on if you wanna run production URLs while in development -let use_production = false; +let use_production = true; if (__DEV__ && use_production) { backendURL = "https://stude.keannu1.duckdns.org"; backendURLWebsocket = "ws://stude.keannu1.duckdns.org"; diff --git a/src/components/BackgroundTask/BackgroundTask.tsx b/src/components/BackgroundTask/BackgroundTask.tsx index 57cb25b..b1b366c 100644 --- a/src/components/BackgroundTask/BackgroundTask.tsx +++ b/src/components/BackgroundTask/BackgroundTask.tsx @@ -95,7 +95,7 @@ TaskManager.defineTask(FETCH_STUDENT_STATUS, async () => { }); const BackgroundComponent = () => { - const notification_debug = true; + const notification_debug = false; const [Task1_isRegistered, Task1_setIsRegistered] = React.useState(false); const [Task2_isRegistered, Task2_setIsRegistered] = React.useState(false); const [status, setStatus] = React.useState(); diff --git a/src/components/DrawerSettings/CustomDrawerContent.tsx b/src/components/DrawerSettings/CustomDrawerContent.tsx index 1b31ad8..f3eb5b8 100644 --- a/src/components/DrawerSettings/CustomDrawerContent.tsx +++ b/src/components/DrawerSettings/CustomDrawerContent.tsx @@ -22,12 +22,11 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; import UserIcon from "../../icons/UserIcon/UserIcon"; import SubjectIcon from "../../icons/SubjectIcon/SubjectIcon"; import { useMutation, useQueryClient } from "@tanstack/react-query"; -import toast from "react-native-toast-notifications/lib/typescript/toast"; import { PatchStudentStatus } from "../Api/Api"; import { useToast } from "react-native-toast-notifications"; export default function CustomDrawerContent(props: {}) { - const debug = true; + const debug = false; const navigation = useNavigation(); const status = useSelector((state: RootState) => state.status); const dispatch = useDispatch(); diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx index bf002f8..6f5ca2c 100644 --- a/src/routes/Home/Home.tsx +++ b/src/routes/Home/Home.tsx @@ -38,7 +38,7 @@ import CaretUpIcon from "../../icons/CaretUpIcon/CaretUpIcon"; export default function Home() { // Switch this condition to see the main map when debugging - const map_distance_override = true; + const map_distance_override = false; const navigation = useNavigation(); const [location, setLocation] = useState(null); const [dist, setDist] = useState(null); @@ -99,8 +99,8 @@ export default function Home() { async function DistanceHandler(location: RawLocationType) { let dist = GetDistanceFromUSTP(location.coords); setDist(dist); - // Deactivate student status if too far away - if (dist >= 2 && !map_distance_override) + // Deactivate student status if too far away and still studying + if (dist >= 2 && !map_distance_override && studying) stop_studying.mutate({ active: false, });