ReviewOS

also looking at this

craft-native/craft

feat(ios): haptic, whose reason expired when ios_config landed

#134
Merged glennmichael123 wants to merge fix/sdk-event-map into main
18 files +562 -163
packages/typescript/types/craft.d.tsmodified+81-9
Changes to packages/typescript/types/craft.d.ts
@@ -1145,13 +1145,33 @@ export interface PickedFile {
11451145 mimeType?: string;
11461146}
11471147
1148/**
1149 * A location fix, exactly as the bridge sends it.
1150 *
1151 * All eight fields are always present. The native dictionary is built
1152 * unconditionally from `CLLocation`'s non-optional properties, so there is no
1153 * path that omits one — and this type previously declared six of them, three
1154 * of those optional, which left `altitudeAccuracy` and `timestamp` unreachable
1155 * from TypeScript even though every fix carries them.
1156 *
1157 * `heading` and `speed` are `-1` when the device has no fix for them, which is
1158 * CoreLocation's own sentinel rather than an absent key. Android has no
1159 * geolocation surface, so nothing else fills this in.
1160 */
11481161export interface Position {
11491162 latitude: number;
11501163 longitude: number;
1164 /** Horizontal accuracy in metres. */
11511165 accuracy: number;
1152 altitude?: number;
1153 speed?: number;
1154 heading?: number;
1166 altitude: number;
1167 /** Vertical accuracy in metres. */
1168 altitudeAccuracy: number;
1169 /** Course over ground in degrees, or `-1` when unavailable. */
1170 heading: number;
1171 /** Metres per second, or `-1` when unavailable. */
1172 speed: number;
1173 /** Milliseconds since the Unix epoch. */
1174 timestamp: number;
11551175}
11561176
11571177export interface Contact {
@@ -1378,12 +1398,29 @@ export interface CraftARPlaneEvent extends CustomEvent {
13781398 detail: ARPlaneEvent;
13791399}
13801400
1401/**
1402 * A home-screen quick action being tapped.
1403 *
1404 * **Never dispatched today.** `craft.shortcuts.set()` really does install the
1405 * items and they appear in the long-press menu, but no template implements
1406 * `application(_:performActionFor:completionHandler:)` or a scene-delegate
1407 * equivalent, so a tap launches the app and stops there. A listener registered
1408 * for this is never called.
1409 */
13811410export interface CraftShortcutEvent extends CustomEvent {
13821411 detail: {
13831412 type: string;
13841413 };
13851414}
13861415
1416/**
1417 * A donated Siri shortcut being invoked.
1418 *
1419 * **Never dispatched today.** `craft.siri.register()` donates an
1420 * `NSUserActivity`, but the only `onContinueUserActivity` in the template is
1421 * bound to `NSUserActivityTypeBrowsingWeb` and routes to the deep-link
1422 * handler, so invoking a donated shortcut relaunches the app and is dropped.
1423 */
13871424export interface CraftSiriShortcutEvent extends CustomEvent {
13881425 detail: SiriInvocationEvent;
13891426}
@@ -1402,13 +1439,38 @@ export interface CraftWatchContextEvent extends CustomEvent {
14021439 detail: Record<string, any>;
14031440}
14041441
1405export interface CraftVoiceActionEvent extends CustomEvent {
1442export interface CraftLocationUpdateEvent extends CustomEvent {
1443 detail: Position;
1444}
1445
1446export interface CraftLocationErrorEvent extends CustomEvent {
14061447 detail: {
1407 action: string;
1408 data?: string;
1448 message: string;
14091449 };
14101450}
14111451
1452export interface CraftNetworkChangeEvent extends CustomEvent {
1453 detail: NetworkStatus;
1454}
1455
1456export interface CraftPushTokenEvent extends CustomEvent {
1457 detail: {
1458 token: string;
1459 };
1460}
1461
1462/**
1463 * The `userInfo` of the notification the user acted on, forwarded verbatim.
1464 * The bridge does not reshape it, so its keys are whatever was scheduled.
1465 */
1466export interface CraftNotificationResponseEvent extends CustomEvent {
1467 detail: Record<string, any>;
1468}
1469
1470export interface CraftWatchUserInfoEvent extends CustomEvent {
1471 detail: Record<string, any>;
1472}
1473
14121474export interface CraftErrorEvent extends CustomEvent {
14131475 detail: CraftError;
14141476}
@@ -1428,14 +1490,24 @@ declare global {
14281490 craftMotionUpdate: CraftMotionUpdateEvent;
14291491 craftBluetoothDevice: CraftBluetoothDeviceEvent;
14301492 craftARPlane: CraftARPlaneEvent;
1431 craftShortcut: CraftShortcutEvent;
1432 craftSiriShortcut: CraftSiriShortcutEvent;
1493 craftLocationUpdate: CraftLocationUpdateEvent;
1494 craftLocationError: CraftLocationErrorEvent;
1495 craftNetworkChange: CraftNetworkChangeEvent;
1496 craftPushToken: CraftPushTokenEvent;
1497 craftNotificationResponse: CraftNotificationResponseEvent;
14331498 craftWatchMessage: CraftWatchMessageEvent;
14341499 craftWatchReachability: CraftWatchReachabilityEvent;
14351500 craftWatchContext: CraftWatchContextEvent;
1436 craftVoiceAction: CraftVoiceActionEvent;
1501 craftWatchUserInfo: CraftWatchUserInfoEvent;
14371502 craftError: CraftErrorEvent;
14381503 craftDeepLink: CraftDeepLinkEvent;
1504 // Kept, and kept last, because nothing dispatches either one: the app
1505 // installs the shortcuts and donates the activities, and no template
1506 // implements the callback that would deliver a tap. Typed so the listener
1507 // an app writes today compiles against the shape it will receive if that
1508 // lands; see the note on each interface.
1509 craftShortcut: CraftShortcutEvent;
1510 craftSiriShortcut: CraftSiriShortcutEvent;
14391511 }
14401512}
14411513