Merge pull request #967 from tonyedwardspz/master

Feature - Add a low feedback mode
This commit is contained in:
advplyr
2023-12-09 15:14:52 -06:00
committed by GitHub
7 changed files with 48 additions and 43 deletions
-2
View File
@@ -388,7 +388,6 @@ export default {
if (value) {
const res = await AbsFileSystem.deleteTrackFromItem({ id: this.localLibraryItemId, trackLocalFileId: localFile.id, trackContentUrl: localEpisodeAudioTrack.contentUrl })
if (res?.id) {
this.$toast.success('Deleted episode successfully')
if (this.isLocal) {
// If this is local episode then redirect to server episode when available
if (this.serverEpisodeId) {
@@ -414,7 +413,6 @@ export default {
if (value) {
const res = await AbsFileSystem.deleteItem(this.localLibraryItem)
if (res?.success) {
this.$toast.success('Deleted successfully')
if (this.isLocal) {
// If local then redirect to server version when available
if (this.serverLibraryItemId) {
+1 -9
View File
@@ -58,7 +58,6 @@
</template>
<script>
import { Dialog } from '@capacitor/dialog'
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
export default {
@@ -210,14 +209,7 @@ export default {
console.log('Local folder', JSON.stringify(localFolder))
var startDownloadMessage = `Start download for "${this.title}" to folder ${localFolder.name}?`
const { value } = await Dialog.confirm({
title: 'Confirm',
message: startDownloadMessage
})
if (value) {
this.startDownload(localFolder)
}
this.startDownload(localFolder)
},
async startDownload(localFolder) {
var payload = {
+10 -13
View File
@@ -41,7 +41,7 @@
<div v-if="userCanDownload">
<span v-if="isLocal" class="material-icons-outlined px-2 text-success text-lg">audio_file</span>
<span v-else-if="!localEpisode" class="material-icons mx-1.5 mt-2 text-xl" :class="downloadItem ? 'animate-bounce text-warning text-opacity-75' : ''" @click.stop="downloadClick">{{ downloadItem ? 'downloading' : 'download' }}</span>
<span v-else-if="!localEpisode" class="material-icons mx-1.5 mt-2 text-xl" :class="downloadItem || pendingDownload ? 'animate-bounce text-warning text-opacity-75' : ''" @click.stop="downloadClick">{{ downloadItem || pendingDownload ? 'downloading' : 'download' }}</span>
<span v-else class="material-icons px-2 text-success text-xl">download_done</span>
</div>
@@ -58,7 +58,6 @@
</template>
<script>
import { Dialog } from '@capacitor/dialog'
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
export default {
@@ -78,6 +77,7 @@ export default {
data() {
return {
isProcessingReadUpdate: false,
pendingDownload: false,
processing: false
}
},
@@ -175,14 +175,16 @@ export default {
return folderObj
},
async downloadClick() {
if (this.downloadItem) return
if (this.downloadItem || this.pendingDownload) return
this.pendingDownload = true
await this.$hapticsImpact()
if (this.isIos) {
// no local folders on iOS
this.startDownload()
await this.startDownload()
} else {
this.download()
await this.download()
}
this.pendingDownload = false
},
async download(selectedLocalFolder = null) {
let localFolder = selectedLocalFolder
@@ -216,14 +218,7 @@ export default {
console.log('Local folder', JSON.stringify(localFolder))
var startDownloadMessage = `Start download for "${this.title}" to folder ${localFolder.name}?`
const { value } = await Dialog.confirm({
title: 'Confirm',
message: startDownloadMessage
})
if (value) {
this.startDownload(localFolder)
}
return this.startDownload(localFolder)
},
async startDownload(localFolder) {
var payload = {
@@ -238,6 +233,8 @@ export default {
var errorMsg = downloadRes.error || 'Unknown error'
console.error('Download error', errorMsg)
this.$toast.error(errorMsg)
} else {
console.log('Download completed', JSON.stringify(downloadRes))
}
},
async playClick() {
@@ -56,7 +56,6 @@ export default {
if (!data.localLibraryItem) {
this.$toast.error(this.$strings.MessageItemDownloadCompleteFailedToCreate)
} else {
this.$toast.success(`Item "${data.localLibraryItem.media.metadata.title}" download finished`)
this.$eventBus.$emit('new-local-library-item', data.localLibraryItem)
}