TT#32961 Call number input field auto focused

Change-Id: Ieed37a45f6c5083e71f033f911b9ac8e73c89879
changes/42/19342/5
raxelsen 8 years ago committed by Hans-Peter Herzog
parent 66ed5ff07d
commit 5e470531d6

@ -30,10 +30,10 @@
<q-card-main> <q-card-main>
<div class="csc-call-info"> <div class="csc-call-info">
<q-field v-if="isPreparing" :helper="$t('call.inputNumber')" :count="64" dark <q-field v-show="isPreparing" :helper="$t('call.inputNumber')" :count="64" dark
:error="validationEnabled && phoneNumberError" :error-label="$t('call.inputValidNumber')"> :error="validationEnabled && phoneNumberError" :error-label="$t('call.inputValidNumber')">
<q-input :float-label="$t('call.number')" v-model.trim="formattedPhoneNumber" <q-input :float-label="$t('call.number')" v-model.trim="formattedPhoneNumber"
dark clearable max="64" @blur="phoneNumberBlur()" @focus="phoneNumberFocus()"/> ref="numberInput" dark clearable max="64" @blur="phoneNumberBlur()" @focus="phoneNumberFocus()"/>
</q-field> </q-field>
<div v-if="!isPreparing" class="phone-number"> <div v-if="!isPreparing" class="phone-number">
<q-icon v-if="isCalling && (localMediaType == 'audioVideo' || remoteMediaType == 'audioVideo')" <q-icon v-if="isCalling && (localMediaType == 'audioVideo' || remoteMediaType == 'audioVideo')"
@ -73,6 +73,7 @@
</template> </template>
<script> <script>
import Vue from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import CscMedia from './CscMedia' import CscMedia from './CscMedia'
@ -92,14 +93,6 @@
validationEnabled: false validationEnabled: false
} }
}, },
updated() {
if(this.$store.state.call.callState === 'incoming' ||
this.$store.state.call.callState === 'ringing') {
this.$refs.incomingSound.play();
} else {
this.$refs.incomingSound.pause();
}
},
components: { components: {
QLayout, QLayout,
QCard, QCard,
@ -116,6 +109,14 @@
Dialog Dialog
}, },
methods: { methods: {
focusNumberInput() {
Vue.nextTick(() => {
this.$refs.numberInput.focus();
});
},
blurNumberInput() {
this.$refs.numberInput.blur();
},
init() { init() {
this.phoneNumber = ''; this.phoneNumber = '';
this.validationEnabled = false; this.validationEnabled = false;
@ -278,16 +279,24 @@
'localMediaType', 'localMediaType',
'remoteMediaType', 'remoteMediaType',
'isCaller', 'isCaller',
'isCallee' 'isCallee',
'callState'
]), ]),
isMobile() { isMobile() {
return Platform.is.mobile; return Platform.is.mobile;
} }
}, },
watch: { watch: {
isIncoming(value) { callState(state) {
if(value) { if(state === 'incoming') {
showCallNotification(numberFormat(this.getNumber)); showCallNotification(numberFormat(this.getNumber));
this.$refs.incomingSound.play();
} else if (state === 'input') {
this.focusNumberInput();
} else if (state === 'ringing') {
this.$refs.incomingSound.play();
} else {
this.$refs.incomingSound.pause();
} }
} }
} }

@ -238,8 +238,7 @@
this.$store.commit('layout/toggleFullscreen'); this.$store.commit('layout/toggleFullscreen');
}, },
call() { call() {
this.$store.commit('layout/showRight'); this.$store.dispatch('call/showCall');
this.$refs.cscCall.init();
}, },
logout() { logout() {
startLoading(); startLoading();
@ -262,8 +261,10 @@
applyLayout() { applyLayout() {
if(this.right) { if(this.right) {
this.$refs.layout.showRight(); this.$refs.layout.showRight();
this.$refs.cscCall.focusNumberInput();
} else { } else {
this.$refs.layout.hideRight(); this.$refs.layout.hideRight();
this.$refs.cscCall.blurNumberInput();
} }
if(this.left) { if(this.left) {
this.$refs.layout.showLeft(); this.$refs.layout.showLeft();
@ -276,8 +277,10 @@
right(value) { right(value) {
if(value) { if(value) {
this.$refs.layout.showRight(); this.$refs.layout.showRight();
this.$refs.cscCall.focusNumberInput();
} else { } else {
this.$refs.layout.hideRight(); this.$refs.layout.hideRight();
this.$refs.cscCall.blurNumberInput();
} }
}, },
left(value) { left(value) {

@ -127,14 +127,14 @@
methods: { methods: {
call() { call() {
if(this.isCallAvailable) { if(this.isCallAvailable) {
this.$store.commit('layout/showRight'); this.$store.dispatch('call/showCall');
} else { } else {
showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable')); showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable'));
} }
}, },
screenShare() { screenShare() {
if(this.isCallAvailable && !this.isMobile) { if(this.isCallAvailable && !this.isMobile) {
this.$store.commit('layout/showRight'); this.$store.dispatch('call/showCall');
} else { } else {
showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable')); showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable'));
} }

@ -124,6 +124,9 @@ export default {
}, },
isCallee(state) { isCallee(state) {
return state.callee; return state.callee;
},
callState(state) {
return state.callState;
} }
}, },
mutations: { mutations: {
@ -284,6 +287,12 @@ export default {
enableVideo(context) { enableVideo(context) {
Vue.call.enableVideo(); Vue.call.enableVideo();
context.commit('enableVideo'); context.commit('enableVideo');
},
showCall(context) {
context.commit('layout/showRight', null, { root: true });
},
hideCall() {
context.commit('layout/hideRight', null, { root: true });
} }
} }
}; };

Loading…
Cancel
Save