Commit 2376e19a authored by WorldTeacher's avatar WorldTeacher
Browse files

feat(settings): add deletePluginSetting method and integrate into DbSettings...

parent 448b8a6e
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -4190,6 +4190,38 @@ function Database:savePluginSetting(key, value)
    return result == SQ3.DONE or result == SQ3.OK
end

--[[--
Delete a single plugin setting from the plugin_settings table.

@param key string Setting key
@return boolean success
--]]
---Database:deletePluginSetting.
function Database:deletePluginSetting(key)
    if not key then
        self.plugin:logErr("BookloreSync Database: deletePluginSetting called without key")
        return false
    end
    key = tostring(key)

    local stmt = self.conn:prepare("DELETE FROM plugin_settings WHERE key = ?")
    if not stmt then
        self.plugin:logErr("BookloreSync Database: Failed to prepare deletePluginSetting:", self.conn:errmsg())
        return false
    end

    local ok, err = pcall(function() stmt:bind(key) end)
    if not ok then
        self.plugin:logErr("BookloreSync Database: Bind failed in deletePluginSetting:", err)
        stmt:close()
        return false
    end

    local result = stmt:step()
    stmt:close()
    return result == SQ3.DONE or result == SQ3.OK
end

--[[--
Return all plugin settings as a key→value Lua table.

+263 −212

File changed.

Preview size limit exceeded, changes collapsed.

+3 −5
Original line number Diff line number Diff line
@@ -153,9 +153,7 @@ Sync mode and upload timing are configured separately in:

See **Sync Behavior** in the settings menu for:

- Automatic / Manual / Custom mode
- Auto-sync on suspend
- Connect WiFi on suspend
- Ask to enable WiFi
- Automatic mode
- Manual only (cache everything) mode

With **Automatic** mode (or **Custom** with both suspend toggles enabled), suspend now queues and attempts to upload both the current session and current progress immediately.
With **Automatic** mode, suspend queues and attempts to upload both the current session and current progress immediately.
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ To disable auto-check, toggle off **Auto-check for updates** in:

If **Use Dev Builds** is enabled, startup auto-check for stable releases is skipped. Manual **Check for Updates** uses the URL from `dev-build.location` instead.

> **Note:** The **Use Dev Builds** toggle is only shown when `dev-build.location` exists in the plugin directory.
> If the file is missing at startup, the plugin automatically disables the dev-build channel (`use_dev_builds = false`).

---

## Manual update check
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ The plugin does not define any gestures of its own. Instead, it registers **seve
|---|---|
| Toggle BookLore Sync | Enables or disables the plugin. No sessions are tracked while it is disabled. |
| Sync Pending Sessions | Immediately uploads all queued sessions, ratings, and annotations. |
| Toggle Manual Sync Only | Switches between automatic sync (after every session) and manual sync (only when triggered). |
| Toggle Manual Sync Only | Switches between **Automatic** mode (syncs in background, including suspend/resume paths) and **Manual only (cache everything)** mode (queue only, sync when triggered). |
| Test Connection | Runs a connection test and shows the result as a notification. |
| Sync Shelf | Triggers a shelf sync immediately. |
| Pull Current Book Progress | Pulls remote progress for the currently open book and applies conflict strategy rules. |
Loading