Fix: don't ask for permission on startup #152
Merged
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.
solves #132
Camera access is asked as soon as ARKit is initialized.
This can be either if you mount it, or use any of the api methods (like
ARKit.getCurrentLightEstimation()) or similar.We always cleared the scene on startup to prevent inconsistancy when doing a "soft reload" of the app (e.g. if you do live-reload on development).
Now, we no longer clear the scene if it has not been initialized and so camera permission is not asked until you mount the ARView or use any of the api of ARKit.
We additionally provide a function that tells you whether arkit has been initialized. This is usuefull if you use the arkit api outside of a component (e.g. in a background process / saga) and want to prevent camera access until arkit has been initialized).
New API:
ARKit.isInitialized()returns a promise with a boolean whether arkit has been initializedARKit.isMounted()(experimental) returns a promise with a boolean whether arkit has been mounted (= is in view hierarchy)