devicepush

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package devicepush reaches the household's paired phones with a push: the notify and remind tools' out-of-band sender (Notifier) and the approval broker's waker (Waker). It is an adapter: it joins the device registry (internal/auth), the push providers (internal/push: APNs for iOS, FCM for Android) and the two consumers' interfaces, none of which know each other.

A push carries no authority. It is a wake, or a message the user already agreed to receive; an approval is always answered over the authenticated WebSocket the push makes the app open.

Index

Constants

View Source
const (
	IOS     = "ios"
	Android = "android"
)

Platforms a device registers with, and so the provider that reaches it.

Variables

This section is empty.

Functions

func NewWaker

func NewWaker(devices Devices, senders Senders, log *slog.Logger) hitl.Pusher

NewWaker returns the approval broker's waker: a push when a provider is configured, else hitl's logging placeholder, so a daemon without push still runs and says why nothing woke.

Types

type Devices

type Devices interface {
	PushTargets() []auth.PushTarget
}

Devices lists where a push can go. *auth.Store satisfies it.

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier is the notify and remind tools' sender in daemon mode: it pushes the message to every paired device a provider reaches. Without a provider it logs that it would have, and succeeds.

func NewNotifier

func NewNotifier(devices Devices, senders Senders, log *slog.Logger) *Notifier

NewNotifier builds the notifier.

func (*Notifier) Notify

func (p *Notifier) Notify(ctx context.Context, n tools.Notification) error

Notify pushes n to every reachable paired device.

type Senders

type Senders map[string]push.Sender

Senders maps a platform to the provider that reaches it. A platform without a sender is not pushed to; with no sender at all, push is off.

type Waker

type Waker struct {
	// contains filtered or unexported fields
}

Waker wakes every reachable paired device so it can foreground and answer a pending approval over the WebSocket. The push says only that something waits; the decision never travels in it.

func (*Waker) Push

func (p *Waker) Push(ctx context.Context, intent string) error

Push wakes every reachable paired device with intent as the visible line.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL