Commit graph

318 commits

Author SHA1 Message Date
mauro 🤙
7ebaed73c0
Merge pull request #37 from kristijanribaric/feature(workspace-sync)-add-workspace-sync-engine
Feature Sync Workspaces to Services-Sync
2024-10-05 22:23:05 +02:00
Kristijan Ribarić
d3ac1895e5 feat(workspaces): Improve workspace change notification and handling
This commit improves the notification and handling of workspace changes by:

- **Introducing a dedicated observer notification system:** The `ZenWorkspacesStorage` now uses a private helper method (`_notifyWorkspacesChanged`) to notify observers with a list of changed workspace UUIDs. This provides a more efficient and flexible notification system.
- **Updating `ZenWorkspacesTracker` to parse UUIDs:** The `ZenWorkspacesTracker` now correctly parses the JSON stringified array of UUIDs received from the observer, allowing it to handle multiple workspace changes in a single notification.
- **Refactoring `saveWorkspace`, `removeWorkspace`, `setDefaultWorkspace`, and `updateWorkspaceOrder`:** These methods now consistently collect and notify observers about changed UUIDs.
- **Removing unnecessary code:** The previous approach of notifying observers individually for each change has been removed, leading to code simplification and reduced complexity.

This commit ensures that workspace changes are more reliably and efficiently tracked, leading to a smoother and more responsive workspace management experience.
2024-10-05 22:09:54 +02:00
Kristijan Ribarić
86578cb4d3 feat(workspace): Move observer notifications to workspaces storage 2024-10-05 21:16:07 +02:00
Kristijan Ribarić
863dcfa705 feat(workspaces): remove unused used field from workspaces
This commit removes the `used` field from the Workspaces database table and Zen Workspace objects.

The `used` field was originally intended to track whether a workspace was currently being used, but it turned out to be unnecessary. This change simplifies the data model and removes redundant information.
2024-10-05 20:16:20 +02:00
Kristijan Ribarić
b28ca11e57 fix(workspaces): Ensure ZenWorkspacesEngine is registered only once
This commit prevents multiple registrations of the `ZenWorkspacesEngine`.

Previously, the `ZenWorkspacesEngine` was registered unconditionally every time `ZenWorkspaces` was initialized. This could lead to issues if the engine was already registered.

This commit adds a check to ensure that the engine is only registered if it is not already present. This prevents multiple registrations and ensures that the engine is only initialized once.
2024-10-05 19:54:08 +02:00
Kristijan Ribarić
0d161326ef feat: Add workspace ordering and changes tracking
This commit introduces workspace ordering and a new mechanism for tracking changes to workspaces.

**Changes:**

- **Workspace Ordering:** Workspaces can now be ordered using a `position` field. This allows for user-defined ordering of workspaces, improving usability.
- **Changes Tracking:** A new `zen_workspaces_changes` table is added to track changes to workspaces. This allows for more efficient sync operations and improved error handling.

**Benefits:**

- **Improved Workspace Management:** Users can now customize the order of their workspaces.
- **More Efficient Sync:** Changes tracking enables faster and more accurate synchronization of workspaces across devices.
- **Enhanced Error Handling:** Changes tracking helps to identify and resolve conflicts during sync.

**Notes:**

- This change requires deleting the zen_workspaces table in places db
2024-10-05 19:20:19 +02:00
mauro-balades
9f32f780ca
Fixed internal keyboard shortcuts for macos 2024-10-05 18:42:24 +02:00
Kristijan Ribarić
1c7bc5c501 Fix: Remove unnecessary workspace close after saving
This commit removes a call to `this.closeWorkspacesSubView()` after saving a workspace.

The previous behavior caused an error to be thrown because main view was already closed.
2024-10-04 22:40:11 +02:00
Kristijan Ribarić
e366e624d1 Fix: Ensure only one workspace is marked as default
This commit ensures that only one workspace can be marked as default. Previously, multiple workspaces could be marked as default, leading to unexpected behavior.

The commit introduces a transaction to update all workspaces, setting `is_default` to `0` for all workspaces except the one being saved as default. This prevents multiple workspaces from being marked as default.
2024-10-04 22:40:09 +02:00
Kristijan Ribarić
f1f547fe69 fix(zen-workspaces): Correctly emit workspace update notification
The previous implementation of the workspace update notification was using `workspaceData.uuid`, which is incorrect. This commit fixes the issue by using `workspace.uuid` instead, ensuring the correct workspace identifier is sent to observers.
2024-10-04 22:37:35 +02:00
Kristijan Ribarić
4a54adea9a feat(workspaces): Refresh workspace strip after sync completion
This commit adds an observer for the `weave:engine:sync:finish` event and clears the workspace cache when the workspace sync is complete. This ensures that the workspace strip is updated with the latest data after a sync.
2024-10-04 22:37:35 +02:00
Kristijan Ribarić
187dece11c feat: Sync Workspaces to Services-Sync
This commit adds a new feature to synchronize workspaces to the Services-Sync framework.

- **ZenWorkspacesSync.mjs:** A new file that defines a custom engine for syncing workspaces.
- **ZenWorkspaces.mjs:** Modified to register the ZenWorkspacesEngine with the Service engine manager and to update its state using services-sync's notification system.

This feature enables users to sync their workspaces across devices and seamlessly switch between them using the services-sync mechanism.
2024-10-04 22:37:35 +02:00
mauro-balades
fc7f08c827
Prevent loading mutliple times the same feature 2024-10-04 19:18:57 +02:00
mauro-balades
83b672d981
Added pictureinpicture as a prevention from tab unloading 2024-10-04 18:38:11 +02:00
mauro-balades
0590f35751
Refactor: Rename ZenKeyboardShortcutsManager to gZenKeyboardShortcutsManager 2024-10-04 18:22:40 +02:00
mauro-balades
76d22a1f15
Made the code look cleaner 2024-10-04 18:21:39 +02:00
mauro-balades
5822df61e5
Refactor: Migrate workspaces from JSON to new storage system 2024-10-03 22:31:07 +02:00
mauro-balades
c67cca9c70
Save only height and width for the sidebar 2024-10-03 20:49:55 +02:00
mauro-balades
1ed9227c01
Added workspaces migration system 2024-10-03 19:38:51 +02:00
mauro 🤙
a4a77f4dc0
Merge pull request #36 from kristijanribaric/save-workspaces-in-places-db
feat(workspaces): Store workspaces in a database
2024-10-03 19:13:02 +02:00
Kristijan Ribarić
05acfdb27e Fix: Prevent potential crash when workspace doesn't exist
This commit addresses a potential crash that could occur when the active workspace no longer exists. The issue was that the code attempted to access the `uuid` property of the first workspace in the list even if the list was empty.

This commit fixes the issue by using optional chaining (`?.`) to safely access the `uuid` property, ensuring the code doesn't crash if the workspace list is empty.
2024-10-03 11:52:18 +02:00
Kristijan Ribarić
9bcb66c768 feat(workspaces): Use preferences to manage active workspace
This commit updates the workspaces system to use preferences to manage the active workspace, instead of storing the active state in each workspace object.

The following changes were made:

- **ZenWorkspaces.mjs:**
    - Removed the `used` property from workspace objects and replaced it with a preference (`zen.workspaces.active`) to store the active workspace ID.
    - Modified the `getActiveWorkspace` and `changeWorkspace` methods to use preferences instead of the `used` property.
    - Added a new `isWorkspaceActive` method to check if a workspace is active.
- **ZenWorkspacesStorage.mjs:**
    - Removed the `is_active` column from the `zen_workspaces` table.
    - Removed the `setActiveWorkspace` method as the active workspace is now managed by preferences.

This change simplifies the code and makes it easier to manage the active workspace across multiple browser windows and doesn't write to the database on every workspace change. Additionaly, it enables local active workspace selection when workspace sync is implemented.
2024-10-03 10:19:18 +02:00
Kristijan Ribarić
511281c688 feat(db): rename workspace table to zen_workspaces
Renames the `moz_workspaces` table to `zen_workspaces` for consistency and better organization.
2024-10-02 15:32:47 +02:00
Kristijan Ribarić
62be9d1fdd Refactor: Remove unused workspace storage logic 2024-10-02 14:44:48 +02:00
Kristijan Ribarić
de8a857549 feat(workspaces): Store workspaces in a database
This commit introduces a new `ZenWorkspacesStorage` class to handle the persistence of workspaces in a database. The previous implementation used JSON files, but this approach brings several advantages, including:

- Improved performance and scalability
- Easier data management and synchronization
- Enhanced security and data integrity

This change removes the reliance on JSON files and streamlines workspace management, leading to a more robust and reliable system.
2024-10-02 09:37:09 +02:00
mauro-balades
2ea7024eea
Synced workspaces across windows and also implemented MultiWindowFeatures 2024-10-01 23:21:38 +02:00
mauro-balades
fbe5727705
Updated firefox mobile user agent 2024-10-01 20:11:31 +02:00
mauro-balades
9ed3468118
Updates patches for firefox 131.0! 2024-10-01 20:05:10 +02:00
mauro 🤙
42aba602ca
Merge pull request #34 from BrhmDev/fix/change-on-hover-not-using-pref
Fix splitView change on hover not listening to pref.
2024-10-01 07:25:46 +02:00
mauro 🤙
7c43f7943f
Merge pull request #33 from BrhmDev/fix/web-panel-back-and-forward-disable
Disable back and forward button inside web panel when they can't be used.
2024-10-01 07:24:42 +02:00
brahim
0d4bca3ef5 Make splitview change on hover only work when pref true. 2024-10-01 02:19:52 +02:00
brahim
921402f7a1 Disable back and forward button inside web panel when they can't be used. 2024-10-01 01:15:43 +02:00
mauro 🤙
1dd4160831
Merge pull request #32 from skara9/emoji-first-char
Fix display of ZWJ Emojis as Workspace Icons
2024-09-30 19:35:19 +02:00
Sátvik Karanam
65a07ce1c7
use intl segmenter 2024-09-30 02:06:27 -04:00
mauro-balades
e26ea1f4f0 Refactor KeyShortcutModifiers to fix control key behavior and improve consistency 2024-09-30 00:41:14 +02:00
Mauro Baladés
89b572e8fe Refactor KeyShortcutModifiers to fix control key behavior 2024-09-29 22:26:54 +03:00
mauro-balades
f108074b81 Refactor KeyShortcutModifiers to remove unnecessary parameter and improve consistency 2024-09-29 20:18:32 +02:00
mauro-balades
cc4f1a3eb2 Fixed workspace cycling with shortcuts 2024-09-29 19:03:26 +02:00
mauro-balades
50afebec5f Fixed workspace cycle using shortcuts 2024-09-29 19:01:54 +02:00
mauro-balades
2a6755d9ba Fixed duplicate keys on settings page (closes #https://github.com/zen-browser/desktop/issues/1784) 2024-09-29 12:51:37 +02:00
mauro-balades
37804deef0 Refactor ZenSidebarManager to associate browser with tab 2024-09-29 12:18:05 +02:00
mauro-balades
5df1298bfd Refactor keyboard shortcuts to use "Cmd" instead of "Meta" for macOS 2024-09-28 22:10:35 +02:00
mauro-balades
7147fd2dfc Refactor ZenTabUnloader to optimize tab unloading and add context menu options 2024-09-27 20:34:37 +02:00
mauro-balades
3681f71acf Refactor ZenTabUnloader to exclude tabs with sound playing or marked for ignore 2024-09-27 20:09:06 +02:00
mauro-balades
65782ccf69 Refactor ZenSidebarManager to comment out unused code for fetching web panel icons 2024-09-27 19:25:33 +02:00
mauro-balades
8efd7fecbe Refactor ZenSidebarManager to reload browser with default mobile user agent 2024-09-27 19:17:16 +02:00
mauro-balades
7af14f1484 Refactor ZenWorkspaces to fix icon mapping issue 2024-09-27 18:56:37 +02:00
mauro-balades
9ae3de71e7 Refactor ZenTabUnloader to remove unused code and optimize tab unloading timeout 2024-09-27 18:12:49 +02:00
mauro-balades
1fa61f4349 Refactor ZenTabUnloader to simplify tab unloading condition 2024-09-26 18:58:59 +02:00
mauro-balades
cb24052969 Do not show default container context menu if disabled 2024-09-26 18:58:04 +02:00