Skip to content

Commit

Permalink
fix: timeline pref
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyri1 committed Nov 6, 2022
1 parent cc10364 commit 4d7ee4a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/components/AudioRange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ion-row>
<ion-col size="2">
<ion-badge class="margin-10" :color="storyStore.theme + 'sec'">
{{ new Date(storyStore.howlerCurrentPos * 1000).toISOString().substring(14, 19)}}/
{{ new Date(storyStore.howlerCurrentPos * 1000).toISOString().substring(14, 19)}}/
{{ new Date(storyStore.storyAudioHowl.duration() * 1000).toISOString().substring(14, 19)}}
</ion-badge>
</ion-col>
Expand Down Expand Up @@ -44,7 +44,7 @@ function onIonKnobMoveEnd({ detail }) {
}
function pinFormatter(value) {
return `${value} sec`
return new Date(value * 1000).toISOString().substring(14, 19)
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions src/stores/StoryStores.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export const useStoryStore = defineStore('StoryStore', {
}
})
Preferences.get({ key: 'timelineVisible' }).then((result) => {
console.log(result.value);
if (!result.value) {
console.log(result);
if (result.value === null) {
this.timelineVisible = false
} else {
this.timelineVisible = result.value
Expand Down
31 changes: 21 additions & 10 deletions src/views/PrefTab3.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<template>
<ion-page>
<ion-content class="ion-padding ion-margin-bottom" color="light">
<button @click="debug" v-show="false" color="primary">
log prefs
</button>
<ion-card>
<ion-card-header>
<ion-card-title>Paramètres de l'interface :</ion-card-title>
Expand Down Expand Up @@ -84,19 +81,33 @@ function changeContributorPwd(event) {
value: event.srcElement.value,
})
storyStore.contributorPwd = event.srcElement.value
Preferences.get({ key: 'contributorPwd' }).then((result) => {
console.log(result);
});
}
function activeTimeline(event) {
function activeTimeline(event) { // ion-toggle @ionChange="activeTimeline"
Preferences.set({
key: 'timelineVisible',
value: event.detail.checked,
value: String(event.detail.checked),
})
storyStore.timelineVisible = event.detail.checked
}
Preferences.get({ key: 'timelineVisible' }).then((result) => {
console.log(result); // toggle {value: "true"} {value: "false"}
});
function debug() {
console.log(storyStore.timelineVisible);
}
// Now if i do :
Preferences.set({
key: 'timelineVisible',
value: event.detail.checked, // boolean
})
Preferences.get({ key: 'timelineVisible' }).then((result) => {
console.log(result); // always {value: null}
});
storyStore.timelineVisible = event.detail.checked
}
</script>

0 comments on commit 4d7ee4a

Please sign in to comment.