Skip to content

Commit

Permalink
Fix settings password handling (FreeTubeApp#5988)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue authored and Soham456 committed Dec 5, 2024
1 parent 8490fa1 commit 7ad42e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions src/renderer/views/Settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,35 @@ export default defineComponent({
}
},
mounted: function () {
this.handleResize()
window.addEventListener('resize', this.handleResize)
document.addEventListener('scroll', this.markScrolledToSectionAsActive)

// mark first section as active before any scrolling has taken place
if (this.settingsSectionComponents.length > 0) {
const firstSection = document.getElementById(this.settingsSectionComponents[0].type)
firstSection.classList.add(ACTIVE_CLASS_NAME)
if (this.unlocked) {
this.handleMounted()
}
},
beforeDestroy: function () {
document.removeEventListener('scroll', this.markScrolledToSectionAsActive)
window.removeEventListener('resize', this.handleResize)
},
methods: {
handleMounted: function () {
this.handleResize()
window.addEventListener('resize', this.handleResize)
document.addEventListener('scroll', this.markScrolledToSectionAsActive)

// mark first section as active before any scrolling has taken place
if (this.settingsSectionComponents.length > 0) {
const firstSection = document.getElementById(this.settingsSectionComponents[0].type)
firstSection.classList.add(ACTIVE_CLASS_NAME)
}
},

handleUnlock: function () {
this.unlocked = true

nextTick(() => {
this.handleMounted()
})
},

navigateToSection: function(sectionType) {
if (this.isInDesktopView) {
nextTick(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</template>
<password-dialog
v-else
@unlocked="unlocked = true"
@unlocked="handleUnlock"
/>
</div>
</template>
Expand Down

0 comments on commit 7ad42e4

Please sign in to comment.