mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Update:Metered network connections to send progress syncs every 60s instead of every 5s and show metered/unmetered in connection status icon #238
This commit is contained in:
parent
fd134097a1
commit
4c678836fb
6 changed files with 71 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
import { Network } from '@capacitor/network'
|
||||
import { AbsAudioPlayer } from '@/plugins/capacitor'
|
||||
|
||||
export const state = () => ({
|
||||
deviceData: null,
|
||||
|
@ -12,6 +13,7 @@ export const state = () => ({
|
|||
socketConnected: false,
|
||||
networkConnected: false,
|
||||
networkConnectionType: null,
|
||||
isNetworkUnmetered: true,
|
||||
isFirstLoad: true,
|
||||
hasStoragePermission: false,
|
||||
selectedLibraryItem: null,
|
||||
|
@ -62,6 +64,12 @@ export const actions = {
|
|||
console.log('Network status changed', status.connected, status.connectionType)
|
||||
commit('setNetworkStatus', status)
|
||||
})
|
||||
|
||||
AbsAudioPlayer.addListener('onNetworkMeteredChanged', (payload) => {
|
||||
const isUnmetered = payload.value
|
||||
console.log('On network metered changed', isUnmetered)
|
||||
commit('setIsNetworkUnmetered', isUnmetered)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +122,9 @@ export const mutations = {
|
|||
state.networkConnected = val.connected
|
||||
state.networkConnectionType = val.connectionType
|
||||
},
|
||||
setIsNetworkUnmetered(state, val) {
|
||||
state.isNetworkUnmetered = val
|
||||
},
|
||||
openReader(state, libraryItem) {
|
||||
state.selectedLibraryItem = libraryItem
|
||||
state.showReader = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue