Turn off debug flags and fix student status deactivation on homepage

This commit is contained in:
Keannu Bernasol 2023-10-01 21:30:04 +08:00
parent 7c3eeda29e
commit b3db2bb8e2
4 changed files with 6 additions and 7 deletions

View file

@ -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";

View file

@ -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<any>();

View file

@ -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<RootDrawerParamList>();
const status = useSelector((state: RootState) => state.status);
const dispatch = useDispatch();

View file

@ -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<RootDrawerParamList>();
const [location, setLocation] = useState<RawLocationType | null>(null);
const [dist, setDist] = useState<number | null>(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,
});