fix(rn) disable pip while authorising dropbox

This commit is contained in:
tmoldovan8x8 2021-09-14 12:37:08 +03:00 committed by GitHub
parent c7ad5b5b26
commit 8eaf99586e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 10 deletions

View File

@ -184,14 +184,21 @@ class DropboxModule
public void onHostResume() {
DbxCredential credential = Auth.getDbxCredential();
if (credential != null && this.promise != null) {
WritableMap result = Arguments.createMap();
result.putString("token", credential.getAccessToken());
result.putString("rToken", credential.getRefreshToken());
result.putDouble("expireDate", credential.getExpiresAt());
if (this.promise != null ) {
if (credential != null) {
WritableMap result = Arguments.createMap();
result.putString("token", credential.getAccessToken());
result.putString("rToken", credential.getRefreshToken());
result.putDouble("expireDate", credential.getExpiresAt());
this.promise.resolve(result);
this.promise = null;
} else {
this.promise.reject("Invalid dropbox credentials");
}
this.promise.resolve(result);
this.promise = null;
}
}
}

View File

@ -1,7 +1,7 @@
// @flow
import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
import { _authorizeDropbox } from './functions';
import logger from './logger';
/**
* Action to authorize the Jitsi Recording app in dropbox.
@ -24,7 +24,10 @@ export function authorizeDropbox() {
_authorizeDropbox(dropbox.appKey, redirectURI)
.then(
({ token, rToken, expireDate }) => dispatch(updateDropboxToken(token, rToken, expireDate)));
({ token, rToken, expireDate }) => {
dispatch(updateDropboxToken(token, rToken, expireDate));
})
.catch(error => logger.log('Cannot authorize dropbox', error));
};
}

View File

@ -4,14 +4,22 @@ import { NativeModules } from 'react-native';
const { Dropbox } = NativeModules;
import { setPictureInPictureDisabled } from '../mobile/picture-in-picture/functions';
/**
* Action to authorize the Jitsi Recording app in dropbox.
*
* @returns {Promise<Object>} - The promise will be resolved with the dropbox
* access token or rejected with an error.
*/
export function _authorizeDropbox(): Promise<Object> {
return Dropbox.authorize();
export async function _authorizeDropbox(): Promise<Object> {
setPictureInPictureDisabled(true);
try {
return await Dropbox.authorize();
} finally {
setPictureInPictureDisabled(false);
}
}
/**