Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/custom ringtone validation [WTEL-4814] #739

Merged
merged 6 commits into from
Aug 5, 2024
Merged
16 changes: 12 additions & 4 deletions src/modules/settings/components/custom-ringtone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
:autoplay="false"
/>
<wt-button
:disabled="isRingtoneSaved"
@click.prevent="saveRingtone"
>
{{ $t('objects.save') }}
Expand All @@ -47,16 +48,21 @@ export default {
isCustomRingtone: false,
ringtone: {},
options: [],
savedRingtone: null,
}),
computed: {
isRingtoneSelected() {
return this.isCustomRingtone && this.ringtone.name;
},
audioLink() {
return this.isRingtoneSelected
? `${import.meta.env.VITE_RINGTONES_URL}/${this.ringtone.name}`
: '';
},
return this.isRingtoneSelected
? `${import.meta.env.VITE_RINGTONES_URL}/${this.ringtone.name}`
: '';
},
isRingtoneSaved() {
return !this.savedRingtone && !this.ringtone.name // if was chosen default ringtone
|| this.savedRingtone === this.ringtone.name;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

внесла зміни ось тут

},
methods: {
selectRingtoneType() {
Expand All @@ -67,13 +73,15 @@ export default {
this.ringtone.name
? localStorage.setItem('settings/ringtone', this.ringtone.name)
: localStorage.removeItem('settings/ringtone');
this.savedRingtone = localStorage.getItem('settings/ringtone');
},
async loadRingtonesOptions() {
this.options = await getRingtonesList();
},
restoreRingtone() {
const ringtoneName = localStorage.getItem('settings/ringtone');
if (ringtoneName) {
this.savedRingtone = ringtoneName;
this.ringtone = this.options.find(item => item.name === ringtoneName);
this.isCustomRingtone = true;
}
Expand Down
Loading