Skip to content

Commit

Permalink
fix: Removed calendar entry (#607)
Browse files Browse the repository at this point in the history
* fix: Removed calendar entry

* fix 2
  • Loading branch information
84634E1A607A authored Sep 13, 2024
1 parent 7c5feb7 commit 29d152e
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions apps/thu-info-app/src/ui/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -864,16 +864,16 @@ const getHomeFunctions = (
}}>
<IconNetworkOnlineDevices width={iconSize} height={iconSize} />
</HomeIcon>,
<HomeIcon
key="schoolCalendar"
title="schoolCalendar"
onPress={() => {
addUsageStat(FunctionType.SchoolCalendar);
updateTop5("schoolCalendar");
navigation.navigate("SchoolCalendar");
}}>
<IconCalendar width={iconSize} height={iconSize} />
</HomeIcon>,
// <HomeIcon
// key="schoolCalendar"
// title="schoolCalendar"
// onPress={() => {
// addUsageStat(FunctionType.SchoolCalendar);
// updateTop5("schoolCalendar");
// navigation.navigate("SchoolCalendar");
// }}>
// <IconCalendar width={iconSize} height={iconSize} />
// </HomeIcon>,
];

export const HomeScreen = ({navigation}: {navigation: RootNav}) => {
Expand All @@ -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)),
);
Expand Down Expand Up @@ -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) =>
Expand All @@ -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(
Expand Down

0 comments on commit 29d152e

Please sign in to comment.