fix: import PermissionsAndroid and fix broken permission check in Utils.ts#2107
fix: import PermissionsAndroid and fix broken permission check in Utils.ts#2107anushkasrvstv wants to merge 4 commits into
Conversation
…ls.ts - Add missing PermissionsAndroid import from react-native - Fix requestMultiple([]) no-op by passing WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE for Android < 33 - Return a proper boolean (true only when both permissions granted) instead of an implicit undefined Closes SB2318#2099
|
Thank you @, for creating the PR and contributing to our UltimateHealth project 💗. |
Automated Review FeedbackProvide actionable comments grouped by severity: SuggestionsConsider adding automated tests (e.g., integration or E2E tests) to verify the correct behavior of permission requests on Android. While
|
Pull Request
Description
Fixes three bugs in
frontend/src/helper/Utils.tsaround Android permissionhandling:
PermissionsAndroidwas used but never importedfrom
react-native, causing aReferenceErrorand crash on Android.requestMultiple([])was called with anempty array, so it requested zero permissions even after the import fix.
Now requests
WRITE_EXTERNAL_STORAGEandREAD_EXTERNAL_STORAGEforAndroid versions below API 33.
return;,resolving to
undefinedinstead of a boolean. Callers usingif (await checkPermission())-style logic were gettingundefinedrather than a real pass/fail result. Now returns
trueonly when bothpermissions are granted.
Closes #2099
Type of change
Checklist: