status_bar.ts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. import {TrustedKeyStoreService} from '../services/keystore';
  18. import {StateService} from '../services/state';
  19. // tslint:disable:max-line-length
  20. export default [
  21. '$window',
  22. 'TrustedKeyStore',
  23. 'StateService',
  24. function($window: ng.IWindowService,
  25. trustedKeyStore: TrustedKeyStoreService,
  26. stateService: StateService) {
  27. return {
  28. restrict: 'E',
  29. scope: {},
  30. bindToController: {
  31. active: '=',
  32. },
  33. controllerAs: 'ctrl',
  34. controller: [function() {
  35. this.logout = () => {
  36. trustedKeyStore.clearTrustedKey();
  37. $window.location.reload();
  38. };
  39. this.stateService = stateService;
  40. }],
  41. template: `
  42. <div id="expanded-status-bar" ng-class="{'active': ctrl.active}">
  43. <div ng-if="ctrl.active">
  44. <div class="loading"><span></span></div>
  45. </div>
  46. <div>
  47. <h1 translate>connecting.CONNECTION_PROBLEMS</h1>
  48. <p class="details" ng-if="ctrl.stateService.progress < 100">
  49. <span ng-if="ctrl.stateService.connectionBuildupState === 'new'" translate>connecting.RECOVERING_CONNECTION</span>
  50. <span ng-if="ctrl.stateService.connectionBuildupState === 'push'" translate>connecting.WAITING_FOR_APP</span>
  51. <span ng-if="ctrl.stateService.connectionBuildupState === 'manual_start'" translate>connecting.WAITING_FOR_APP_MANUAL</span>
  52. <span ng-if="ctrl.stateService.connectionBuildupState === 'connecting'" translate>connecting.CONNECTING_TO_SERVER</span>
  53. <span ng-if="ctrl.stateService.connectionBuildupState === 'waiting'" translate>connecting.CONNECTING_TO_APP</span>
  54. <span ng-if="ctrl.stateService.connectionBuildupState === 'peer_handshake'" translate>connecting.CONNECTING_TO_APP</span>
  55. </p>
  56. <p class="details" ng-if="ctrl.stateService.progress === 100" translate>connecting.RECOVERING_CONNECTION</p>
  57. </div>
  58. <div ng-show="ctrl.stateService.connectionBuildupState !== 'done'">
  59. <span class="progress">{{ ctrl.stateService.progress }}%</span>
  60. </div>
  61. </div>
  62. `,
  63. };
  64. },
  65. ];