-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix decodeFile Null Crash #556
base: main
Are you sure you want to change the base?
Conversation
…lesDir(). Adds a fallback to internal storage for rare cases.
… cannot be loaded.
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.
@tobitech can you please fix lint issues
fileSavePath = context.getDir("SmileID", MODE_PRIVATE).absolutePath | ||
// Primary: /storage/emulated/0/Android/data/<package name>/files/SmileID | ||
// Fallback: /data/user/0/<package name>/app_SmileID | ||
fileSavePath = context.getExternalFilesDir("SmileID")?.absolutePath |
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.
the fallback will never work fyi
this is because the app data is always available. you need to change this to implementation to see if the externalFileDir is available, then use it (this will be an api check I believe), then use it otherwise use the primary implementation
…e confirmation dialog as opposed to reading from file.
…model before showing image confirmation.
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 believe you have to change the error title @tobitech
lib/src/main/java/com/smileidentity/viewmodel/SelfieViewModel.kt
Outdated
Show resolved
Hide resolved
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.
Code changes look fine to me. Tested and works on my SM M21. Great work @tobitech
SmileIDCrashReporting.hub.captureException(e) | ||
onError(e) |
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.
@jumaallan I think we might have deleted the onError by accident? We should likely keep it to trigger the error 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.
Batman lol, left a few comments
try { | ||
BitmapPainter(BitmapFactory.decodeFile(path).asImageBitmap()) | ||
BitmapFactory.decodeFile(path)?.let { bitmap: Bitmap -> |
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 as long as we don't sample this bitmap this will always crash with OOM
- We don't need a high quality image for display
- This may also need to be done async as well
) | ||
} | ||
// when { | ||
// showInstructions && !acknowledgedInstructions -> SmartSelfieInstructionsScreen( |
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.
undo/delete?
Story: https://app.shortcut.com/smileid/story/15206
Summary
Known Issues
N/A.
Test Instructions
selfieToConfirm
to null before the check for file validity inSelfieViewModel.kt
.Screenshot
N/A