-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: updated camera to react-native-vision 3 #1046
feat: updated camera to react-native-vision 3 #1046
Conversation
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
c3c470f
to
456d7f7
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1046 +/- ##
==========================================
+ Coverage 61.77% 62.09% +0.32%
==========================================
Files 170 171 +1
Lines 5467 5466 -1
Branches 1574 1571 -3
==========================================
+ Hits 3377 3394 +17
+ Misses 2066 2048 -18
Partials 24 24 ☔ View full report in Codecov by Sentry. |
What was the issue on API 30? Just so we can look out for it |
Looks like you may need to update the gradle lockfile in Bifold too |
I'd get a repetitive error saying failed to load depricated vision dynamite module |
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
@wadeking98 We go back pretty far for Android API compatibility - no? Do you think we'll loose anything with this change? |
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
I've fixed the issue for api level 29 but I'm still running into issues with API level 30: mrousavy/react-native-vision-camera#2287 |
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
…ent-react-native into feat-update-camera
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
I've confirmed this is working with API level 29, 30, 31 now |
export const SCREEN_WIDTH = Dimensions.get('window').width | ||
export const SCREEN_HEIGHT = Platform.select<number>({ | ||
android: Dimensions.get('screen').height - StaticSafeAreaInsets.safeAreaInsetsBottom, | ||
ios: Dimensions.get('window').height, | ||
}) as number | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this behave on tablets when they switch between portrait and landscape on the camera screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question, BC Wallet is locked in portrait mode so it shouldn't be an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's locked in portrait mode on tablets, only on phones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on the pixel tablet with auto rotate turned on and the BC Wallet app was locked in portrait mode on that device
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Maybe it's just unlocked on iPads. We should ask @jleach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is a known issue with the library:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could downgrade to version 2 or switch to another library but that may introduce it's own dependency issues and IMHO that seems like a lot of work to address what would be a minor inconvenience to only a handful of users, especially when it looks like this issue is going to be fixed in the library eventually. What are your thoughts @bryce-mcmath @jleach ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would tend to agree with that but what happened with testing older Android versions that we still support? I remember you saying something like API 24 wasn't scanning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I just tested it again on my mac environment and it worked fine on API 24. I think maybe I just didn't try moving the camera around last time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then I'm ok to move forward with this. Might want to wait until Clecio gets back and takes a look at it but I think you've done a great job
Signed-off-by: wadeking98 <[email protected]>
…ent-react-native into feat-update-camera
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
@@ -42,6 +44,10 @@ const App = () => { | |||
SplashScreen.hide() | |||
}, []) | |||
|
|||
if (!isTablet()) { | |||
Orientation.lockToPortrait() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to support landscape but just lock the camera screen to portrait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we decided against landscape mode in mobile view?
@@ -42,6 +44,10 @@ const App = () => { | |||
SplashScreen.hide() | |||
}, []) | |||
|
|||
if (!isTablet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some helper functions that use the screen dimensions for this. I think its better if we don't use both. If not in this PR can you create a technical debt ticket to clean this up at a later point?
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we only use the official package isTablet
function and get rid of our helper version of it?
Signed-off-by: wadeking98 <[email protected]>
Signed-off-by: wadeking98 <[email protected]>
Summary of Changes
Replaced the depricated RNCamera module with react-native-vision-camera. Updated tests to be compatible. I had to make some modifications to the android permissions text... but it looks like they weren't being used anyway for some reason. This should be a transparent change, I've tested in the android emulator API version 30 and 32, as well as an iphone physical device. I was running into an issue on API version 30, but I wasn't sure if that was just a problem with the emulator itself. Other than android API 30 it works great on all versions. I'd appreciate some help testing the changes on different versions especially on android.
Additionally I've made sure the torch functionality works well.
Other advantages of this library:
It provides support for non QR code barcodes out of the box so we can provide more specific error messages if the user tries to scan their driver's license, etc.
Related Issues
Fixes bcgov/bc-wallet-mobile#1653
Pull Request Checklist
Tick all boxes below to demonstrate that you have completed the respective task. If the item does not apply to your this PR check it anyway to make it apparent that there's nothing to do.
Signed-off-by
line (we use the DCO GitHub app to enforce this);If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!
Pro Tip 🤓
PR template adapted from the Python attrs project.