- Extended TaskService to manage a list of deleted tasks using shared_preferences.
- Modified TaskViewModel to filter out tasks that have been marked as deleted locally.
- Loaded the list of deleted tasks during app initialization in main.dart.
- Replaced direct service initialization with Provider and ProxyProvider in main.dart.
- Introduced a ChangeNotifierProxyProvider for ApiSettingsViewModel to include a reference to RestApiUtility.
- Refactored MyApp class to fetch services from providers instead of direct instantiation.
This commit enhances the dependency injection pattern to support dynamic updates to the API base URL. The use of ProxyProvider allows for more flexible and efficient management of dependencies, particularly between RestApiUtility and other services.
- Added ApiBaseUrlField widget to the TaskView.
- Included a TextEditingController to manage the API base URL value.
- Initialized the text field with the current base URL value from ApiSettingsViewModel.
- Modified the layout to place the API base URL field and associated buttons below the task list.
The commit introduces a user interface enhancement that allows the user to update the API base URL directly from the TaskView. This ensures better configurability and user experience.
- Added a reference to RestApiUtility within ApiSettingsViewModel.
- Modified _loadBaseURL and updateBaseURL methods to update the base URL in RestApiUtility whenever a change is made.
- This ensures that changes to the base URL in the settings are propagated to the utility responsible for making API calls.
This integration allows the application to dynamically update the base URL for API calls through the user interface, enhancing flexibility and configurability.
- Extracted the API Base URL field and associated buttons into a new ApiBaseUrlField widget.
- Utilized Consumer to listen for changes in ApiSettingsViewModel.
- Maintained the look and feel consistent with the application's existing UI elements.
This refactor enhances code modularity and readability by isolating the API settings UI in its own widget.
Updated main.dart to provide ApiSettingsViewModel at the top-level using MultiProvider. This ensures that the ViewModel is accessible throughout the app, allowing for dynamic updates to the API's base URL.
Modified RestApiUtility to include a method for updating the base URL dynamically. This allows the application to adapt to changes in the API's base URL without requiring a restart.
Created a new ViewModel called ApiSettingsViewModel that is responsible for getting and setting the API's base URL. Utilized the shared_preferences package for persistent storage of the base URL.
This commit updates the ViewModel classes for both Chat and Task to accommodate the new structured responses received from the API. These changes are essential for the correct functioning of the application as they deal with the new TaskResponse and Step objects.
Updates in ChatViewModel:
- Modified `fetchChatsForTask` to handle structured step data
- Updated how steps are retrieved and processed
Updates in TaskViewModel:
- Updated `fetchTasks` to use the new TaskResponse object
- Refactored task fetching and selection logic
These updates ensure that the ViewModel classes are aligned with the new structured API responses, improving data handling and UI updates.
This commit updates the ChatService and TaskService classes to use the api.get method instead of the previous api.getList. This change allows us to handle structured API responses more effectively, particularly those containing pagination information and detailed task and step data.
- Update ChatService methods to use api.get
- Update TaskService methods to use api.get
- Handle structured TaskResponse in TaskService.listAllTasks
This commit introduces a new class called TaskResponse, which holds both the tasks and pagination information returned from the API. The class includes a factory constructor to create an instance from JSON data, ensuring that the API response is neatly packaged into an easily manageable object. This enhances code readability and maintainability.
- Create a TaskResponse class with tasks and pagination fields
- Add a factory constructor for JSON to TaskResponse conversion
This commit updates the Task model to include optional fields for
'additionalInput' and 'artifacts'. The 'fromMap' factory method is also
adapted to populate these fields if they exist in the JSON response.
This change aligns the Task model with the expected server responses,
making it more flexible and robust.
Added a new Pagination class to model the pagination data that comes with API responses. This will help in handling paginated data more effectively and transparently.
The Pagination class includes fields for total items, total pages, current page, and page size. It also includes a factory constructor for creating an instance from a JSON object.