Browse Source

fix(rn) disable pip while authorising dropbox

master
tmoldovan8x8 4 years ago
parent
commit
8eaf99586e
No account linked to committer's email address

+ 13
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/DropboxModule.java View File

184
     public void onHostResume() {
184
     public void onHostResume() {
185
         DbxCredential credential = Auth.getDbxCredential();
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
             this.promise = null;
200
             this.promise = null;
195
         }
201
         }
202
+
196
     }
203
     }
197
 }
204
 }

+ 5
- 2
react/features/dropbox/actions.js View File

1
 // @flow
1
 // @flow
2
-
3
 import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
2
 import { UPDATE_DROPBOX_TOKEN } from './actionTypes';
4
 import { _authorizeDropbox } from './functions';
3
 import { _authorizeDropbox } from './functions';
4
+import logger from './logger';
5
 
5
 
6
 /**
6
 /**
7
  * Action to authorize the Jitsi Recording app in dropbox.
7
  * Action to authorize the Jitsi Recording app in dropbox.
24
 
24
 
25
         _authorizeDropbox(dropbox.appKey, redirectURI)
25
         _authorizeDropbox(dropbox.appKey, redirectURI)
26
             .then(
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 View File

4
 
4
 
5
 const { Dropbox } = NativeModules;
5
 const { Dropbox } = NativeModules;
6
 
6
 
7
+import { setPictureInPictureDisabled } from '../mobile/picture-in-picture/functions';
8
+
7
 /**
9
 /**
8
  * Action to authorize the Jitsi Recording app in dropbox.
10
  * Action to authorize the Jitsi Recording app in dropbox.
9
  *
11
  *
10
  * @returns {Promise<Object>} - The promise will be resolved with the dropbox
12
  * @returns {Promise<Object>} - The promise will be resolved with the dropbox
11
  * access token or rejected with an error.
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…
Cancel
Save