diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c17bd..1dfefa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.2.0 (unreleased) +### Changed +- **Breaking:** `ScanFromPhotosAsync` is now iOS-only (`[SupportedOSPlatform("ios")]`) and throws `NotSupportedException` on Android — ML Kit cannot start in the gallery, so the Android flow just opened the camera and confused users; Android users reach the gallery through the import button inside `ScanAsync`'s scanner, now always enabled + ### Added - `CancellationToken` parameter on `ScanAsync` and `ScanFromPhotosAsync`; cancelling dismisses the native scanner UI and throws `OperationCanceledException` - Source Link and symbol package (`.snupkg`) so consumers can step into the library diff --git a/README.md b/README.md index 629e99c..adb230b 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,13 @@ Inject `IDocumentScanner` (or use `DocumentScanner.Default` without DI): // Camera scan — returns file paths of cropped pages, empty list if the user cancels IReadOnlyList pages = await scanner.ScanAsync(); -// Crop already-taken photos from the photo library -IReadOnlyList pages = await scanner.ScanFromPhotosAsync(); +// iOS only: pick already-taken photos, then adjust each crop in the corner editor. +// On Android this throws NotSupportedException, so guard it. +if (OperatingSystem.IsIOS()) + pages = await scanner.ScanFromPhotosAsync(); // With options -var pages = await scanner.ScanAsync(new DocumentScanOptions +pages = await scanner.ScanAsync(new DocumentScanOptions { PageLimit = 3, Mode = DocumentScannerMode.Base, // Android only: Full, BaseWithFilter, or Base @@ -61,10 +63,10 @@ var pages = await scanner.ScanAsync(new DocumentScanOptions // With cancellation — dismisses the native UI and throws OperationCanceledException using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2)); -var pages = await scanner.ScanAsync(cancellationToken: cts.Token); +pages = await scanner.ScanAsync(cancellationToken: cts.Token); ``` -Check `scanner.IsSupported` first; `ScanAsync` throws `NotSupportedException` on devices without a scanner implementation. +Check `scanner.IsSupported` first. On Android `ScanAsync` throws `NotSupportedException` when ML Kit reports the device is unsupported (under ~1.7 GB RAM). Returned files are JPEGs written to the app's cache directory — move or copy them if you need them to persist. @@ -72,9 +74,9 @@ Returned files are JPEGs written to the app's cache directory — move or copy t | | Android | iOS | |---|---|---| -| `ScanAsync` | ML Kit scanner UI | VisionKit document camera | -| `ScanFromPhotosAsync` | ML Kit scanner with gallery import | Photo picker + auto-detected corners + manual corner editor | -| `PageLimit` | Applies to both methods | Photo import only (VisionKit has no limit) | +| `ScanAsync` | ML Kit scanner UI, with an import-from-gallery button | VisionKit document camera | +| `ScanFromPhotosAsync` | Not supported — ML Kit cannot start in the gallery, so the API throws `NotSupportedException` | Photo picker + auto-detected corners + manual corner editor | +| `PageLimit` | Applies to the scanner | `ScanFromPhotosAsync` only (VisionKit has no limit) | | `Mode` | Full / BaseWithFilter / Base | Ignored | ## Sample diff --git a/samples/ScanTest/MainPage.xaml b/samples/ScanTest/MainPage.xaml index 6229e34..68eddc5 100644 --- a/samples/ScanTest/MainPage.xaml +++ b/samples/ScanTest/MainPage.xaml @@ -12,7 +12,8 @@