From 29d152ee844b335bf9dce16816dd861b57ccdf04 Mon Sep 17 00:00:00 2001 From: Ajax Dong <60734649+84634E1A607A@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:50:22 +0800 Subject: [PATCH] fix: Removed calendar entry (#607) * fix: Removed calendar entry * fix 2 --- apps/thu-info-app/src/ui/home/home.tsx | 45 ++++++++++++-------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/apps/thu-info-app/src/ui/home/home.tsx b/apps/thu-info-app/src/ui/home/home.tsx index 1a6b778fe..16c9bc70d 100644 --- a/apps/thu-info-app/src/ui/home/home.tsx +++ b/apps/thu-info-app/src/ui/home/home.tsx @@ -62,7 +62,7 @@ import { import IconNetwork from "../../assets/icons/IconNetwork"; import IconNetworkDetail from "../../assets/icons/IconNetworkDetail"; import IconNetworkOnlineDevices from "../../assets/icons/IconNetworkOnlineDevices"; -import IconCalendar from "../../assets/icons/IconCalendar"; +// import IconCalendar from "../../assets/icons/IconCalendar"; import {setBalance} from "../../redux/slices/campusCard"; import {gt} from "semver"; import VersionNumber from "react-native-version-number"; @@ -864,16 +864,16 @@ const getHomeFunctions = ( }}> , - { - addUsageStat(FunctionType.SchoolCalendar); - updateTop5("schoolCalendar"); - navigation.navigate("SchoolCalendar"); - }}> - - , + // { + // addUsageStat(FunctionType.SchoolCalendar); + // updateTop5("schoolCalendar"); + // navigation.navigate("SchoolCalendar"); + // }}> + // + // , ]; export const HomeScreen = ({navigation}: {navigation: RootNav}) => { @@ -887,17 +887,13 @@ export const HomeScreen = ({navigation}: {navigation: RootNav}) => { const disabledList: HomeFunction[] | undefined = useSelector( (state: State) => state.config.homeFunctionDisabled, ); - const sunsetFunctions: HomeFunction[] = ["expenditure"]; + if (!disabledList) { dispatch(configSet({key: "homeFunctionDisabled", value: []})); - } else if (sunsetFunctions.some((f) => !disabledList.includes(f))) { - dispatch( - configSet({ - key: "homeFunctionDisabled", - value: disabledList.concat(sunsetFunctions), - }), - ); } + + const sunsetFunctions: HomeFunction[] = ["expenditure", "schoolCalendar"]; + const homeFunctions = getHomeFunctions(navigation, (func) => dispatch(top5Update(func)), ); @@ -941,12 +937,12 @@ export const HomeScreen = ({navigation}: {navigation: RootNav}) => { needToShowFunctionNames.push("network"); } - if (!(disabledList ?? []).includes("schoolCalendar" as HomeFunction)) { - needToShowFunctionNames.push("schoolCalendar" as HomeFunction); - } + // if (!(disabledList ?? []).includes("schoolCalendar" as HomeFunction)) { + // needToShowFunctionNames.push("schoolCalendar" as HomeFunction); + // } const top5Filtered = top5.filter( - (f) => !(disabledList ?? []).includes((f as any).key), + (f) => !(disabledList ?? []).includes((f as any).key) && !sunsetFunctions.includes((f as any).key), ); const needToShowFunctions = needToShowFunctionNames.map((x) => @@ -968,7 +964,8 @@ export const HomeScreen = ({navigation}: {navigation: RootNav}) => { invalidHelper.twoFactorMethodHook = async () => { dispatch(configSet({key: "fingerprintSecure", value: true})); return undefined; - } + }; + helper .appStartUp(Platform.OS) .then(