iOS: presses are felt (#430)

The page asks the app for a haptic ({t:"haptic", kind}) and the app
plays the phone's own. A light tap for play, pause, flag and pull to
refresh; the system's success for marking read, one item or all; its
warning with an error toast. A browser has no host to ask, and an
older app ignores the message, so there is nothing to gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ray Slakinski
2026-11-08 16:57:51 -05:00
parent 2e031763fa
commit cf0dad7380
12 changed files with 40 additions and 9 deletions

View File

@@ -24,6 +24,15 @@ const ipxHost: ((m: any) => void) | null = (() => {
})();
if (ipxHost) installNativePlayback();
/// A press felt as well as seen, in the app (#430): the phone's haptics, which a page cannot reach.
/// `tap` for play, pause and the like, `done` for something finished (marked read), `warn` for an
/// error. An app without them ignores the message; a browser has no host to send it to.
function haptic(kind: 'tap'|'done'|'warn'){
// An error toasted while the script is still loading comes here before this file has declared
// ipxHost, which then throws; a haptic is not worth breaking that error's toast for.
try{ ipxHost?.({t:'haptic', kind}); }catch{}
}
// Here, after ipxHost exists: in the app the button waits for the host to say it has a picker.
paintRoute();