Fix:Downloaded audiobook progress sync #77, Fix:Downloads page not showing, Fix: Audio player dropdown menu staying open

This commit is contained in:
advplyr 2022-01-05 19:09:18 -06:00
parent 6229a7f0a8
commit f7a2393d99
4 changed files with 88 additions and 85 deletions

View file

@ -70,9 +70,11 @@ class AudiobookProgressSyncer constructor(playerNotificationService:PlayerNotifi
if (!listeningTimerRunning) return if (!listeningTimerRunning) return
Log.d(tag, "stop: Stopping listening for $listeningBookTitle") Log.d(tag, "stop: Stopping listening for $listeningBookTitle")
reset() if (!webviewOpenOnStart) {
sync() sync()
} }
reset()
}
fun reset() { fun reset() {
listeningTimerTask?.cancel() listeningTimerTask?.cancel()

View file

@ -8,7 +8,7 @@
<span class="material-icons text-3xl" @click="castClick">cast</span> <span class="material-icons text-3xl" @click="castClick">cast</span>
</div> </div>
<div class="top-4 right-4 absolute cursor-pointer"> <div class="top-4 right-4 absolute cursor-pointer">
<ui-dropdown-menu :items="menuItems" @action="clickMenuAction"> <ui-dropdown-menu ref="dropdownMenu" :items="menuItems" @action="clickMenuAction">
<span class="material-icons text-3xl">more_vert</span> <span class="material-icons text-3xl">more_vert</span>
</ui-dropdown-menu> </ui-dropdown-menu>
</div> </div>
@ -321,6 +321,7 @@ export default {
}, },
collapseFullscreen() { collapseFullscreen() {
this.showFullscreen = false this.showFullscreen = false
this.forceCloseDropdownMenu()
}, },
jumpNextChapter() { jumpNextChapter() {
if (this.loading) return if (this.loading) return
@ -706,6 +707,11 @@ export default {
} else if (action === 'close') { } else if (action === 'close') {
this.$emit('close') this.$emit('close')
} }
},
forceCloseDropdownMenu() {
if (this.$refs.dropdownMenu && this.$refs.dropdownMenu.closeMenu) {
this.$refs.dropdownMenu.closeMenu()
}
} }
}, },
mounted() { mounted() {
@ -715,6 +721,7 @@ export default {
this.$nextTick(this.init) this.$nextTick(this.init)
}, },
beforeDestroy() { beforeDestroy() {
this.forceCloseDropdownMenu()
document.body.removeEventListener('touchstart', this.touchstart) document.body.removeEventListener('touchstart', this.touchstart)
document.body.removeEventListener('touchend', this.touchend) document.body.removeEventListener('touchend', this.touchend)

View file

@ -91,8 +91,8 @@ export default {
this.closeMenu() this.closeMenu()
}, },
clickedOption(itemValue) { clickedOption(itemValue) {
this.$emit('action', itemValue)
this.closeMenu() this.closeMenu()
this.$emit('action', itemValue)
} }
}, },
mounted() {} mounted() {}

View file

@ -2,11 +2,7 @@
<div class="w-full h-full py-6"> <div class="w-full h-full py-6">
<h1 class="text-2xl px-4">Downloads</h1> <h1 class="text-2xl px-4">Downloads</h1>
<template v-if="isIos"></template> <div v-if="!isIos" class="w-full px-2 py-2" :class="hasStoragePermission ? '' : 'text-error'">
</div>
</template>
<template v-else>
<div class="w-full px-2 py-2" :class="hasStoragePermission ? '' : 'text-error'">
<div class="flex items-center"> <div class="flex items-center">
<span class="material-icons" @click="changeDownloadFolderClick">{{ hasStoragePermission ? 'folder' : 'error' }}</span> <span class="material-icons" @click="changeDownloadFolderClick">{{ hasStoragePermission ? 'folder' : 'error' }}</span>
<p v-if="hasStoragePermission" class="text-sm px-4" @click="changeDownloadFolderClick">{{ downloadFolderSimplePath || 'No Download Folder Selected' }}</p> <p v-if="hasStoragePermission" class="text-sm px-4" @click="changeDownloadFolderClick">{{ downloadFolderSimplePath || 'No Download Folder Selected' }}</p>
@ -15,7 +11,7 @@
<!-- <p v-if="hasStoragePermission" class="text-xs text-gray-400 break-all max-w-full">{{ downloadFolderUri }}</p> --> <!-- <p v-if="hasStoragePermission" class="text-xs text-gray-400 break-all max-w-full">{{ downloadFolderUri }}</p> -->
</div> </div>
<div class="w-full h-10 relative"> <div v-if="!isIos" class="w-full h-10 relative">
<div class="absolute top-px left-0 z-10 w-full h-full flex"> <div class="absolute top-px left-0 z-10 w-full h-full flex">
<div class="flex-grow h-full bg-primary rounded-t-md mr-px" @click="showingDownloads = true"> <div class="flex-grow h-full bg-primary rounded-t-md mr-px" @click="showingDownloads = true">
<div class="flex items-center justify-center rounded-t-md border-t border-l border-r border-white border-opacity-20 h-full" :class="showingDownloads ? 'text-gray-100' : 'border-b bg-black bg-opacity-20 text-gray-400'"> <div class="flex items-center justify-center rounded-t-md border-t border-l border-r border-white border-opacity-20 h-full" :class="showingDownloads ? 'text-gray-100' : 'border-b bg-black bg-opacity-20 text-gray-400'">
@ -29,7 +25,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="list-content-body relative w-full overflow-x-hidden bg-primary"> <div v-if="!isIos" class="list-content-body relative w-full overflow-x-hidden bg-primary">
<template v-if="showingDownloads"> <template v-if="showingDownloads">
<div v-if="!totalDownloads" class="flex items-center justify-center h-40"> <div v-if="!totalDownloads" class="flex items-center justify-center h-40">
<p>No Downloads</p> <p>No Downloads</p>
@ -89,9 +85,7 @@
</template> </template>
</template> </template>
</div> </div>
</template>
</div> </div>
</template>
</div> </div>
</template> </template>