feat: add push notification settings to user profile and update related functionality
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m50s

This commit is contained in:
2026-04-20 10:43:09 -04:00
parent fd28c89cbf
commit b529ddaa02
8 changed files with 249 additions and 191 deletions

View File

@@ -186,3 +186,25 @@ export async function isSubscribedToPush(): Promise<boolean> {
return false
}
}
/** localStorage key used to persist the user's explicit push opt-out across logins. */
const PUSH_OPT_OUT_KEY = 'push_opt_out'
/**
* Persist or clear the user's push opt-out preference in localStorage.
* Call with `true` when the user disables push, `false` when they enable it.
*/
export function setPushOptOut(optOut: boolean): void {
if (optOut) {
localStorage.setItem(PUSH_OPT_OUT_KEY, '1')
} else {
localStorage.removeItem(PUSH_OPT_OUT_KEY)
}
}
/**
* Returns true if the user has explicitly opted out of push notifications.
*/
export function isPushOptedOut(): boolean {
return localStorage.getItem(PUSH_OPT_OUT_KEY) === '1'
}