Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

functions.native.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import { NativeModules } from 'react-native';
  3. const { Dropbox } = NativeModules;
  4. /**
  5. * Action to authorize the Jitsi Recording app in dropbox.
  6. *
  7. * @param {string} appKey - The Jitsi Recorder dropbox app key.
  8. * @param {string} redirectURI - The return URL.
  9. * @returns {Promise<string>} - The promise will be resolved with the dropbox
  10. * access token or rejected with an error.
  11. */
  12. export function _authorizeDropbox(): Promise<string> {
  13. return Dropbox.authorize()
  14. .then(token => {
  15. return { token };
  16. });
  17. }
  18. /**
  19. * Returns the display name for the current dropbox account.
  20. *
  21. * @param {string} token - The dropbox access token.
  22. * @returns {Promise<string>} - The promise will be resolved with the display
  23. * name or rejected with an error.
  24. */
  25. export function getDisplayName(token: string) {
  26. return Dropbox.getDisplayName(token);
  27. }
  28. /**
  29. * Returns information about the space usage for the current dropbox account.
  30. *
  31. * @param {string} token - The dropbox access token.
  32. * @returns {Promise<{ used: number, allocated: number}>} - The promise will be
  33. * resolved with the object with information about the space usage (the used
  34. * space and the allocated space) for the current dropbox account or rejected
  35. * with an error.
  36. */
  37. export function getSpaceUsage(token: string) {
  38. return Dropbox.getSpaceUsage(token);
  39. }
  40. /**
  41. * Returns <tt>true</tt> if the dropbox features is enabled and <tt>false</tt>
  42. * otherwise.
  43. *
  44. * @param {Object} state - The redux state.
  45. * @returns {boolean}
  46. */
  47. export function isEnabled(state: Object) {
  48. const { dropbox = {} } = state['features/base/config'];
  49. return Dropbox.ENABLED && typeof dropbox.appKey === 'string';
  50. }