tidbyt / pixlet

Build apps for pixel-based displays ✨
https://tidbyt.com
Apache License 2.0
756 stars 107 forks source link

Add notifications and sounds to schema #1064

Closed rohansingh closed 4 months ago

rohansingh commented 4 months ago

Add the ability to specific app notifications and sounds in the schema.

Here is an example:

def get_schema():
    return schema.Schema(
        version = "1",
        notifications = [
            schema.Notification(
                id = "notificationid",
                name = "Notification",
                desc = "A Notification",
                icon = "notification",
                sounds = [
                    schema.Sound(
                        title = "Ding!",
                        file = ding_mp3,
                    ),
                ],
            ),
        ],
    )

This change makes the Schema and SchemaJSON fields of Applet public, so that embedders can inspect the schema and access the sound files that are referenced by schema.Sound.

Also, the File type is moved to runtime/modules to avoid a circular dependency between runtime and schema.