fix(rn) disable pip while authorising dropbox
This commit is contained in:
parent
c7ad5b5b26
commit
8eaf99586e
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue