{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "ping",
        "name": "Ping",
        "version": 2,
        "schema": "tailapps/v0",
        "exported_at": 1794851017,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "79fee2404ddde2e154ce8831b6a718f7483dbb0440e1e3333fb88571897e8d55"
        },
        "signature": "gW5RbFKxAnprZZhEpxY5hT5BKdMmU2vqtRLiishLJ5OKMplFgE0R1WGfjOEfgLDeYiDH1efvseIJDe+TVEgGCQ==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "ping",
        "name": "Ping",
        "description": "Send a short note to Ping on your other devices: your iPhone gets an alert even with TailApps closed, and your Mac a notification. Turn on \u22ef \u203a Sync to My Devices on each one.",
        "icon": "paperplane",
        "version": 2,
        "permissions": [
            "inbox:messages",
            "send:messages",
            "notify"
        ],
        "settings": {
            "notify": {
                "type": "toggle",
                "label": "Notify me on this Mac when a note arrives",
                "default": true,
                "platforms": [
                    "macos"
                ]
            }
        },
        "state": {
            "draft": {
                "type": "text",
                "default": "",
                "sync": false
            },
            "log": {
                "type": "list",
                "default": []
            }
        },
        "sources": {
            "messages": {
                "inbox": "messages",
                "on_receive": "received"
            }
        },
        "actions": {
            "ping": {
                "steps": [
                    {
                        "if": "$draft",
                        "then": [
                            {
                                "send": {
                                    "messages": {
                                        "text": "$draft",
                                        "at": "$now"
                                    }
                                },
                                "alert": "$draft"
                            },
                            {
                                "push": {
                                    "log": {
                                        "text": "$draft",
                                        "who": "me",
                                        "device": "",
                                        "at": "$now"
                                    }
                                },
                                "at": "end",
                                "max": 50
                            },
                            {
                                "set": {
                                    "draft": ""
                                }
                            }
                        ]
                    }
                ]
            },
            "received": {
                "steps": [
                    {
                        "if": "$args.event.clear",
                        "then": [
                            {
                                "set": {
                                    "log": []
                                }
                            }
                        ],
                        "else": [
                            {
                                "if": "$args.event.text",
                                "then": [
                                    {
                                        "push": {
                                            "log": {
                                                "text": "$args.event.text",
                                                "who": "them",
                                                "device": "$args.from",
                                                "at": "$args.event.at"
                                            }
                                        },
                                        "at": "end",
                                        "max": 50
                                    },
                                    {
                                        "if": "$settings.notify",
                                        "then": [
                                            {
                                                "notify": {
                                                    "title": "Ping from {$args.from}",
                                                    "body": "$args.event.text"
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "clear": {
                "confirm": "Clear these notes on all your devices?",
                "steps": [
                    {
                        "set": {
                            "log": []
                        }
                    },
                    {
                        "send": {
                            "messages": {
                                "clear": true
                            }
                        }
                    }
                ]
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "list": "$log",
                            "scroll": "end",
                            "height": "fill",
                            "empty": "Nothing yet. Send a note, or ping this device from another one.",
                            "item": {
                                "message": "$item.text",
                                "from": "$item.who",
                                "name": "$item.device",
                                "time": "$item.at | ago",
                                "avatar": null
                            }
                        },
                        {
                            "field": "Note",
                            "bind": "$draft",
                            "placeholder": "Type a note, then press Return",
                            "on_submit": "ping"
                        },
                        {
                            "row": [
                                {
                                    "button": "Clear",
                                    "on": "clear",
                                    "style": "plain"
                                },
                                {
                                    "spacer": true
                                },
                                {
                                    "button": "Send",
                                    "on": "ping",
                                    "style": "primary",
                                    "disabled": "$running.ping"
                                }
                            ],
                            "align": "center"
                        }
                    ],
                    "gap": "s"
                }
            }
        ],
        "views": {
            "menubar": {
                "icon": "paperplane",
                "in_menu": "row",
                "label": "{$log | count} notes",
                "card": "main"
            },
            "floating": {
                "card": "main",
                "width": "default"
            }
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"ping\",\n  \"name\": \"Ping\",\n  \"description\": \"Send a short note to Ping on your other devices: your iPhone gets an alert even with TailApps closed, and your Mac a notification. Turn on \u22ef \u203a Sync to My Devices on each one.\",\n  \"icon\": \"paperplane\",\n  \"version\": 2,\n  \"permissions\": [\"inbox:messages\", \"send:messages\", \"notify\"],\n  \"settings\": {\n    \"notify\": { \"type\": \"toggle\", \"label\": \"Notify me on this Mac when a note arrives\", \"default\": true, \"platforms\": [\"macos\"] }\n  },\n  \"state\": {\n    \"draft\": { \"type\": \"text\", \"default\": \"\", \"sync\": false },\n    \"log\": { \"type\": \"list\", \"default\": [] }\n  },\n  \"sources\": {\n    \"messages\": { \"inbox\": \"messages\", \"on_receive\": \"received\" }\n  },\n  \"actions\": {\n    \"ping\": {\n      \"steps\": [\n        { \"if\": \"$draft\", \"then\": [\n          { \"send\": { \"messages\": { \"text\": \"$draft\", \"at\": \"$now\" } }, \"alert\": \"$draft\" },\n          { \"push\": { \"log\": { \"text\": \"$draft\", \"who\": \"me\", \"device\": \"\", \"at\": \"$now\" } }, \"at\": \"end\", \"max\": 50 },\n          { \"set\": { \"draft\": \"\" } }\n        ] }\n      ]\n    },\n    \"received\": {\n      \"steps\": [\n        { \"if\": \"$args.event.clear\", \"then\": [\n          { \"set\": { \"log\": [] } }\n        ], \"else\": [\n          { \"if\": \"$args.event.text\", \"then\": [\n            { \"push\": { \"log\": { \"text\": \"$args.event.text\", \"who\": \"them\", \"device\": \"$args.from\", \"at\": \"$args.event.at\" } }, \"at\": \"end\", \"max\": 50 },\n            { \"if\": \"$settings.notify\", \"then\": [\n              { \"notify\": { \"title\": \"Ping from {$args.from}\", \"body\": \"$args.event.text\" } }\n            ] }\n          ] }\n        ] }\n      ]\n    },\n    \"clear\": {\n      \"confirm\": \"Clear these notes on all your devices?\",\n      \"steps\": [\n        { \"set\": { \"log\": [] } },\n        { \"send\": { \"messages\": { \"clear\": true } } }\n      ]\n    }\n  },\n  \"cards\": [{\n    \"id\": \"main\",\n    \"layout\": {\n      \"column\": [\n        { \"list\": \"$log\", \"scroll\": \"end\", \"height\": \"fill\", \"empty\": \"Nothing yet. Send a note, or ping this device from another one.\",\n          \"item\": { \"message\": \"$item.text\", \"from\": \"$item.who\", \"name\": \"$item.device\", \"time\": \"$item.at | ago\", \"avatar\": null } },\n        { \"field\": \"Note\", \"bind\": \"$draft\", \"placeholder\": \"Type a note, then press Return\", \"on_submit\": \"ping\" },\n        { \"row\": [\n          { \"button\": \"Clear\", \"on\": \"clear\", \"style\": \"plain\" },\n          { \"spacer\": true },\n          { \"button\": \"Send\", \"on\": \"ping\", \"style\": \"primary\", \"disabled\": \"$running.ping\" }\n        ], \"align\": \"center\" }\n      ],\n      \"gap\": \"s\"\n    }\n  }],\n  \"views\": {\n    \"menubar\": { \"icon\": \"paperplane\", \"in_menu\": \"row\", \"label\": \"{$log | count} notes\", \"card\": \"main\" },\n    \"floating\": { \"card\": \"main\", \"width\": \"default\" }\n  }\n}\n",
    "files": []
}