message_voip_status.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * This file is part of Threema Web.
  3. *
  4. * Threema Web is free software: you can redistribute it and/or modify it
  5. * under the terms of the GNU Affero General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or (at
  7. * your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Affero General Public License
  15. * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. // tslint:disable:max-line-length
  18. export default [
  19. function() {
  20. return {
  21. restrict: 'EA',
  22. scope: {},
  23. bindToController: {
  24. message: '=eeeMessage',
  25. },
  26. controllerAs: 'ctrl',
  27. controller: [function() {
  28. this.$onInit = function() {
  29. this.status = this.message.voip.status;
  30. this.duration = this.message.voip.duration;
  31. this.reason = this.message.voip.reason;
  32. this.incoming = !this.message.isOutbox;
  33. this.outgoing = this.message.isOutbox;
  34. };
  35. }],
  36. template: `
  37. <p ng-if="ctrl.status === 1">
  38. <md-icon class="material-icons color-status-warning">call_missed</md-icon>
  39. <span translate>voip.CALL_MISSED</span>
  40. </p>
  41. <p ng-if="ctrl.status === 2 && ctrl.incoming">
  42. <md-icon class="material-icons color-status-ok">call_received</md-icon>
  43. <span translate>voip.CALL_FINISHED_IN</span>
  44. </p>
  45. <p ng-if="ctrl.status === 2 && ctrl.outgoing">
  46. <md-icon class="material-icons color-status-ok">call_made</md-icon>
  47. <span translate>voip.CALL_FINISHED_OUT</span>
  48. </p>
  49. <p ng-if="ctrl.status === 3 && ctrl.incoming">
  50. <md-icon class="material-icons color-status-error">call_missed</md-icon>
  51. <span translate>voip.CALL_REJECTED</span>
  52. </p>
  53. <p ng-if="ctrl.status === 3 && ctrl.outgoing">
  54. <md-icon class="material-icons color-status-error">call_missed_outgoing</md-icon>
  55. <span translate>voip.CALL_REJECTED</span>
  56. </p>
  57. <p ng-if="ctrl.status === 4">
  58. <md-icon class="material-icons color-status-warning">call_missed_outgoing</md-icon>
  59. <span translate>voip.CALL_ABORTED</span>
  60. </p>
  61. `,
  62. };
  63. },
  64. ];