From 54a9b9199e9125483e0a1c4277e4531b23981200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 18 Jun 2019 13:16:49 +0200 Subject: [PATCH] rn: adapt to API changes in google signin --- react/features/google-api/googleApi.native.js | 9 ++++++++ .../native/StartLiveStreamDialog.js | 21 +++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/react/features/google-api/googleApi.native.js b/react/features/google-api/googleApi.native.js index 38a99d14f..06b25f2f7 100644 --- a/react/features/google-api/googleApi.native.js +++ b/react/features/google-api/googleApi.native.js @@ -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. diff --git a/react/features/recording/components/LiveStream/native/StartLiveStreamDialog.js b/react/features/recording/components/LiveStream/native/StartLiveStreamDialog.js index f753709d4..ce0e2ac49 100644 --- a/react/features/recording/components/LiveStream/native/StartLiveStreamDialog.js +++ b/react/features/recording/components/LiveStream/native/StartLiveStreamDialog.js @@ -119,13 +119,22 @@ class StartLiveStreamDialog extends AbstractStartLiveStreamDialog { * @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,