Skip to content

Commit

Permalink
fix: unsupported push notifications (#3779)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanzel authored Nov 11, 2024
1 parent bb18e73 commit 5997254
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/shared/src/contexts/PushNotificationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function PushNotificationContextProvider({
isInitialized: !isEnabled || isFetched || !isSuccess,
isLoading,
isSubscribed,
isPushSupported: isPushSupported && isSuccess && isEnabled,
isPushSupported: !!(isPushSupported && isSuccess && isEnabled),
onSourceChange,
logPermissionGranted,
shouldOpenPopup: false,
Expand Down
8 changes: 7 additions & 1 deletion packages/webapp/pages/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import { getPathnameWithQuery } from '@dailydotdev/shared/src/lib';
import { webappUrl } from '@dailydotdev/shared/src/lib/constants';
import useMutateFilters from '@dailydotdev/shared/src/hooks/useMutateFilters';
import dynamic from 'next/dynamic';
import { usePushNotificationContext } from '@dailydotdev/shared/src/contexts/PushNotificationContext';
import { defaultOpenGraph, defaultSeo } from '../next-seo';
import { getTemplatedTitle } from '../components/layouts/utils';

Expand Down Expand Up @@ -124,6 +125,7 @@ export function OnboardPage(): ReactElement {
const onboardingVisual: OnboardingVisual = useFeature(
feature.onboardingVisual,
);
const { isPushSupported } = usePushNotificationContext();
const targetId: string = ExperimentWinner.OnboardingV4;
const formRef = useRef<HTMLFormElement>();
const [activeScreen, setActiveScreen] = useState(OnboardingStep.Intro);
Expand Down Expand Up @@ -187,7 +189,11 @@ export function OnboardPage(): ReactElement {
return setActiveScreen(OnboardingStep.ContentTypes);
}

if (activeScreen === OnboardingStep.ContentTypes && isMobile) {
if (
activeScreen === OnboardingStep.ContentTypes &&
isMobile &&
isPushSupported
) {
return setActiveScreen(OnboardingStep.ReadingReminder);
}

Expand Down

0 comments on commit 5997254

Please sign in to comment.