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

@ -56,6 +56,7 @@
import { Capacitor } from '@capacitor/core'
import { Dialog } from '@capacitor/dialog'
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
import cellularPermissionHelpers from '@/mixins/cellularPermissionHelpers'
export default {
async asyncData({ store, params, redirect, app }) {
@ -115,6 +116,7 @@ export default {
startingDownload: false
}
},
mixins: [cellularPermissionHelpers],
computed: {
transformedDescription() {
return this.parseDescription(this.description)
@ -419,6 +421,9 @@ export default {
async downloadClick() {
if (this.downloadItem || this.startingDownload) return
const hasPermission = await this.checkCellularPermission('download')
if (!hasPermission) return
this.startingDownload = true
setTimeout(() => {
this.startingDownload = false

View file

@ -171,6 +171,7 @@
import { Dialog } from '@capacitor/dialog'
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
import { FastAverageColor } from 'fast-average-color'
import cellularPermissionHelpers from '@/mixins/cellularPermissionHelpers'
export default {
async asyncData({ store, params, redirect, app, query }) {
@ -221,6 +222,7 @@ export default {
startingDownload: false
}
},
mixins: [cellularPermissionHelpers],
computed: {
isIos() {
return this.$platform === 'ios'
@ -607,9 +609,11 @@ export default {
this.download(localFolder)
},
async downloadClick() {
if (this.downloadItem || this.startingDownload) {
return
}
if (this.downloadItem || this.startingDownload) return
const hasPermission = await this.checkCellularPermission('download')
if (!hasPermission) return
this.startingDownload = true
setTimeout(() => {
this.startingDownload = false