@@ -28,6 +34,7 @@ export default {
deviceData: null,
settings: {
disableAutoRewind: false,
+ enableAltView: false,
jumpForwardTime: 10,
jumpBackwardsTime: 10
}
@@ -60,6 +67,10 @@ export default {
this.settings.disableAutoRewind = !this.settings.disableAutoRewind
this.saveSettings()
},
+ toggleEnableAltView() {
+ this.settings.enableAltView = !this.settings.enableAltView
+ this.saveSettings()
+ },
toggleJumpForward() {
var next = (this.currentJumpForwardTimeIndex + 1) % 3
this.settings.jumpForwardTime = this.jumpForwardItems[next].value
@@ -85,6 +96,7 @@ export default {
const deviceSettings = this.deviceData.deviceSettings || {}
this.settings.disableAutoRewind = !!deviceSettings.disableAutoRewind
+ this.settings.enableAltView = !!deviceSettings.enableAltView
this.settings.jumpForwardTime = deviceSettings.jumpForwardTime || 10
this.settings.jumpBackwardsTime = deviceSettings.jumpBackwardsTime || 10
}
diff --git a/plugins/capacitor/AbsDatabase.js b/plugins/capacitor/AbsDatabase.js
index bb7bac28..69cc7b9f 100644
--- a/plugins/capacitor/AbsDatabase.js
+++ b/plugins/capacitor/AbsDatabase.js
@@ -164,7 +164,7 @@ class AbsDatabaseWeb extends WebPlugin {
async getLocalLibraryItem({ id }) {
return this.getLocalLibraryItems().then((data) => data.value[0])
}
- async getLocalLibraryItemByLLId({ libraryItemId }) {
+ async getLocalLibraryItemByLId({ libraryItemId }) {
return this.getLocalLibraryItems().then((data) => data.value.find(lli => lli.libraryItemId == libraryItemId))
}
async getAllLocalMediaProgress() {
diff --git a/plugins/constants.js b/plugins/constants.js
index b1471010..e6e84210 100644
--- a/plugins/constants.js
+++ b/plugins/constants.js
@@ -5,6 +5,12 @@ const DownloadStatus = {
FAILED: 3
}
+const SyncStatus = {
+ UNSET: 0,
+ SUCCESS: 1,
+ FAILED: 2
+}
+
const CoverDestination = {
METADATA: 0,
AUDIOBOOK: 1
@@ -31,6 +37,7 @@ const PlayerState = {
const Constants = {
DownloadStatus,
+ SyncStatus,
CoverDestination,
BookCoverAspectRatio,
PlayMethod,
diff --git a/plugins/db.js b/plugins/db.js
index 58b929af..1b31332e 100644
--- a/plugins/db.js
+++ b/plugins/db.js
@@ -54,8 +54,8 @@ class DbService {
return AbsDatabase.getLocalLibraryItem({ id })
}
- getLocalLibraryItemByLLId(libraryItemId) {
- return AbsDatabase.getLocalLibraryItemByLLId({ libraryItemId })
+ getLocalLibraryItemByLId(libraryItemId) {
+ return AbsDatabase.getLocalLibraryItemByLId({ libraryItemId })
}
getAllLocalMediaProgress() {
diff --git a/plugins/server.js b/plugins/server.js
index ca1a2e3c..35c9ebd5 100644
--- a/plugins/server.js
+++ b/plugins/server.js
@@ -39,6 +39,7 @@ class ServerSocket extends EventEmitter {
logout() {
if (this.socket) this.socket.disconnect()
+ this.removeListeners()
}
setSocketListeners() {
@@ -54,6 +55,14 @@ class ServerSocket extends EventEmitter {
// })
}
+ removeListeners() {
+ if (!this.socket) return
+ this.socket.removeAllListeners()
+ if (this.socket.io && this.socket.io.removeAllListeners) {
+ this.socket.io.removeAllListeners()
+ }
+ }
+
onConnect() {
console.log('[SOCKET] Socket Connected ' + this.socket.id)
this.connected = true
@@ -67,18 +76,10 @@ class ServerSocket extends EventEmitter {
this.connected = false
this.$store.commit('setSocketConnected', false)
this.emit('connection-update', false)
-
- this.socket.removeAllListeners()
- if (this.socket.io && this.socket.io.removeAllListeners) {
- this.socket.io.removeAllListeners()
- }
}
onInit(data) {
console.log('[SOCKET] Initial socket data received', data)
- if (data.serverSettings) {
- this.$store.commit('setServerSettings', data.serverSettings)
- }
this.emit('initialized', true)
}
diff --git a/store/index.js b/store/index.js
index be97a556..cb8dbc8b 100644
--- a/store/index.js
+++ b/store/index.js
@@ -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,
@@ -19,7 +21,8 @@ export const state = () => ({
showSideDrawer: false,
isNetworkListenerInit: false,
serverSettings: null,
- lastBookshelfScrollData: {}
+ lastBookshelfScrollData: {},
+ lastLocalMediaSyncResults: null
})
export const getters = {
@@ -44,6 +47,10 @@ export const getters = {
getJumpBackwardsTime: state => {
if (!state.deviceData || !state.deviceData.deviceSettings) return 10
return state.deviceData.deviceSettings.jumpBackwardsTime || 10
+ },
+ getAltViewEnabled: state => {
+ if (!state.deviceData || !state.deviceData.deviceSettings) return false
+ return state.deviceData.deviceSettings.enableAltView
}
}
@@ -61,6 +68,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)
+ })
}
}
@@ -113,6 +126,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
@@ -126,5 +142,8 @@ export const mutations = {
setServerSettings(state, val) {
state.serverSettings = val
this.$localStore.setServerSettings(state.serverSettings)
+ },
+ setLastLocalMediaSyncResults(state, val) {
+ state.lastLocalMediaSyncResults = val
}
}
\ No newline at end of file
diff --git a/store/user.js b/store/user.js
index c37568bb..4f76dfb2 100644
--- a/store/user.js
+++ b/store/user.js
@@ -22,6 +22,9 @@ export const getters = {
getServerAddress: (state) => {
return state.serverConnectionConfig ? state.serverConnectionConfig.address : null
},
+ getServerConfigName: (state) => {
+ return state.serverConnectionConfig ? state.serverConnectionConfig.name : null
+ },
getCustomHeaders: (state) => {
return state.serverConnectionConfig ? state.serverConnectionConfig.customHeaders : null
},
diff --git a/tailwind.config.js b/tailwind.config.js
index 368e3bfd..22555f27 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -36,6 +36,15 @@ module.exports = {
},
fontSize: {
xxs: '0.625rem'
+ },
+ maxWidth: {
+ '24': '6rem'
+ },
+ minWidth: {
+ '12': '3rem'
+ },
+ minHeight: {
+ '12': '3rem'
}
}
},