add 'Alternative Bookshelf View' setting

This commit is contained in:
Sam Bloomingdale 2022-07-27 12:58:06 -05:00
parent 76882780a4
commit d52c326123
8 changed files with 31 additions and 7 deletions

5
.gitignore vendored
View file

@ -86,6 +86,11 @@ sw.*
# macOS # macOS
.DS_Store .DS_Store
# xCode
*.pbxproj
ios/app/Podfile
# Vim swap files # Vim swap files
*.swp *.swp

View file

@ -18,6 +18,7 @@ data class ServerConnectionConfig(
data class DeviceSettings( data class DeviceSettings(
var disableAutoRewind:Boolean, var disableAutoRewind:Boolean,
var enableAltView:Boolean,
var jumpBackwardsTime:Int, var jumpBackwardsTime:Int,
var jumpForwardTime:Int var jumpForwardTime:Int
) { ) {

View file

@ -88,10 +88,12 @@ public class AbsDatabase: CAPPlugin {
} }
@objc func updateDeviceSettings(_ call: CAPPluginCall) { @objc func updateDeviceSettings(_ call: CAPPluginCall) {
let disableAutoRewind = call.getBool("disableAutoRewind") ?? false let disableAutoRewind = call.getBool("disableAutoRewind") ?? false
let enableAltView = call.getBool("enableAltView") ?? false
let jumpBackwardsTime = call.getInt("jumpBackwardsTime") ?? 10 let jumpBackwardsTime = call.getInt("jumpBackwardsTime") ?? 10
let jumpForwardTime = call.getInt("jumpForwardTime") ?? 10 let jumpForwardTime = call.getInt("jumpForwardTime") ?? 10
let settings = DeviceSettings() let settings = DeviceSettings()
settings.disableAutoRewind = disableAutoRewind settings.disableAutoRewind = disableAutoRewind
settings.enableAltView = enableAltView
settings.jumpBackwardsTime = jumpBackwardsTime settings.jumpBackwardsTime = jumpBackwardsTime
settings.jumpForwardTime = jumpForwardTime settings.jumpForwardTime = jumpForwardTime

View file

@ -9,12 +9,12 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app' pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorDialog', :path => '..\..\node_modules\@capacitor\dialog' pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog'
pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics' pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network' pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
pod 'CapacitorStatusBar', :path => '..\..\node_modules\@capacitor\status-bar' pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorStorage', :path => '..\..\node_modules\@capacitor\storage' pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage'
end end
target 'App' do target 'App' do

View file

@ -10,6 +10,7 @@ import RealmSwift
class DeviceSettings: Object { class DeviceSettings: Object {
@Persisted var disableAutoRewind: Bool @Persisted var disableAutoRewind: Bool
@Persisted var enableAltView: Bool
@Persisted var jumpBackwardsTime: Int @Persisted var jumpBackwardsTime: Int
@Persisted var jumpForwardTime: Int @Persisted var jumpForwardTime: Int
} }
@ -17,6 +18,7 @@ class DeviceSettings: Object {
func getDefaultDeviceSettings() -> DeviceSettings { func getDefaultDeviceSettings() -> DeviceSettings {
let settings = DeviceSettings() let settings = DeviceSettings()
settings.disableAutoRewind = false settings.disableAutoRewind = false
settings.enableAltView = false
settings.jumpForwardTime = 10 settings.jumpForwardTime = 10
settings.jumpBackwardsTime = 10 settings.jumpBackwardsTime = 10
return settings return settings
@ -26,6 +28,7 @@ func deviceSettingsToJSON(settings: DeviceSettings) -> Dictionary<String, Any> {
return Database.realmQueue.sync { return Database.realmQueue.sync {
return [ return [
"disableAutoRewind": settings.disableAutoRewind, "disableAutoRewind": settings.disableAutoRewind,
"enableAltView": settings.enableAltView,
"jumpBackwardsTime": settings.jumpBackwardsTime, "jumpBackwardsTime": settings.jumpBackwardsTime,
"jumpForwardTime": settings.jumpForwardTime "jumpForwardTime": settings.jumpForwardTime
] ]

3
package-lock.json generated
View file

@ -5,6 +5,7 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "audiobookshelf-app",
"version": "0.9.54-beta", "version": "0.9.54-beta",
"dependencies": { "dependencies": {
"@capacitor/android": "^3.4.3", "@capacitor/android": "^3.4.3",
@ -32981,4 +32982,4 @@
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="
} }
} }
} }

View file

@ -6,6 +6,12 @@
</div> </div>
<p class="pl-4">Disable Auto Rewind</p> <p class="pl-4">Disable Auto Rewind</p>
</div> </div>
<div class="flex items-center py-3" @click="toggleEnableAltView">
<div class="w-10 flex justify-center">
<ui-toggle-switch v-model="settings.enableAltView" @input="saveSettings" />
</div>
<p class="pl-4">Alternative Bookshelf View</p>
</div>
<div class="flex items-center py-3" @click="toggleJumpBackwards"> <div class="flex items-center py-3" @click="toggleJumpBackwards">
<div class="w-10 flex justify-center"> <div class="w-10 flex justify-center">
<span class="material-icons text-4xl">{{ currentJumpBackwardsTimeIcon }}</span> <span class="material-icons text-4xl">{{ currentJumpBackwardsTimeIcon }}</span>
@ -28,6 +34,7 @@ export default {
deviceData: null, deviceData: null,
settings: { settings: {
disableAutoRewind: false, disableAutoRewind: false,
enableAltView: false,
jumpForwardTime: 10, jumpForwardTime: 10,
jumpBackwardsTime: 10 jumpBackwardsTime: 10
} }
@ -60,6 +67,10 @@ export default {
this.settings.disableAutoRewind = !this.settings.disableAutoRewind this.settings.disableAutoRewind = !this.settings.disableAutoRewind
this.saveSettings() this.saveSettings()
}, },
toggleEnableAltView() {
this.settings.enableAltView = !this.settings.enableAltView
this.saveSettings()
},
toggleJumpForward() { toggleJumpForward() {
var next = (this.currentJumpForwardTimeIndex + 1) % 3 var next = (this.currentJumpForwardTimeIndex + 1) % 3
this.settings.jumpForwardTime = this.jumpForwardItems[next].value this.settings.jumpForwardTime = this.jumpForwardItems[next].value
@ -85,6 +96,7 @@ export default {
const deviceSettings = this.deviceData.deviceSettings || {} const deviceSettings = this.deviceData.deviceSettings || {}
this.settings.disableAutoRewind = !!deviceSettings.disableAutoRewind this.settings.disableAutoRewind = !!deviceSettings.disableAutoRewind
this.settings.enableAltView = !!deviceSettings.enableAltView
this.settings.jumpForwardTime = deviceSettings.jumpForwardTime || 10 this.settings.jumpForwardTime = deviceSettings.jumpForwardTime || 10
this.settings.jumpBackwardsTime = deviceSettings.jumpBackwardsTime || 10 this.settings.jumpBackwardsTime = deviceSettings.jumpBackwardsTime || 10
} }

BIN
static/grey_panel.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 KiB