From b81d974eeba6a7ee17d36b07f2d5ffa4b871d020 Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Thu, 15 Feb 2018 10:40:38 +0100 Subject: [PATCH] TT#32987 Call: As a Customer I want to get notified about an incoming call Change-Id: I9ae9d37d7551260181a08666cf3819a068d0057b --- src/api/user.js | 6 +- src/components/CscCall.vue | 19 ++++- src/components/Login.vue | 31 ++++++-- src/components/layouts/Default.vue | 59 ++++++++------- src/helpers/ui.js | 82 +++++++++++++++++++- src/locales/en.json | 6 +- src/statics/ring.ogg | Bin 0 -> 18942 bytes src/statics/service-worker.js | 18 +++++ src/store/user.js | 115 +++++++++++++++++++---------- t/store/user.js | 2 +- 10 files changed, 262 insertions(+), 76 deletions(-) create mode 100644 src/statics/ring.ogg create mode 100644 src/statics/service-worker.js diff --git a/src/api/user.js b/src/api/user.js index 4a6ecc2c..8785f178 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -19,7 +19,11 @@ export function login(username, password) { subscriberId: subscriberId, }); }).catch((err)=>{ - reject(err); + if(err.status && err.status >= 400) { + reject(new Error(err.body.message)); + } else { + reject(err); + } }); }); } diff --git a/src/components/CscCall.vue b/src/components/CscCall.vue index 520291f8..94b7afd2 100644 --- a/src/components/CscCall.vue +++ b/src/components/CscCall.vue @@ -15,9 +15,9 @@ {{ $t('call.incoming') }} {{ $t('call.call') }} - - @@ -70,8 +70,11 @@ import { mapState, mapGetters } from 'vuex' import CscMedia from './CscMedia' import { QLayout, QCard, QCardTitle, QCardSeparator, QCardMain, QField, QInput, - QCardActions, QBtn, QIcon, Loading, Alert, QSpinnerRings, Dialog } from 'quasar-framework' + QCardActions, QBtn, QIcon, Loading, Alert, QSpinnerRings, Dialog, Platform } from 'quasar-framework' import { normalizeNumber, rawNumber } from '../filters/number-format' + import numberFormat from '../filters/number-format' + import { showCallNotification } from '../helpers/ui' + export default { name: 'csc-call', props: ['region', 'fullscreen'], @@ -270,6 +273,16 @@ ]), hasLocalVideo() { return this.getLocalMediaType !== null && this.getLocalMediaType.match(/(v|V)ideo/) !== null; + }, + isMobile() { + return Platform.is.mobile; + } + }, + watch: { + isIncoming(value) { + if(value) { + showCallNotification(numberFormat(this.getNumber)); + } } } } diff --git a/src/components/Login.vue b/src/components/Login.vue index da94f82a..1fb16251 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -32,9 +32,12 @@