Explorar el Código

fix(rn) disable pip while authorising dropbox

master
tmoldovan8x8 hace 3 años
padre
commit
8eaf99586e
No account linked to committer's email address

+ 13
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/DropboxModule.java Ver fichero

@@ -184,14 +184,21 @@ class DropboxModule
184 184
     public void onHostResume() {
185 185
         DbxCredential credential = Auth.getDbxCredential();
186 186
 
187
-        if (credential != null && this.promise != null) {
188
-            WritableMap result = Arguments.createMap();
189
-            result.putString("token", credential.getAccessToken());
190
-            result.putString("rToken", credential.getRefreshToken());
191
-            result.putDouble("expireDate", credential.getExpiresAt());
187
+        if (this.promise != null ) {
188
+            if (credential != null) {
189
+                WritableMap result = Arguments.createMap();
190
+                result.putString("token", credential.getAccessToken());
191
+                result.putString("rToken", credential.getRefreshToken());
192
+                result.putDouble("expireDate", credential.getExpiresAt());
193
+
194
+                this.promise.resolve(result);
195
+                this.promise = null;
196
+            } else {
197
+                this.promise.reject("Invalid dropbox credentials");
198
+            }
192 199
 
193
-            this.promise.resolve(result);
194 200
             this.promise = null;
195 201
         }
202
+
196 203
     }
197 204
 }

+ 5
- 2
react/features/dropbox/actions.js Ver fichero

@@ -1,7 +1,7 @@
1 1
 // @flow
2
-
3 2
 import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
4 3
 import { _authorizeDropbox } from './functions';
4
+import logger from './logger';
5 5
 
6 6
 /**
7 7
  * Action to authorize the Jitsi Recording app in dropbox.
@@ -24,7 +24,10 @@ export function authorizeDropbox() {
24 24
 
25 25
         _authorizeDropbox(dropbox.appKey, redirectURI)
26 26
             .then(
27
-                ({ token, rToken, expireDate }) => dispatch(updateDropboxToken(token, rToken, expireDate)));
27
+                ({ token, rToken, expireDate }) => {
28
+                    dispatch(updateDropboxToken(token, rToken, expireDate));
29
+                })
30
+            .catch(error => logger.log('Cannot authorize dropbox', error));
28 31
     };
29 32
 }
30 33
 

+ 10
- 2
react/features/dropbox/functions.native.js Ver fichero

@@ -4,14 +4,22 @@ import { NativeModules } from 'react-native';
4 4
 
5 5
 const { Dropbox } = NativeModules;
6 6
 
7
+import { setPictureInPictureDisabled } from '../mobile/picture-in-picture/functions';
8
+
7 9
 /**
8 10
  * Action to authorize the Jitsi Recording app in dropbox.
9 11
  *
10 12
  * @returns {Promise<Object>} - The promise will be resolved with the dropbox
11 13
  * access token or rejected with an error.
12 14
  */
13
-export function _authorizeDropbox(): Promise<Object> {
14
-    return Dropbox.authorize();
15
+export async function _authorizeDropbox(): Promise<Object> {
16
+    setPictureInPictureDisabled(true);
17
+
18
+    try {
19
+        return await Dropbox.authorize();
20
+    } finally {
21
+        setPictureInPictureDisabled(false);
22
+    }
15 23
 }
16 24
 
17 25
 /**

Loading…
Cancelar
Guardar