device-orientation-permisson-ui: Don't emit "granted" event until permissions are actually granted.#5079
Conversation
|
It seems I don't fully understand promises 😄 If the |
|
Here's the documentation I can find on
I infer from this that if the function provided in Alternatives to the fix I proposed could be:
I've tested these, and both work - specifically: either adding this line at the end of the or (more convoluted, and I think potentially rather confusing, but it does seem to work).... and then at the end of the |
|
Thanks for the explanation! |
Description:
See #5078
Changes proposed:
Code is currently structured as:
This is flawed, because when the
catchbranch is executed, thethenbranch then gets executed immediately as well.The fix is to restructure the code as follows:
I've also made a small UT fix to check for the non-emission of events at this stage in the process. This change made the script fail without the fix, and it succeeds with the fix in place.
UTs for this component could benefit from some significant extensions, but I'm not sure how soon I'd find time for that, and I didn't want to hold up making this fix available. So I've only implemented this minimal update to the UT alongside this change.