- Deprecated `ApiSettingsViewModel` in favor of enhancing `SettingsViewModel`.
- Moved the API Base URL field from `TaskView` to `SettingsView` to centralize configuration.
- Integrated `RestApiUtility` dependency into `SettingsViewModel` to ensure consistent URL management across the app.
Refactored the ChatViewModel's sendChatMessage method to utilize the continuousModeSteps setting from the SettingsViewModel. This allows the continuous chat mode to honor the user's preference from the settings. Also introduced an optional currentStep parameter with a default value, enabling better control over the progression of continuous mode.
Changed the architecture of the SettingsView to align with the existing pattern in the application. Instead of creating its own instance of SettingsViewModel, the view now accepts an external viewModel as a parameter. This ensures consistency across the application and allows for better modularity and reusability of components.
This commit enriches the `SettingsViewModel` by integrating state persistence functionality and a sign-out method, thus ensuring a more robust and user-friendly settings feature.
Key Enhancements:
1. **State Persistence**:
- Leveraging the `shared_preferences` package, the app now stores and retrieves user preferences related to app settings, ensuring consistency across app restarts.
- Preferences like Dark Mode, Developer Mode, Base URL, and Continuous Mode Steps are persistently stored and loaded when the ViewModel is initialized.
2. **Sign Out Method**:
- A `signOut` method has been introduced in the ViewModel, utilizing the `AuthService` to facilitate user sign-out processes.
- This addition allows for seamless integration of sign-out functionality within the settings interface, granting users the ability to easily terminate sessions.
3. **SettingsView Enhancement**:
- The `SettingsView` has been adapted to incorporate a UI element invoking the `signOut` method, enhancing user interaction within the settings environment.
This enhancement not only bolsters the resilience and usability of the app’s settings but also lays down a structured approach for potential future additions to user preferences and settings-related functionalities.
This commit integrates the newly created `SettingsView` into the `MainLayout`, allowing users to access and interact with the settings through the main user interface of the app. When the user selects the settings tab from the `SideBarView`, the `SettingsView` is displayed alongside the `ChatView`, maintaining consistent layout aesthetics with other views like `TaskView`.
Key Changes:
- A new condition has been added in the `ValueListenableBuilder` within the `MainLayout` to check if the selected view is `'SettingsView'`.
- When `'SettingsView'` is selected, `SettingsView` is rendered with the same width as `TaskView`, and `ChatView` is displayed next to it.
- The state of the skill tree is reset when navigating to `SettingsView` to ensure a clean state.
This integration ensures a seamless user experience, allowing users to navigate and configure app settings easily and efficiently from the main layout of the app.
This commit augments the `SideBarView` by introducing a new `IconButton` that represents a tab for the newly created `SettingsView`. This enhancement allows users to navigate to the settings page directly from the sidebar, improving accessibility to app configuration options.
Key Changes:
- A new `IconButton` with a settings icon has been added to the sidebar’s `Column` widget.
- Selecting the settings tab updates the `selectedViewNotifier.value` to `'SettingsView'`, indicating the user's intent to navigate to the settings page.
- Visual feedback is provided by altering the color of the settings icon based on whether the settings tab is currently selected.
This addition ensures seamless integration of the `SettingsView` into the existing navigation structure, enabling users to easily configure app settings.
This commit refines the `populateSelectedNodeHierarchy` method in the `SkillTreeViewModel` to accurately represent nodes that possess multiple parent nodes, ensuring a comprehensive and non-redundant representation of the entire hierarchy leading back to the root nodes.
Modifications and Features:
- The method now employs recursion to traverse all possible paths back to the root nodes from a selected node, capturing every unique node in the hierarchies.
- A `Set` is utilized to monitor and ensure that each node is only added once to the `_selectedNodeHierarchy` list, eliminating the possibility of duplicates.
- The finalized `_selectedNodeHierarchy` list is constructed such that the root of the tree is the last item in the list, providing a more logical representation of the hierarchy.
These enhancements ensure a more accurate and efficient representation of the skill tree structure, particularly in scenarios where nodes have multiple parents, facilitating better navigation and interaction within the skill tree.
This commit introduces the `SettingsView` class, which is responsible for rendering the user interface for the settings feature of the app. This View is associated with the `SettingsViewModel` for state management and logic.
Features Represented in this View:
- Dark Mode: A switch to enable or disable Dark Mode.
- Developer Mode: A switch to enable or disable Developer Mode.
- Base URL: A text field to input and configure the Base URL.
- Continuous Mode Steps: User-friendly '+' and '-' buttons allowing users to configure the number of steps for continuous mode.
The `SettingsView` utilizes the Flutter `ListView` to display various settings options, providing an intuitive and user-friendly experience. It employs reactive state management using the `Provider` package, ensuring that any state changes in the associated ViewModel are reflected immediately in the View. Proper documentation and comments have been added for better code readability and maintenance.
This commit introduces the `SettingsViewModel` class, part of the MVVM architecture, responsible for managing the state and business logic for the settings feature of the app. This ViewModel is associated with the `SettingsView`.
Features Managed by this ViewModel:
- Dark Mode: Toggle the state of Dark Mode and notify listeners.
- Developer Mode: Toggle the state of Developer Mode and notify listeners.
- Base URL: Update the state of Base URL and notify listeners.
- Continuous Mode Steps: Increment and decrement the number of Continuous Mode Steps and notify listeners.
Each change in the state is followed by a notification to the listeners to rebuild the UI components that depend on this state, ensuring a reactive UI. To-do comments have been added where the state needs to be persisted or synchronized with a server.