Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: minor cleanup and migration of config file + version bump #55

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

0xbrayo
Copy link
Member

@0xbrayo 0xbrayo commented Jan 7, 2025

Important

Refactor configuration management, update dependencies, and improve code organization in lib.rs and manager.rs.

  • Configuration Management:
    • Migrated configuration file handling to use UserDirs for Linux in lib.rs.
    • Renamed autolaunch to autostart in UserConfig in lib.rs.
  • Version Updates:
    • Bumped version numbers for dependencies in Cargo.lock and Cargo.toml, including tauri, fern, nix, and notify.
  • Code Refactoring:
    • Extracted handle_first_run() and listen_for_lockfile() functions in lib.rs for better code organization.
    • Updated SpecificFileWatcher to use Config::default().with_poll_interval() in lib.rs.
    • Improved tray menu update logic in ManagerState in manager.rs.

This description was created by Ellipsis for 3229db4. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 3229db4 in 1 minute and 30 seconds

More details
  • Looked at 903 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. src-tauri/src/lib.rs:75
  • Draft comment:
    Using thread::sleep is a temporary workaround and should be removed or replaced with a more robust solution before production.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR refactors the code to separate the handling of the first run and lockfile listening into distinct functions. This improves code readability and maintainability. However, the thread::sleep in handle_first_run is a temporary workaround and should be addressed before production. The use of unwrap in multiple places can lead to panics if not handled properly. Consider using more robust error handling strategies.
2. src-tauri/src/lib.rs:83
  • Draft comment:
    Using unwrap can lead to panics if the notification fails to show. Consider handling the error more gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR refactors the code to separate the handling of the first run and lockfile listening into distinct functions. This improves code readability and maintainability. However, the use of unwrap in multiple places can lead to panics if not handled properly. Consider using more robust error handling strategies.
3. src-tauri/src/lib.rs:100
  • Draft comment:
    Using unwrap can lead to panics if the window is not found. Consider handling the error more gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR refactors the code to separate the handling of the first run and lockfile listening into distinct functions. This improves code readability and maintainability. However, the use of unwrap in multiple places can lead to panics if not handled properly. Consider using more robust error handling strategies.

Workflow ID: wflow_5GA00PANMi0uDHJA


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@0xbrayo
Copy link
Member Author

0xbrayo commented Jan 7, 2025

Updated SpecificFileWatcher to use Config::default().with_poll_interval() in lib.rs
@ellipsis-dev I can't find this in the git diff

@0xbrayo 0xbrayo merged commit 0538347 into ActivityWatch:master Jan 7, 2025
5 checks passed
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 3229db4 in 1 minute and 56 seconds

More details
  • Looked at 903 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. src-tauri/src/lib.rs:189
  • Draft comment:
    The get_config_path function for Linux still manually constructs the config path using UserDirs. Consider updating it to use ProjectDirs for consistency with other platforms.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
  1. The code explicitly uses different implementations for Linux vs non-Linux. 2. This seems intentional given the cfg attributes. 3. Linux has different conventions for config paths. 4. The manual path construction follows the XDG Base Directory specification for Linux. 5. Using ProjectDirs may not be the right approach for Linux.
    I may be missing some benefits of using ProjectDirs on Linux. Perhaps there are edge cases where the manual path construction could fail.
    The manual path follows Linux conventions and XDG spec. ProjectDirs may actually be less appropriate on Linux where ~/.config is the standard location.
    The comment should be deleted. The Linux-specific implementation appears intentional and follows Linux conventions correctly.
2. src-tauri/src/lib.rs:161
  • Draft comment:
    The UserConfig struct has autostart and autostart_minimized fields, which is consistent with the PR description. No changes needed here.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions renaming autolaunch to autostart in UserConfig, but the UserConfig struct still has autostart and autostart_minimized fields. This is consistent with the description, so no issue here.
3. src-tauri/src/lib.rs:258
  • Draft comment:
    The change from user_config.autolaunch to user_config.autostart is consistent with the PR description and intent. No issues here.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions renaming autolaunch to autostart in UserConfig, and this change is reflected in the code where user_config.autolaunch is replaced with user_config.autostart. This is consistent with the description and intent of the PR.

Workflow ID: wflow_xoENM081Bc1Ze6Ci


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@0xbrayo 0xbrayo deleted the cli-flag-parsing-clean branch January 8, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant