Pebble.Companion.Notifications

Phone notification status helpers for companion apps.

import Pebble.Companion.Notifications as Notifications

type Msg
    = GotNotifications (Result String Notifications.NotificationStatus)

init _ =
    ( model, Notifications.current GotNotifications )

subscriptions _ =
    Notifications.onNotificationStatus GotNotifications

For a runnable example, use the companion-demo-phone-status project template.

Types

NotificationStatus

type alias NotificationStatus =
    { quietHours : Bool
    , notificationsEnabled : Bool
    }

Notification settings reported by the companion bridge.

Commands

current

current : (Result String NotificationStatus -> msg) -> Cmd msg

Request the current notification status.

setup

setup : Cmd msg

Register this platform handler with the companion bridge.

Subscriptions

onNotificationStatus

onNotificationStatus : (Result String NotificationStatus -> msg) -> Sub msg

Receive pushed notification status updates from the companion bridge.

Registering this subscription also tells the bridge to send notification updates.