Build / Build (push) Successful in 56s
Settings gets "Notifications on this device" (PushEditor): personas, alerts in four groups, policy, a test
notification, after a one-time notice of what the push service learns. Each persona ticked gets its own service
worker registration (push-worker.js at push/{slot}/), so its own endpoint and keys, subscribed with its own token
(IHttpService's *As); nothing PrivaPub stores ties two personas together and the worker never reads the payload's
token. PushService follows the tokens (re-subscribing after a renewal), reconciles at every session start, turns
off before sign-out and drops deleted or suspended personas. A click opens that persona's notifications; the app
badge counts the unread ones. Exchanges now ask for the push scope.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
58 lines
2.4 KiB
Plaintext
58 lines
2.4 KiB
Plaintext
@inherits LocalizableComponentBase
|
|
@implements IDisposable
|
|
|
|
@* The one-time notice before a persona's first reaction or poll vote, before it first joins an event, and before this
|
|
device's first Web Push subscription (PublicNoticeService), in MainLayout. data-public-notice names which. *@
|
|
<DModal Placement="DModalPlacement.ResponsiveBottom" IsOpen="Notices.IsAsking" IsOpenChanged="Closed" CloseOnBackdrop="false" CloseText="@Localizer["Close"]"
|
|
data-public-notice="@ActName">
|
|
<Heading>@HeadingText</Heading>
|
|
<ChildContent>
|
|
<p class="text-sm">@NoticeText</p>
|
|
</ChildContent>
|
|
<Actions>
|
|
<DButton Size="DSize.Sm" OnClick="() => Notices.Answer(false)">@Localizer["Cancel"]</DButton>
|
|
<DButton Size="DSize.Sm" Color="DColor.Primary" OnClick="() => Notices.Answer(true)" data-public-notice-yes>@Localizer["Continue"]</DButton>
|
|
</Actions>
|
|
</DModal>
|
|
|
|
@code {
|
|
[Inject] PublicNoticeService Notices { get; set; }
|
|
|
|
string ActName => Notices.Act switch
|
|
{
|
|
PublicAct.Participation => "participation",
|
|
PublicAct.Push => "push",
|
|
_ => "reaction"
|
|
};
|
|
|
|
string HeadingText => Notices.Act switch
|
|
{
|
|
PublicAct.Participation => Localizer["Joining an event is public"],
|
|
PublicAct.Push => Localizer["Notifications go through your browser's push service"],
|
|
_ => Localizer["Reactions and votes are public"]
|
|
};
|
|
|
|
string NoticeText => Notices.Act switch
|
|
{
|
|
PublicAct.Participation => Localizer["The event's server shows who takes part, {0} included. Your other personas are never named.", CascadingState.Persona?.Name ?? ""],
|
|
PublicAct.Push => Localizer["To reach this device while decePub is closed, PrivaPub hands each notification to the push service your browser uses (Google's, Mozilla's, Apple's…). It is encrypted for this browser alone: the push service learns when a notification arrives and how big it is, never what it says, who sent it or which persona it is for. Each persona has a subscription of its own, so PrivaPub keeps nothing that ties your personas together."],
|
|
_ => Localizer["Anyone who can see the post can see that {0} reacted to it or voted in it. Your other personas are never named.", CascadingState.Persona?.Name ?? ""]
|
|
};
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
Notices.Changed += Refresh;
|
|
IsLoading = false;
|
|
}
|
|
|
|
void Refresh() => InvokeAsync(StateHasChanged);
|
|
|
|
void Closed(bool open)
|
|
{
|
|
if (!open)
|
|
Notices.Answer(false);
|
|
}
|
|
|
|
public void Dispose() => Notices.Changed -= Refresh;
|
|
}
|