The fix for #207 makes four iOS page calls return a promise with native's answer. On Android the same four calls still return undefined, so a page written against one platform behaves differently on the other.
| page call | iOS after #207 | Android today |
|---|---|---|
craft.haptic(style) | resolves true; rejects CAPABILITY_DISABLED when enableHaptics is off | returns undefined (CraftBridge.kt.template:359) |
craft.vibrate(pattern) | resolves true | returns undefined (:502); Kotlin catches and logs every failure |
craft.startListening() | resolves true once the request is taken; rejects CAPABILITY_DISABLED | returns undefined (:364). If RECORD_AUDIO is not granted, it asks for the permission and then reports nothing, not even craftSpeechError, and does not start after the grant |
craft.stopListening() | resolves true | returns undefined (:367), and sends no craftSpeechEnd |
craft.d.ts types all four as Promise<boolean> | void, with "Android returns nothing yet", until this is fixed.
What parity looks like
- Return a promise from each, through the
__craftPromisechannel patternshareuses since #210. hapticandstartListeningcan only rejectCAPABILITY_DISABLEDonce Android checks itsenable*flags, which is #209. Until then, they would resolvetrue.startListeningwithout the microphone permission should at least emitcraftSpeechError, so a page is not left waiting on an event.- The Android E2E suite can then run the same
haptic.resolvesTrueandvibrate.resolvesTruecases the iOS suite gained in #207.
Found while fixing #207.