You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.native.ts 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Linking } from 'react-native';
  2. import { IStore } from '../app/types';
  3. import { isTokenAuthEnabled } from '../authentication/functions';
  4. import { hangup } from '../base/connection/actions.native';
  5. import { openDialog } from '../base/dialog/actions';
  6. import LogoutDialog from './components/native/LogoutDialog';
  7. /**
  8. * Opens {@code LogoutDialog}.
  9. *
  10. * @returns {Function}
  11. */
  12. export function openLogoutDialog() {
  13. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  14. const state = getState();
  15. const { conference } = state['features/base/conference'];
  16. const config = state['features/base/config'];
  17. const logoutUrl = config.tokenLogoutUrl;
  18. dispatch(openDialog(LogoutDialog, {
  19. onLogout() {
  20. if (isTokenAuthEnabled(config)) {
  21. if (logoutUrl) {
  22. Linking.openURL(logoutUrl);
  23. }
  24. dispatch(hangup(true));
  25. } else {
  26. conference?.room.xmpp.moderator.logout(() => dispatch(hangup(true)));
  27. }
  28. }
  29. }));
  30. };
  31. }
  32. /**
  33. * Changes the display name for the local user.
  34. *
  35. * @param {string} _nickname - The new display name.
  36. * @returns {Function}
  37. */
  38. export function changeLocalDisplayName(_nickname = '') {
  39. // not used on mobile.
  40. return (_dispatch: IStore['dispatch'], _getState: IStore['getState']) => {
  41. // no-op action.
  42. };
  43. }