-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prejoin): make initPrejoin sync.
- Loading branch information
1 parent
1f75355
commit 7ab7b68
Showing
8 changed files
with
51 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './functions.any'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { batch } from 'react-redux'; | ||
|
||
import { IStore } from '../app/types'; | ||
import { trackAdded } from '../base/tracks/actions.any'; | ||
|
||
import { PREJOIN_INITIALIZED } from './actionTypes'; | ||
import { setPrejoinDeviceErrors } from './actions.web'; | ||
|
||
export * from './functions.any'; | ||
|
||
/** | ||
* Action used to signal that the prejoin page has been initialized. | ||
* | ||
* @returns {Object} | ||
*/ | ||
function prejoinInitialized() { | ||
return { | ||
type: PREJOIN_INITIALIZED | ||
}; | ||
} | ||
|
||
/** | ||
* Adds all the newly created tracks to store on init. | ||
* | ||
* @param {Object[]} tracks - The newly created tracks. | ||
* @param {Object} errors - The errors from creating the tracks. | ||
* @param {Function} dispatch - The redux dispatch function. | ||
* @returns {void} | ||
*/ | ||
export function initPrejoin(tracks: Object[], errors: Object, dispatch?: IStore['dispatch']) { | ||
if (!dispatch) { | ||
return; | ||
} | ||
|
||
batch(() => { | ||
dispatch(setPrejoinDeviceErrors(errors)); | ||
dispatch(prejoinInitialized()); | ||
|
||
tracks.forEach(track => dispatch(trackAdded(track))); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters