Change-Id: Iac9b421c0684b1ecc2db0b4482c229ff5b5634eachanges/95/22395/4
parent
54c1b07b61
commit
84d019734b
@ -1,45 +1,106 @@
|
|||||||
<template>
|
<template>
|
||||||
<csc-page title="Privacy" class="csc-simple-page">
|
<csc-page
|
||||||
<q-toggle :label="(!callBlockingEnabled ? 'Hide' : 'Show') + ' Own Number'"
|
class="csc-simple-page"
|
||||||
@input="toggle()" v-model="callBlockingEnabled"/>
|
>
|
||||||
|
<q-field
|
||||||
|
class="csc-privacy"
|
||||||
|
>
|
||||||
|
<q-toggle
|
||||||
|
:label="privacyLabel"
|
||||||
|
:value="privacy"
|
||||||
|
@input="toggle()"
|
||||||
|
checked-icon="visibility_off"
|
||||||
|
unchecked-icon="visibility"
|
||||||
|
/>
|
||||||
|
<q-inner-loading
|
||||||
|
v-if="privacyLoading"
|
||||||
|
:visible="privacyLoading"
|
||||||
|
>
|
||||||
|
<q-spinner-mat
|
||||||
|
size="30px"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</q-inner-loading>
|
||||||
|
</q-field>
|
||||||
</csc-page>
|
</csc-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { showToast } from '../../../helpers/ui'
|
|
||||||
|
import {
|
||||||
|
mapGetters
|
||||||
|
} from 'vuex'
|
||||||
|
import {
|
||||||
|
showToast
|
||||||
|
} from '../../../helpers/ui'
|
||||||
import CscPage from '../../CscPage'
|
import CscPage from '../../CscPage'
|
||||||
import { QField, QToggle, Toast } from 'quasar-framework'
|
import {
|
||||||
|
QField,
|
||||||
|
QToggle,
|
||||||
|
Toast,
|
||||||
|
QInnerLoading,
|
||||||
|
QSpinnerMat
|
||||||
|
} from 'quasar-framework'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {}
|
||||||
callBlockingEnabled: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.dispatch('callBlocking/loadPrivacy').then(()=>{
|
|
||||||
this.callBlockingEnabled = this.$store.state.callBlocking.privacyEnabled;
|
|
||||||
}).catch((err)=>{
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
CscPage,
|
CscPage,
|
||||||
QToggle,
|
QToggle,
|
||||||
Toast,
|
Toast,
|
||||||
QField
|
QField,
|
||||||
|
QInnerLoading,
|
||||||
|
QSpinnerMat
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$store.dispatch('callBlocking/loadPrivacy');
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
privacyLabel() {
|
||||||
|
if(this.privacy) {
|
||||||
|
return this.$t('callBlocking.privacyEnabledLabel');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return this.$t('callBlocking.privacyDisabledLabel');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fieldIcon() {
|
||||||
|
if(!this.privacy) {
|
||||||
|
return 'visibility';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'visibility_off';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...mapGetters('callBlocking', [
|
||||||
|
'privacy',
|
||||||
|
'privacyError',
|
||||||
|
'privacyUpdated',
|
||||||
|
'privacyLoadingState',
|
||||||
|
'privacyLoading'
|
||||||
|
])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggle () {
|
toggle () {
|
||||||
this.$store.dispatch('callBlocking/togglePrivacy', this.callBlockingEnabled).then(()=>{
|
this.$store.dispatch('callBlocking/updatePrivacy', !this.privacy);
|
||||||
showToast('Own number will now be ' + (this.callBlockingEnabled ? 'hidden' : 'shown') +
|
}
|
||||||
' on outbound calls');
|
},
|
||||||
}).catch((err)=>{
|
watch: {
|
||||||
console.log(err);
|
privacyUpdated(updated) {
|
||||||
});
|
if(updated && this.privacy) {
|
||||||
|
showToast(this.$t('callBlocking.privacyEnabledToast'));
|
||||||
|
}
|
||||||
|
else if (updated && !this.privacy) {
|
||||||
|
showToast(this.$t('callBlocking.privacyDisabledToast'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" rel="stylesheet/stylus">
|
<style lang="stylus" rel="stylesheet/stylus">
|
||||||
|
.csc-privacy
|
||||||
|
position relative
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in new issue