rn: adapt to API changes in google signin
This commit is contained in:
parent
4591b36c3e
commit
54a9b9199e
|
@ -35,6 +35,15 @@ class GoogleApi {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current tokens.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getTokens(): Promise<*> {
|
||||
return GoogleSignin.getTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the available YouTube streams the user can use for live
|
||||
* streaming.
|
||||
|
|
|
@ -119,13 +119,22 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog<Props> {
|
|||
* @returns {void}
|
||||
*/
|
||||
_onUserChanged(response) {
|
||||
if (response && response.accessToken) {
|
||||
googleApi.getYouTubeLiveStreams(response.accessToken)
|
||||
.then(broadcasts => {
|
||||
this.setState({
|
||||
broadcasts
|
||||
if (response) {
|
||||
googleApi.getTokens()
|
||||
.then(tokens => {
|
||||
googleApi.getYouTubeLiveStreams(tokens.accessToken)
|
||||
.then(broadcasts => {
|
||||
this.setState({
|
||||
broadcasts
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.setState({
|
||||
broadcasts: undefined,
|
||||
streamKey: undefined
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
broadcasts: undefined,
|
||||
|
|
Loading…
Reference in New Issue