Skip to content
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: if camera permission cannot be requested go to settings #2299

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

santhoshvai
Copy link
Member

🎯 Goal

fixes #2047

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

: await ImagePicker.requestCameraPermissionsAsync();
const canRequest = permissionCheck.canAskAgain;
let permissionGranted = permissionCheck.granted;
if (!canRequest && !permissionGranted) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify the condition as?

if (!permissionGranted) {
  if(canRequest) {
        const response = await ImagePicker.requestCameraPermissionsAsync();
        permissionGranted = response.granted;
  } else {
        Linking.openSettings();
        return { cancelled: true };
  }
} else {
// lines here 
}

@khushal87 khushal87 merged commit 80c2c36 into develop Nov 14, 2023
@khushal87 khushal87 deleted the camera-perms branch November 14, 2023 12:42
@github-actions github-actions bot mentioned this pull request Nov 14, 2023
6 tasks
@stream-ci-bot
Copy link
Contributor

🎉 This PR is included in version 5.22.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If user doesn't allow camera permissions, and clicks again on camera - nothing happens
3 participants