feat: model status API, useDataDetector hook, and Android language selection#4
Merged
Conversation
- Rename downloadModel() -> prepareModel({ language? }); keep downloadModel as a
deprecated alias.
- Add getModelStatus()/isModelReady() to query model availability (iOS always ready).
- Add useDataDetector() hook: tracks status (notDownloaded/downloading/ready/error),
auto-downloads on Android, exposes detect/prepare.
- Android multi-language: detect/prepareModel/getModelStatus/useDataDetector accept a
language option (15 ISO 639-1 codes -> ML Kit models); default 'en'. iOS is
language-agnostic and ignores it.
- Add @types/react + react devDependencies; document the new API and update the example.
Version bump and changelog cut are intentionally left for release time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
downloadModel()→prepareModel({ language? }).downloadModel()stays as a deprecated alias (non-breaking).getModelStatus()→'ready' | 'notDownloaded'andisModelReady(). iOS always reports ready.useDataDetector()hook: tracksstatus(notDownloaded | downloading | ready | error), exposesdetect/prepare/isReady/error, and auto-downloads the model on Android (opt out viaautoPrepare: false).detect,prepareModel,getModelStatus,isModelReady, and the hook accept alanguageoption — 15 ISO 639-1 codes mapped to ML Kit models. Default'en'. iOS is language-agnostic and ignores it.@types/react+reactdevDependencies (the package now ships a hook), updates README, and reworks the example app to use the hook + a language picker.