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.3KB

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