fix(rn,tracks) fix not showing alert when permission is not granted

The error object changed its shape through time, adapt to the change.
This commit is contained in:
Saúl Ibarra Corretgé 2021-03-05 11:52:38 +01:00 committed by Saúl Ibarra Corretgé
parent b7b260f4c9
commit d93a402cc2
1 changed files with 7 additions and 13 deletions

View File

@ -598,26 +598,20 @@ function _disposeTracks(tracks) {
* Implements the {@code Promise} rejection handler of
* {@code createLocalTracksA} and {@code createLocalTracksF}.
*
* @param {Object} reason - The {@code Promise} rejection reason.
* @param {Object} error - The {@code Promise} rejection reason.
* @param {string} device - The device/{@code MEDIA_TYPE} associated with the
* rejection.
* @private
* @returns {Function}
*/
function _onCreateLocalTracksRejected({ gum }, device) {
function _onCreateLocalTracksRejected(error, device) {
return dispatch => {
// If permissions are not allowed, alert the user.
if (gum) {
const { error } = gum;
if (error) {
dispatch({
type: TRACK_CREATE_ERROR,
permissionDenied: error.name === 'SecurityError',
trackType: device
});
}
}
dispatch({
type: TRACK_CREATE_ERROR,
permissionDenied: error?.name === 'SecurityError',
trackType: device
});
};
}