@chipmobilesdk/rn-camera 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,34 +1,107 @@
1
- # Changelog — @chipmobilesdk/rn-camera
2
-
3
- All notable changes to this package are documented here. The package follows semantic versioning.
4
-
5
- ## 0.1.0 — 2026-07-26
6
-
7
- Initial release. New package, no existing consumers, **no migration required**.
8
-
9
- ### Added
10
-
11
- - **Permission handling** as a seven-state contract (`undetermined`, `requesting`, `granted`, `denied`, `deniedPermanently`, `unavailable`, `unsupported`). Reading status never prompts; requesting never re-prompts after a permanent denial; revocations made in system settings are pushed to subscribers without an app restart.
12
- - **`CameraPreview`** surface with `cover`/`contain` resize modes, an overlay slot via `children`, and pass-through of consumer accessibility properties. Ships no styled UI and takes no theme dependency.
13
- - **Still capture** returning a file reference plus metadata. Undeterminable fields (`fileSize`, `orientation`) are explicitly marked unavailable rather than guessed or omitted. Quality and max-dimension hints are applied within device limits and reported back as effective values.
14
- - **Session lifecycle** — start, pause, resume, stop — that releases the camera on background, unmount, and stop, restarts on foreground when a surface is still mounted, and reports a single active session per process.
15
- - **Artifact ownership and cleanup**: an optional `destination` on the capture request switches the result to app-owned and writes there directly; everything else lands in the package cache directory. `cleanup()` is idempotent and refuses anything the package does not own. Orphans are swept at initialization under a 24-hour time-to-live.
16
- - **Capability reporting** for camera positions, flash, torch, orientation, and camera-less devices, with capture-time flash modes and a continuous torch that is forced off on pause, stop, and background.
17
- - **Coordinate mapping** — pure, bidirectional, accounting for scale, letterbox or crop, orientation, and front-camera mirroring, accurate within 2 device-independent pixels on a round trip.
18
- - **Typed error taxonomy** of 11 codes, each carrying a `recoverable` flag, plus a `redact()` helper.
19
- - **Test adapter** (`createTestCamera`) implementing the same published ports as the production adapters, so consuming apps can drive every permission, capability, and capture path with no hardware and no permission prompts.
20
- - **Opt-in diagnostics logger**, defaulting to no logging.
21
-
22
- ### Guarantees
23
-
24
- - No network egress of any kind.
25
- - No location read, no location permission requested.
26
- - Nothing written to the device photo library or gallery.
27
- - No capture history or index retained.
28
- - No on-device inference, no frame processor, no AI-derived labels.
29
-
30
- ### Notes
31
-
32
- - `react-native-vision-camera` (>= 5.1.1) is a **peer dependency**; the consuming app installs and links it. This package authors no native source.
33
- - Android `minSdkVersion` remains **24** — VisionCamera 5.1.1 declares 23 and resolves the root project value first.
34
- - The local frame-processing extension point is documented in the README but deliberately not exported. It is designed to arrive as an additive minor release.
1
+ # @chipmobilesdk/rn-camera
2
+
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Packaging only; no code change. The package no longer declares `engines.node`: a
8
+ React Native package does not run on Node, so the field only produced install
9
+ warnings in apps on another Node version. rn-i18n's command-line tooling does run
10
+ on Node; its README's compatibility table states the version it needs. ([#14](https://github.com/operationd8979/chip-mobile-sdk/pull/14))
11
+
12
+ ## [0.2.0] — 2026-11-01
13
+
14
+ Lifecycle and capture-path fixes. **No code change is required**; two behaviours
15
+ change (see Changed), and a store that should manage VisionCamera captures needs a
16
+ `FileSystemBridge` with `move()`.
17
+
18
+ ### Fixed
19
+
20
+ - **`useCameraController` survives a StrictMode remount.** The cleanup disposed the
21
+ only controller and the remount kept it, so the screen showed `idle` forever and
22
+ backgrounding no longer released the camera. A disposed controller is now replaced,
23
+ and constructing one has no side effects (it subscribes on first use), so a
24
+ controller React builds and discards no longer leaks listeners.
25
+ - **`CameraPreview` subscribes to the controller.** It read `controller.state` once
26
+ per render, so the feed could stay unmounted after the session became active unless
27
+ the parent re-rendered. `useCameraState` now uses `useSyncExternalStore`.
28
+ - **A failed capture no longer leaves `capturing: true` published**, and `capturing:
29
+ true` is now published at all — the single-flight slot was taken after the first
30
+ emit. A raw native or engine error is turned into `CameraError('captureFailed')`
31
+ (or `storageFailure` when saving fails), with no file path in the message.
32
+ - **Foregrounding restarts only a session that backgrounding interrupted.** It used
33
+ to start any idle or stopped session while a preview was mounted — including one
34
+ the user had stopped, one never started, and one whose permission had been revoked.
35
+ A foreground that arrives while the release is still running now waits for it
36
+ instead of being dropped.
37
+ - **Use after dispose is defined.** `start`, `resume`, `capture`, and the permission
38
+ and capability reads reject with `CameraError('notReady')`; `stop`, `pause` and
39
+ `cleanup` are safe no-ops.
40
+ - **VisionCamera captures can be cleaned up.** They were saved in VisionCamera's own
41
+ temporary directory, outside the store, so `cleanup()` refused them and the 24-hour
42
+ sweep never saw them. The controller now moves each package-temporary capture into
43
+ the store (`ArtifactStore.adopt`), and the sweep spares captures adopted by the
44
+ running process. With no store, or a bridge without `move()`, the logger reports
45
+ `unmanaged:no-store` / `unmanaged:store-cannot-adopt` once.
46
+ - **No more "Camera is not active" error on every session start.** The feed sent
47
+ `torchMode="off"` on mount; VisionCamera applies it before the camera is active
48
+ and leaves the native rejection unhandled. The prop is now left unset until the
49
+ torch is first turned on.
50
+ - **One throwing state listener no longer breaks a transition** or starves the other
51
+ listeners; it is logged as `listener-threw`.
52
+
53
+ ### Changed
54
+
55
+ - **`effectiveQuality` and `effectiveMaxDimension` report what was applied.** The
56
+ VisionCamera adapter echoed the request hints. Quality is fixed on the photo output
57
+ (0.9) and nothing resizes, so it now reports `0.9` and an unavailable max dimension.
58
+ - **Unmounting a preview over an idle controller leaves it `idle`**, rather than
59
+ driving it through `stopping` to `stopped` and calling the engine's `stop()`.
60
+
61
+ ### Added
62
+
63
+ - `ArtifactStore.adopt?(uri)` and `FileSystemBridge.move?(from, to)`, both optional.
64
+ `createMemoryFileSystem()` implements `move`.
65
+
66
+ ### Docs
67
+
68
+ - The README no longer claims quality and max-dimension hints are applied, or a
69
+ single active session per process.
70
+
71
+ ## 0.1.1 — 2026-08-01
72
+
73
+ ### Changed
74
+
75
+ - The package now ships its agent skill (`skills/`), which consuming apps
76
+ copy in with `scripts/sync-sdk-skills.mjs`. No code change.
77
+
78
+ ## 0.1.0 — 2026-07-26
79
+
80
+ Initial release. New package, no existing consumers, **no migration required**.
81
+
82
+ ### Added
83
+
84
+ - **Permission handling** as a seven-state contract (`undetermined`, `requesting`, `granted`, `denied`, `deniedPermanently`, `unavailable`, `unsupported`). Reading status never prompts; requesting never re-prompts after a permanent denial; revocations made in system settings are pushed to subscribers without an app restart.
85
+ - **`CameraPreview`** surface with `cover`/`contain` resize modes, an overlay slot via `children`, and pass-through of consumer accessibility properties. Ships no styled UI and takes no theme dependency.
86
+ - **Still capture** returning a file reference plus metadata. Undeterminable fields (`fileSize`, `orientation`) are explicitly marked unavailable rather than guessed or omitted. Quality and max-dimension hints are normalized and reported back as effective values.
87
+ - **Session lifecycle** — start, pause, resume, stop — that releases the camera on background, unmount, and stop, restarts on foreground when a surface is still mounted, and reports a single active session per controller.
88
+ - **Artifact ownership and cleanup**: an optional `destination` on the capture request switches the result to app-owned and writes there directly; everything else lands in the package cache directory. `cleanup()` is idempotent and refuses anything the package does not own. Orphans are swept at initialization under a 24-hour time-to-live.
89
+ - **Capability reporting** for camera positions, flash, torch, orientation, and camera-less devices, with capture-time flash modes and a continuous torch that is forced off on pause, stop, and background.
90
+ - **Coordinate mapping** — pure, bidirectional, accounting for scale, letterbox or crop, orientation, and front-camera mirroring, accurate within 2 device-independent pixels on a round trip.
91
+ - **Typed error taxonomy** of 11 codes, each carrying a `recoverable` flag, plus a `redact()` helper.
92
+ - **Test adapter** (`createTestCamera`) implementing the same published ports as the production adapters, so consuming apps can drive every permission, capability, and capture path with no hardware and no permission prompts.
93
+ - **Opt-in diagnostics logger**, defaulting to no logging.
94
+
95
+ ### Guarantees
96
+
97
+ - No network egress of any kind.
98
+ - No location read, no location permission requested.
99
+ - Nothing written to the device photo library or gallery.
100
+ - No capture history or index retained.
101
+ - No on-device inference, no frame processor, no AI-derived labels.
102
+
103
+ ### Notes
104
+
105
+ - `react-native-vision-camera` (>= 5.1.1) is a **peer dependency**; the consuming app installs and links it. This package authors no native source.
106
+ - Android `minSdkVersion` remains **24** — VisionCamera 5.1.1 declares 23 and resolves the root project value first.
107
+ - The local frame-processing extension point is documented in the README but deliberately not exported. It is designed to arrive as an additive minor release.