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
15 changes: 11 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,20 @@ export default {
isCustomRingtone: false,
ringtone: {},
options: [],
savedRingtone: undefined, // value from localStorage, we need undefined for comparison with ringtone.name when it
Copy link
Contributor

Choose a reason for hiding this comment

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

я так розумію, цей андефайнд необхідний для порівняння на стрічці 63
можливо, там можна просто додати перевірку на !!this.savedRingtone && ...===... ?

}),
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;
}
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 +72,15 @@ export default {
this.ringtone.name
? localStorage.setItem('settings/ringtone', this.ringtone.name)
: localStorage.removeItem('settings/ringtone');
this.savedRingtone = localStorage.getItem('settings/ringtone') || undefined;
},
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