Skip to content

Commit

Permalink
fix(apps/phone): disabling apps
Browse files Browse the repository at this point in the history
  • Loading branch information
itschip committed May 1, 2024
1 parent e670472 commit 65e1f8c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/phone/src/os/apps/hooks/useApps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { SvgIconComponent } from '@mui/icons-material';
import { useTheme } from '@mui/material';
import { useSettingsValue } from '../../../apps/settings/hooks/useSettings';
import { IconSetObject } from '@typings/settings';
import { usePhone } from '@os/phone/hooks';

export const useApps = () => {
const { icons } = useNotifications();
const theme = useTheme();
const curIconSet = useSettingsValue().iconSet.value as IconSetObject;
const { ResourceConfig } = usePhone();

const apps: IApp[] = useMemo(() => {
return APPS.map((app) => {
Expand Down Expand Up @@ -38,7 +40,7 @@ export const useApps = () => {
<NotificationIcon htmlColor={theme.palette.text.primary} fontSize="small" />
),
icon: <Icon />,
isDisabled: app.disable,
isDisabled: !!ResourceConfig?.disabledApps.find((a) => a === app.id),
};
}

Expand All @@ -47,10 +49,10 @@ export const useApps = () => {
notification: icons.find((i) => i.key === app.id),
NotificationIcon,
notificationIcon: <NotificationIcon htmlColor={app.color} fontSize="small" />,
isDisabled: app.disable,
isDisabled: !!ResourceConfig?.disabledApps.find((a) => a === app.id),
};
});
}, [icons, curIconSet, theme]);
}, [icons, curIconSet, theme, ResourceConfig]);

const allApps = useMemo(() => [...apps], [apps]);
const getApp = useCallback(
Expand Down

0 comments on commit 65e1f8c

Please sign in to comment.