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

(iOS) Avoid repetitive permission prompts #1245

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

jancabadaj
Copy link
Contributor

Platforms affected

iOS

Motivation and Context

resolves #1166

Description

If the app uses WebRTC, the user is initially prompted for permission twice, and then prompted again each time the app is restarted.

The solution is inspired by react:
react-native-webview/react-native-webview#2257

Testing

I tested the changes in a project that is using WebRTC camera streaming.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@vbraun
Copy link
Contributor

vbraun commented Feb 23, 2023

Works for me, for what its worth!

I would consider setting the default to "grant" because nobody wants the repeated permission request.

@agm

This comment was marked as spam.

@phyr0s

This comment was marked as spam.

@dpogue dpogue modified the milestones: 7.1.1, 8.0.0 Aug 15, 2024
@erikramalho

This comment was marked as spam.

@jancabadaj
Copy link
Contributor Author

I fixed merge issues and changed default to 'grant' as suggested

@erikramalho

This comment was marked as spam.

@codecov-commenter
Copy link

codecov-commenter commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.84%. Comparing base (18a80d2) to head (b9d2a04).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1245      +/-   ##
==========================================
- Coverage   80.86%   80.84%   -0.03%     
==========================================
  Files          16       16              
  Lines        1840     1848       +8     
==========================================
+ Hits         1488     1494       +6     
- Misses        352      354       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dpogue
Copy link
Member

dpogue commented Dec 14, 2024

Thanks for doing the work to implement this!

With the "grant by default" behaviour, does that mean things like 3rd party iframes on a page would automatically be able to initiate webcam and microphone access? If so, I don't think we can have it that permissive by default.

A reasonable middle ground would probably be the "grantIfSameHostElsePrompt" behaviour so that the app's same-origin content can access those APIs but any 3rd party origins would result in a prompt.

@jancabadaj
Copy link
Contributor Author

Yes, that is correct. There is still an initial permission request, but once the app has permission, any site can access the webcam and microphone with "grant".

In our use case that is exactly what we need, since we are taking a photo from a website within iframe, but I agree that "grantIfSameHostElsePrompt" might be better as default. I will change it.

@dpogue dpogue merged commit 3737f51 into apache:master Dec 16, 2024
11 checks passed
@jancabadaj jancabadaj deleted the media-permissions branch December 17, 2024 11:30
@erikramalho
Copy link

Do we have an estimated release date for version 8.0.0?

@dpogue
Copy link
Member

dpogue commented Dec 17, 2024

Do we have an estimated release date for version 8.0.0?

@erikramalho No estimated release date because it's entirely dependent on volunteer time to investigate and address the remaining bugs and new features.

@erikramalho
Copy link

Thanks for the answer @dpogue. I'll ask my team to look and see if we can help with any remaining bugs and new features.

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