Improvements and fixes on the cellular permissions

This commit is contained in:
Marcos Carvalho 2024-05-26 22:08:53 +01:00
parent 574dda5286
commit 4ad54f34fe
No known key found for this signature in database
9 changed files with 94 additions and 72 deletions

View file

@ -11,6 +11,7 @@
<script>
import { AbsAudioPlayer } from '@/plugins/capacitor'
import { Dialog } from '@capacitor/dialog'
import CellularPermissionHelpers from '@/mixins/cellularPermissionHelpers'
export default {
data() {
@ -39,6 +40,7 @@ export default {
serverEpisodeId: null
}
},
mixins: [CellularPermissionHelpers],
computed: {
bookmarks() {
if (!this.serverLibraryItemId) return []
@ -193,12 +195,21 @@ export default {
const startTime = payload.startTime
const startWhenReady = !payload.paused
const isLocal = libraryItemId.startsWith('local')
if (!isLocal) {
const hasPermission = await this.checkCellularPermission('streaming')
if (!hasPermission) {
this.$store.commit('setPlayerDoneStartingPlayback')
return
}
}
// When playing local library item and can also play this item from the server
// then store the server library item id so it can be used if a cast is made
const serverLibraryItemId = payload.serverLibraryItemId || null
const serverEpisodeId = payload.serverEpisodeId || null
if (libraryItemId.startsWith('local') && this.$store.state.isCasting) {
if (isLocal && this.$store.state.isCasting) {
const { value } = await Dialog.confirm({
title: 'Warning',
message: `Cannot cast downloaded media items. Confirm to close cast and play on your device.`
@ -373,4 +384,4 @@ export default {
this.$eventBus.$off('device-focus-update', this.deviceFocused)
}
}
</script>
</script>