Rework how the onboarding notifications task works (#12839)

* Rework how the onboarding notifications task works

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-07-30 15:55:08 +01:00 committed by GitHub
parent dd20741b87
commit 02047243f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 85 additions and 17 deletions

View file

@ -136,14 +136,18 @@ const tasks: UserOnboardingTask[] = [
id: "permission-notifications",
title: _t("onboarding|enable_notifications"),
description: _t("onboarding|enable_notifications_description"),
completed: (ctx: UserOnboardingContext) => ctx.hasNotificationsEnabled,
completed: (ctx: UserOnboardingContext) => !ctx.showNotificationsPrompt,
action: {
label: _t("onboarding|enable_notifications_action"),
onClick: (ev: ButtonEvent) => {
PosthogTrackers.trackInteraction("WebUserOnboardingTaskEnableNotifications", ev);
Notifier.setEnabled(true);
defaultDispatcher.dispatch({
action: Action.ViewUserSettings,
initialTabId: UserTab.Notifications,
});
Notifier.setPromptHidden(true);
},
hideOnComplete: true,
hideOnComplete: !Notifier.isPossible(),
},
},
];