import type { PushTokenAdapter } from "../../interfaces/PushTokenAdapter"; export interface UsePushRegistrationValues { /** * Requests permission, retrieves a token/subscription via the adapter, * and registers it server-side. Resolves to `false` (without throwing) * when permission is denied or the adapter can't produce an identifier — * both expected outcomes. Throws on a failed API call. * * On success it also records this device's identifier and turns push on for * every stored account that has never expressed a preference — so the first * `register()` on a device that already holds several accounts turns push on * for all of them. An account the user deliberately silenced stays silenced. * * Only the ACTIVE account is bound here. The others are marked as needing a * re-bind and are bound the next time the user switches into them, using the * live session that switch establishes. Binding them now would mean spending * each one's stored refresh token on a one-time-use exchange in the * background, which can permanently lock an account out if it is interrupted. */ register: () => Promise; /** * Unbinds the ACTIVE account from this device and durably silences it. * * This is a sticky per-account preference, not a one-shot unbind: the account * stays silenced across switches and relaunches until something turns it back * on (`register()`, or the per-account toggle). It does NOT clear the device * identifier — that is device state shared with every other stored account. */ unregister: () => Promise; registering: boolean; unregistering: boolean; } /** * Explicit, developer-triggered push registration — unlike account-token * restoration, requesting OS/browser push permission should never happen * silently on mount. Callers pass the adapter for their platform * (`expoPushTokenAdapter`, `reactNativePushTokenAdapter`, `webPushTokenAdapter`). * * The hook also mounts the adapter's optional device-token change subscription * — see the effect at the bottom. */ declare function usePushRegistration(adapter: PushTokenAdapter): UsePushRegistrationValues; export default usePushRegistration;