-
Notifications
You must be signed in to change notification settings - Fork 54
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
[VBLOCKS-3256] Feat: listen for navigator permissions changes #283
Conversation
437cad3
to
aee840f
Compare
aee840f
to
698148f
Compare
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.
Left some comments. Also
- add changelog
- update from master
lib/twilio/audiohelper.ts
Outdated
@@ -275,6 +275,16 @@ class AudioHelper extends EventEmitter { | |||
if (isEnumerationSupported) { | |||
this._initializeEnumeration(); | |||
} | |||
|
|||
navigator.permissions.query({ name: 'microphone' as PermissionName }).then((microphonePermissionStatus) => { |
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.
Do we need to cast 'microphone' as PermissionName
here? I don't believe so from my testing unless I'm missing something.
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.
My VScode is giving my a type error, but it looks like it compiles fine without the typecast 👍
tests/audiohelper.js
Outdated
navigator.permissions.query = () => Promise.resolve(microphonePermissionStatus); | ||
audio = new AudioHelper(onActiveOutputsChanged, onActiveInputChanged, {}); |
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.
It seems like this test might not going through SDK codepaths, unless my understanding is incorrect. If you remove these two lines, I don't think much changes? It seems like you're creating the microphonePermissionStatus
object above and then lines 172~173
test that code path?
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 see your point :( . I am having a hard time testing this feature correctly. Any suggestions?
cc: @charliesantos
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.
Let's get the implementation approved then I'll review the tests 😄
That way, we don't have to keep updating the tests while we review the PR.
tests/audiohelper.js
Outdated
navigator.permissions.query = () => Promise.resolve(microphonePermissionStatus); | ||
audio = new AudioHelper(onActiveOutputsChanged, onActiveInputChanged, {}); |
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.
Let's get the implementation approved then I'll review the tests 😄
That way, we don't have to keep updating the tests while we review the PR.
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.
@kpchoy +1 on the implementation. Please check the tests and +1 if you approve.
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.
Manual test lgtm +1
Contributing to Twilio
Pull Request Details
JIRA link(s):
Description
Reference issue: #228
Burndown
Tested:
Before review
npm test
Before merge