mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Turn off debug flags and fix student status deactivation on homepage
This commit is contained in:
parent
7c3eeda29e
commit
b3db2bb8e2
4 changed files with 6 additions and 7 deletions
|
@ -22,7 +22,7 @@ if (__DEV__) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch this on if you wanna run production URLs while in development
|
// Switch this on if you wanna run production URLs while in development
|
||||||
let use_production = false;
|
let use_production = true;
|
||||||
if (__DEV__ && use_production) {
|
if (__DEV__ && use_production) {
|
||||||
backendURL = "https://stude.keannu1.duckdns.org";
|
backendURL = "https://stude.keannu1.duckdns.org";
|
||||||
backendURLWebsocket = "ws://stude.keannu1.duckdns.org";
|
backendURLWebsocket = "ws://stude.keannu1.duckdns.org";
|
||||||
|
|
|
@ -95,7 +95,7 @@ TaskManager.defineTask(FETCH_STUDENT_STATUS, async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const BackgroundComponent = () => {
|
const BackgroundComponent = () => {
|
||||||
const notification_debug = true;
|
const notification_debug = false;
|
||||||
const [Task1_isRegistered, Task1_setIsRegistered] = React.useState(false);
|
const [Task1_isRegistered, Task1_setIsRegistered] = React.useState(false);
|
||||||
const [Task2_isRegistered, Task2_setIsRegistered] = React.useState(false);
|
const [Task2_isRegistered, Task2_setIsRegistered] = React.useState(false);
|
||||||
const [status, setStatus] = React.useState<any>();
|
const [status, setStatus] = React.useState<any>();
|
||||||
|
|
|
@ -22,12 +22,11 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
import UserIcon from "../../icons/UserIcon/UserIcon";
|
import UserIcon from "../../icons/UserIcon/UserIcon";
|
||||||
import SubjectIcon from "../../icons/SubjectIcon/SubjectIcon";
|
import SubjectIcon from "../../icons/SubjectIcon/SubjectIcon";
|
||||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import toast from "react-native-toast-notifications/lib/typescript/toast";
|
|
||||||
import { PatchStudentStatus } from "../Api/Api";
|
import { PatchStudentStatus } from "../Api/Api";
|
||||||
import { useToast } from "react-native-toast-notifications";
|
import { useToast } from "react-native-toast-notifications";
|
||||||
|
|
||||||
export default function CustomDrawerContent(props: {}) {
|
export default function CustomDrawerContent(props: {}) {
|
||||||
const debug = true;
|
const debug = false;
|
||||||
const navigation = useNavigation<RootDrawerParamList>();
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
const status = useSelector((state: RootState) => state.status);
|
const status = useSelector((state: RootState) => state.status);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
|
@ -38,7 +38,7 @@ import CaretUpIcon from "../../icons/CaretUpIcon/CaretUpIcon";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
// Switch this condition to see the main map when debugging
|
// Switch this condition to see the main map when debugging
|
||||||
const map_distance_override = true;
|
const map_distance_override = false;
|
||||||
const navigation = useNavigation<RootDrawerParamList>();
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
const [location, setLocation] = useState<RawLocationType | null>(null);
|
const [location, setLocation] = useState<RawLocationType | null>(null);
|
||||||
const [dist, setDist] = useState<number | null>(null);
|
const [dist, setDist] = useState<number | null>(null);
|
||||||
|
@ -99,8 +99,8 @@ export default function Home() {
|
||||||
async function DistanceHandler(location: RawLocationType) {
|
async function DistanceHandler(location: RawLocationType) {
|
||||||
let dist = GetDistanceFromUSTP(location.coords);
|
let dist = GetDistanceFromUSTP(location.coords);
|
||||||
setDist(dist);
|
setDist(dist);
|
||||||
// Deactivate student status if too far away
|
// Deactivate student status if too far away and still studying
|
||||||
if (dist >= 2 && !map_distance_override)
|
if (dist >= 2 && !map_distance_override && studying)
|
||||||
stop_studying.mutate({
|
stop_studying.mutate({
|
||||||
active: false,
|
active: false,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue