TT#24843 Implement call action button

Change-Id: I433a0ebccd84c8926202d67c9b3284edcf869620
changes/47/16947/9
raxelsen 8 years ago
parent d69fd38490
commit c96b53a4a6

@ -67,10 +67,10 @@ Should be created using an xmpp client authenticating as subscribers, but have n
## MOCK DATA ## MOCK DATA
You can also use mock data in src/api/conversations.js, replacing the resolve() with this: You can also use mock data in src/api/conversations.js, replacing the jsonBody variable with this:
` `
resolve( let jsonBody = getJsonBody(
{ {
"_embedded": { "_embedded": {
"ngcp:conversations": [ "ngcp:conversations": [
@ -157,5 +157,5 @@ resolve(
}, },
"total_count": 4 "total_count": 4
} }
); )
` `

@ -11,7 +11,7 @@
<q-card-main> <q-card-main>
<q-field icon="fa-user-circle" :helper="$t('pages.login.username_helper')" :count="128"> <q-field icon="fa-user-circle" :helper="$t('pages.login.username_helper')" :count="128">
<q-input type="text" max-length="128" :float-label="$t('pages.login.username')" <q-input type="text" max-length="128" :float-label="$t('pages.login.username')"
clearable v-model="username" @keyup.enter="login()"/> autofocus clearable v-model="username" @keyup.enter="login()"/>
</q-field> </q-field>
<q-field icon="fa-lock" :helper="$t('pages.login.password_helper')" :count="32"> <q-field icon="fa-lock" :helper="$t('pages.login.password_helper')" :count="32">
<q-input type="password" max-length="32" :float-label="$t('pages.login.password')" <q-input type="password" max-length="32" :float-label="$t('pages.login.password')"

@ -1,7 +1,8 @@
<template> <template>
<csc-page :title="$t('pages.conversations.title')"> <csc-page :title="$t('pages.conversations.title')">
<q-infinite-scroll :handler="loadMore" :offset=1 ref="infinite"> <q-infinite-scroll :handler="loadMore" :offset=1 ref="infinite">
<q-card v-for="conversation in conversations" :key="conversation.caller" <q-card v-for="(conversation, index) in conversations"
:key="conversation.caller"
class="conversation-card"> class="conversation-card">
<csc-collapsible :icon="getCollapsibleIcons(conversation)" <csc-collapsible :icon="getCollapsibleIcons(conversation)"
:label="getCollapsibleLabel(conversation)" :label="getCollapsibleLabel(conversation)"
@ -10,7 +11,19 @@
<div v-if="hasCallOption(conversation.type)"> <div v-if="hasCallOption(conversation.type)">
<q-card-separator /> <q-card-separator />
<q-card-actions align="center"> <q-card-actions align="center">
<q-btn flat round small color="primary" icon="call">{{ $t('pages.conversations.buttons.call') }}</q-btn> <q-btn flat round small color="primary" icon="call">
{{ $t('pages.conversations.buttons.call') }}
<q-popover ref="popover">
<q-list separator link>
<q-item @click="call(conversation, 'audioOnly'), $refs.popover[index].close()">
{{ $t('pages.conversations.buttons.audioCall') }}
</q-item>
<q-item @click="call(conversation, 'audioVideo'), $refs.popover[index].close()">
{{ $t('pages.conversations.buttons.videoCall') }}
</q-item>
</q-list>
</q-popover>
</q-btn>
</q-card-actions> </q-card-actions>
</div> </div>
</q-card> </q-card>
@ -24,8 +37,8 @@
<script> <script>
import CscPage from '../CscPage' import CscPage from '../CscPage'
import CscCollapsible from '../card/CscCollapsible' import CscCollapsible from '../card/CscCollapsible'
import { QBtn, QCardActions, QCard, import { QBtn, QCardActions, QCard, QCardSeparator, QInfiniteScroll,
QCardSeparator, QInfiniteScroll, QSpinnerDots } from 'quasar-framework' QPopover, QList, QItem, QSpinnerDots } from 'quasar-framework'
export default { export default {
data () { data () {
return { return {
@ -39,6 +52,9 @@
QCardSeparator, QCardSeparator,
CscCollapsible, CscCollapsible,
QInfiniteScroll, QInfiniteScroll,
QPopover,
QList,
QItem,
QSpinnerDots QSpinnerDots
}, },
computed: { computed: {
@ -47,8 +63,15 @@
} }
}, },
methods: { methods: {
call(conversation, localMedia) {
let number = conversation.direction == 'out' ?
conversation.callee : conversation.caller;
this.$store.dispatch('call/start',
{ number: number, localMedia: localMedia });
},
loadMore(index, done) { loadMore(index, done) {
this.$store.dispatch('conversations/loadConversations').then(() => { this.$store.dispatch('conversations/loadConversations')
.then(() => {
done(); done();
}).catch((err) => { }).catch((err) => {
done(); done();
@ -81,9 +104,12 @@
}; };
}, },
getCollapsibleLabel(item) { getCollapsibleLabel(item) {
let prefix = item.status == 'ok' ? this.$t('pages.conversations.labels.successful') let prefix = item.status == 'ok' ?
this.$t('pages.conversations.labels.successful')
: this.$t('pages.conversations.labels.unsuccessful'); : this.$t('pages.conversations.labels.unsuccessful');
let direction = item.direction == 'in' ? this.$t('pages.conversations.labels.from') : this.$t('pages.conversations.labels.to'); let direction = item.direction == 'in' ?
this.$t('pages.conversations.labels.from') :
this.$t('pages.conversations.labels.to');
return `${prefix} ${item.type} ${direction} ${item.caller}`; return `${prefix} ${item.type} ${direction} ${item.caller}`;
} }
} }

@ -90,7 +90,9 @@
"to": "to" "to": "to"
}, },
"buttons": { "buttons": {
"call": "CALL" "call": "CALL",
"audioCall": "Audio Call",
"videoCall": "Video Call"
} }
}, },
"reminder": { "reminder": {

@ -164,7 +164,11 @@ export default {
* @param options.number * @param options.number
*/ */
start(context, options) { start(context, options) {
console.log('start()');
console.log('options.number is', options.number, 'and options.localMedia is', options.localMedia);
context.commit('layout/showRight', null, { root: true });
Vue.call.createLocalMedia(options.localMedia).then((localMediaStream)=>{ Vue.call.createLocalMedia(options.localMedia).then((localMediaStream)=>{
console.log('Vue.call.createLocalMediai()');
var call = Vue.call.start(options.number, localMediaStream); var call = Vue.call.start(options.number, localMediaStream);
call.onAccepted(()=>{ call.onAccepted(()=>{
}).onEnded(()=>{ }).onEnded(()=>{

Loading…
Cancel
Save