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.

IncomingCallApp.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // @flow
  2. import { BaseApp } from '../../../base/app';
  3. import { incomingCallReceived } from '../actions';
  4. import IncomingCallPage from './IncomingCallPage';
  5. /**
  6. * The type of the React {@code Component} props of {@link IncomingCallApp}.
  7. */
  8. type Props = {
  9. /**
  10. * URL of the avatar for the caller.
  11. */
  12. callerAvatarURL: string,
  13. /**
  14. * Name of the caller.
  15. */
  16. callerName: string,
  17. /**
  18. * Whether this is a video call or not.
  19. */
  20. hasVideo: boolean
  21. };
  22. /**
  23. * Root application component for incoming call.
  24. *
  25. * @extends BaseApp
  26. */
  27. export default class IncomingCallApp extends BaseApp<Props> {
  28. _init: Promise<*>;
  29. /**
  30. * Navigates to {@link IncomingCallPage} upon mount.
  31. *
  32. * NOTE: This was implemented here instead of in a middleware for the
  33. * {@link APP_WILL_MOUNT} action because that would run also for
  34. * {@link App}.
  35. *
  36. * @returns {void}
  37. */
  38. componentDidMount() {
  39. super.componentDidMount();
  40. this._init.then(() => {
  41. const { dispatch } = this.state.store;
  42. const {
  43. callerAvatarURL: avatarUrl,
  44. callerName: name,
  45. hasVideo
  46. } = this.props;
  47. dispatch(incomingCallReceived({
  48. avatarUrl,
  49. hasVideo,
  50. name
  51. }));
  52. super._navigate({ component: IncomingCallPage });
  53. });
  54. }
  55. }