feat(zen-workspaces): Add workspace theme sync support

This commit adds support for syncing workspace themes across devices.

The following changes were made:

- Added theme properties to the Zen workspace schema:
    - `theme_type` (string): Type of theme (e.g., "gradient", "solid").
    - `theme_colors` (JSON string): Array of gradient colors.
    - `theme_opacity` (number): Opacity of the theme.
    - `theme_rotation` (number): Rotation of the theme.
    - `theme_texture` (number): Texture of the theme.
- Updated the `ZenWorkspacesSync` class to handle theme data.
- Added validation for theme properties.
- Updated the `ZenWorkspacesStorage` class to save and load workspace themes.
- Bumped the `ZenWorkspacesEngine` version to 2.
This commit is contained in:
Kristijan Ribarić 2024-10-26 19:24:40 +02:00
parent 182f221373
commit 06d85541b1
2 changed files with 52 additions and 4 deletions

View file

@ -273,7 +273,8 @@ var ZenWorkspacesStorage = {
});
},
async saveWorkspaceTheme(uuid, theme) {
async saveWorkspaceTheme(uuid, theme, notifyObservers = true) {
const changedUUIDs = [uuid];
await PlacesUtils.withConnectionWrapper('saveWorkspaceTheme', async (db) => {
await db.execute(`
UPDATE zen_workspaces
@ -298,6 +299,10 @@ var ZenWorkspacesStorage = {
await this.markChanged(uuid);
await this.updateLastChangeTimestamp(db);
});
if (notifyObservers) {
this._notifyWorkspacesChanged("zen-workspace-updated", changedUUIDs);
}
},
async getChangedIDs() {