maniac-tech / maniac-tech/react-native-expo-read-sms
`status === PermissionAndroid.RESULTS.GRANTED` would be checking text against an object.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
from what I have seen, status in this case would return
```
{
"android.permission.RECEIVE_SMS": "granted",
"android.permission.READ_SMS": "denied"
}
```
so `status === PermissionAndroid.RESULTS.GRANTED` would be checking text against an object.
this can be rewritten as:
```
const status = await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.RECEIVE_SMS,
PermissionsAndroid.PERMISSIONS.READ_SMS,
]);
const granted = PermissionsAndroid.RESULTS.GRANTED;
const denied = PermissionsAndroid.RESULTS.DENIED;
const neverAskAgain = PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN;
if (status[PermissionsAndroid.PERMISSIONS.RECEIVE_SMS] === granted &&
status[PermissionsAndroid.PERMISSIONS.READ_SMS] === granted) {
return true;
}
if ([status[PermissionsAndroid.PERMISSIONS.RECEIVE_SMS], status[PermissionsAndroid.PERMISSIONS.READ_SMS]].includes(denied)) {
console.log("Read/Receive SMS permission denied by user.", status);
} else if ([status[PermissionsAndroid.PERMISSIONS.RECEIVE_SMS], status[PermissionsAndroid.PERMISSIONS.READ_SMS]].includes(neverAskAgain)) {
console.log("Read/Receive SMS permission revoked by user.", status);
}
```
_Originally posted by @alokpant in https://github.com/maniac-tech/react-native-expo-read-sms/pull/76#discussion_r1863434353_
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the permission-handling code discussed in the issue and inspect the requestMultiple result against the listed RECEIVE_SMS and READ_SMS permissions. Done means the code checks both returned permission values individually and distinguishes granted, denied, and never-ask-again; no file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100