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

Add Steam Desktop profile overwrite toggle in settings menu #1082

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DarkiRuiz
Copy link

@DarkiRuiz DarkiRuiz commented Jun 23, 2024

Adds a toggle in the settings menu to enable/disable overwritting the Steam Desktop profiles on startup.

imagen

HC does this overwrite automatically by default, but if you don't intend to use any of the controller features, you are still left with blank desktop and chord profiles, and a notification that prompts you to restart Steam if it had been started before HC.

I've also updated the notification to show the inverted operation, so if you had it enabled and the profiles already overwritten, and then disable it, the notification will inform you that Steam needs to restart so the default profiles are properly reverted.

Summary by CodeRabbit

  • New Features

    • Introduced a new setting, "Override Steam Profile On Start," allowing users to override default Steam desktop and chord profiles on application start.
    • Added new UI elements in the Settings page for managing the "Override Steam Profile On Start" setting, including a toggle switch and descriptive text.
  • Improvements

    • Enhanced handling of Steam profiles on desktop platforms with better event management and conditional logic for profile overrides.
    • Updated localized strings and descriptions related to Steam Desktop Layout settings for improved user guidance.
  • Bug Fixes

    • Implemented logic to ensure appropriate file restoration based on desktop profile status when stopping or exiting certain processes.

Copy link
Contributor

coderabbitai bot commented Jun 23, 2024

Walkthrough

The recent updates introduce a new functionality in the HandheldCompanion software, enabling users to override Steam desktop and chord profiles upon starting the application. This includes a new setting "OverrideSteamProfileOnStart" defaulting to True, UI enhancements for setting controls, and updates in event handling to reflect these changes dynamically.

Changes

File(s) Change Summary
HandheldCompanion/App.config, .../Settings.Designer.cs, .../Settings.settings Added a new setting named "OverrideSteamProfileOnStart" with a default value of True.
.../Controls/Hints/Hint_SteamNeptuneDesktop.cs Extended functionality for handling Steam profiles by adding a new event handler for setting changes.
HandheldCompanion/Platforms/Steam.cs Added conditional checks and logic to handle file operations based on the new setting.
.../Resources.Designer.cs, .../Resources.resx Added new localized string properties and data entries related to Steam Desktop Layout and settings.
.../Views/Pages/SettingsPage.xaml, .../Views/Pages/SettingsPage.xaml.cs Added new UI elements and functionality to handle and display the new setting for overriding Steam profiles.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsPage
    participant AppConfig
    participant SteamManager
    User ->> SettingsPage: Toggle OverrideSteamProfileOnStart
    SettingsPage ->> AppConfig: Update OverrideSteamProfileOnStart
    AppConfig -->> SettingsPage: Confirm Update
    User ->> SettingsPage: Start Application
    SettingsPage ->> SteamManager: Check OverrideSteamProfileOnStart
    alt OverrideSteamProfileOnStart is True
        SteamManager ->> SteamProfile: Override Profile
    else
        SteamManager ->> SteamProfile: Use Existing Profile
    end
Loading

Poem

Amidst the code, new strings align,
Overriding profiles, Steam's design.
A toggle switch begins the dance,
Desktop's fate left not to chance.
With each start, new logic beams,
Enhancing user dreams in Steam.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
HandheldCompanion/Properties/Resources.Designer.cs (1)

3773-3780: Review localized string for clarity.

The string Hint_SteamNeptuneReadmeOverridden provides information about restarting Steam which is good. However, ensure that the context in which this message is displayed is clear to the user—that it relates specifically to when they disable the overwrite after it was previously enabled.

Consider adjusting the documentation or UI to clarify when this message will be shown.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0961640 and 8e80556.

Files selected for processing (9)
  • HandheldCompanion/App.config (1 hunks)
  • HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs (4 hunks)
  • HandheldCompanion/Platforms/Steam.cs (2 hunks)
  • HandheldCompanion/Properties/Resources.Designer.cs (3 hunks)
  • HandheldCompanion/Properties/Resources.resx (1 hunks)
  • HandheldCompanion/Properties/Settings.Designer.cs (4 hunks)
  • HandheldCompanion/Properties/Settings.settings (1 hunks)
  • HandheldCompanion/Views/Pages/SettingsPage.xaml (1 hunks)
  • HandheldCompanion/Views/Pages/SettingsPage.xaml.cs (2 hunks)
Files skipped from review due to trivial changes (1)
  • HandheldCompanion/Properties/Resources.resx
Additional comments not posted (15)
HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs (3)

15-15: Addition of event handler for setting changes is appropriate.

The addition of SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged; effectively ensures that the hint updates when the OverrideSteamProfileOnStart setting changes.


71-79: Effective handling of setting changes for Steam profile override.

The method SettingsManager_SettingValueChanged is well-implemented to respond to changes in the OverrideSteamProfileOnStart setting by triggering a UI update through Steam_Updated. This ensures the UI is in sync with the current settings.


29-29: Ensure correct handling of UI updates based on platform status and settings.

The logic within Steam_Updated method correctly updates the UI based on the OverrideSteamProfileOnStart setting and the desktop profile status. However, ensure that the PlatformStatus enum covers all necessary states for robustness.

#!/bin/bash
# Description: Verify all enum values of PlatformStatus are handled.

# Test: Search for the PlatformStatus enum definition and usage. Expect: Comprehensive handling in switch cases.
rg --type cs "enum PlatformStatus"

Also applies to: 44-58

HandheldCompanion/Platforms/Steam.cs (4)

81-85: Restoration of files upon stopping the platform is correctly implemented.

The Stop method properly checks if the desktop profile is applied and restores the files if necessary. This is crucial to ensure the state is correctly reset when the platform stops.
[APROVED]


92-98: Ensure proper detachment of event handlers and file restoration.

It's good to see that the Process_Exited method detaches the SettingsManager_SettingValueChanged event handler and restores the files if needed. This prevents memory leaks and ensures files are restored when the process exits unexpectedly.


152-158: Conditional file overwriting based on settings is correctly implemented.

The conditional logic in ProcessManager_ProcessStarted to overwrite files only if the OverrideSteamProfileOnStart setting is enabled, is a good practice. This respects the user's settings and only modifies the system state when permitted.


166-186: Robust handling of setting changes for file management.

The method SettingsManager_SettingValueChanged in the Steam class effectively handles changes to the OverrideSteamProfileOnStart setting by either replacing or restoring files based on the new value. This dynamic response to setting changes ensures that the system's behavior aligns with user preferences.

HandheldCompanion/App.config (1)

281-283: Correct implementation of new application setting in configuration file.

The addition of the OverrideSteamProfileOnStart setting in the App.config file with a default value of True is correctly implemented. This ensures that the application's default behavior aligns with the intended functionality of overriding Steam profiles on startup.

HandheldCompanion/Properties/Settings.settings (1)

278-280: Proper addition of new setting in settings file.

The new setting OverrideSteamProfileOnStart is correctly added to the Settings.settings file with a default value of True. This maintains consistency across configuration files and supports the new feature.

HandheldCompanion/Views/Pages/SettingsPage.xaml.cs (2)

119-121: Proper handling of new setting toggle in the UI.

The method SettingsManager_SettingValueChanged correctly updates the Toggle_OverrideSteamProfileOnStart based on the setting value. This ensures that the UI reflects the current configuration and responds to changes dynamically.


213-219: Correct implementation of toggle event for new setting.

The Toggle_OverrideSteamProfileOnStart_Toggled method correctly updates the setting when the toggle is changed. This ensures that user changes to the setting are saved and applied correctly.

HandheldCompanion/Views/Pages/SettingsPage.xaml (1)

252-288: Ensure consistent UI design and functionality for the new toggle switch.

The new section for overriding default Steam desktop and chord profiles has been added correctly following the application's UI design patterns. However, ensure that the toggle switch is tested across different platforms and screen sizes to maintain UI consistency and functionality.

#!/bin/bash
# Description: Verify the toggle switch functionality across different platforms and screen sizes.

# Test: Run UI tests for the SettingsPage across multiple devices.
echo "Running UI tests for SettingsPage across multiple devices..."
HandheldCompanion/Properties/Settings.Designer.cs (2)

15-15: Ensure consistency with attribute usage.

The [SettingsProvider(typeof(CustomSettingsProvider))] attribute is correctly used to specify a custom settings provider for the settings class. Ensure that this custom provider is implemented correctly elsewhere in your project to handle settings appropriately.

#!/bin/bash
# Description: Verify the implementation of `CustomSettingsProvider`.

# Test: Search for the implementation of `CustomSettingsProvider`.
rg --type cs $'class CustomSettingsProvider'

1122-1131: Review new setting implementation for OverrideSteamProfileOnStart.

The implementation of the OverrideSteamProfileOnStart setting follows the established pattern for user-scoped settings in the application. The default value is set to True, aligning with the PR description that this setting is enabled by default. Ensure that the logic handling this setting's value change is implemented correctly in the system to reflect the user's choice accurately.

#!/bin/bash
# Description: Verify the handling of `OverrideSteamProfileOnStart` setting changes.

# Test: Search for the usage of the `OverrideSteamProfileOnStart` setting.
rg --type cs $'OverrideSteamProfileOnStart'
HandheldCompanion/Properties/Resources.Designer.cs (1)

8177-8193: Localized string descriptions are clear and informative.

The strings SettingsPage_OverrideSteamProfileOnStart and SettingsPage_OverrideSteamProfileOnStartDesc clearly describe the functionality of the setting. These are well-phrased and should be easily understandable to the end-user.

HandheldCompanion/Properties/Resources.Designer.cs Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e80556 and 70e3347.

Files selected for processing (1)
  • HandheldCompanion/Properties/Resources.Designer.cs (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • HandheldCompanion/Properties/Resources.Designer.cs

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