- Added a method to send failure notifications to Flutter when the background service fails to enter the foreground.
- Implemented a broadcast receiver to handle service failure notifications and notify Flutter about the failure.
- Enhanced the persistent streaming service to attempt recovery for failed streams.
- Introduced heartbeat monitoring for SSE streams to detect stale connections and trigger recovery actions.
Hide archived assistant variants in the linear chat view and track
previous assistant as versions so regenerated responses do not
duplicate or lose history. When regenerating, mark the previous assistant
message with an archivedVariant flag for the UI and keep it in server
history. Add a ChatMessageVersion model and a versions field to
ChatMessage to store prior generated variants. Implement
archiveLastAssistantAsVersion in chat providers to snapshot the last
assistant message into versions and reset the message for a fresh
streamed generation. Finalize flow updates to attach an adjacent archived
assistant as a version when needed so the UI can present a switcher
between current and past variants. These changes prevent duplicate
messages, preserve previous responses, and enable variant switching.
Introduce server TTS support and engine selection while keeping
device TTS as the default.
- Add new persistence keys for storing TTS engine and selected
server voice (ttsEngine, ttsServerVoiceId, ttsServerVoiceName).
- Extend TextToSpeechService to support two engines:
TtsEngine.device (FlutterTts) and TtsEngine.server (remote audio).
- Wire in an AudioPlayer and optional ApiService to fetch raw
audio bytes from the server and play them, with event hooks
mapped to existing lifecycle callbacks.
- Implement fallback to device TTS on server errors or empty
responses, and ensure player lifecycle (pause/stop/dispose)
is handled when using server engine.
- Allow engine and preferred voice to be configured before
initialization and updated at runtime via updateSettings.
This enables selecting a server-side voice and using a remote
TTS provider while preserving compatibility with the existing
device TTS implementation.
- Updated multiple instances of the 'monospace' font family to use AppTypography.monospaceFontFamily for consistency across the application.
- This change enhances maintainability and ensures a unified typography approach throughout the app.
- Updated the file attachment service to utilize a new LocalAttachment class, improving the management of file metadata such as display names.
- Refactored methods for picking and uploading files to accommodate the new LocalAttachment structure, ensuring consistent handling of file attributes.
- Improved the chat page to validate and manage file attachments more effectively, enhancing user experience during file uploads.
- Added functionality for image previews in the file attachment widget, allowing users to see selected images before sending.
- Introduced a remove button for attachments, improving usability by enabling users to easily discard unwanted files.
- Replaced references to AppColorPalettes with TweakcnThemes across various files to standardize theme usage.
- Updated the AppTheme and AppColorTokens to utilize TweakcnThemeDefinition for improved theme management.
- Adjusted UI components in ChatPage, ChatsDrawer, AppCustomizationPage, and ProfilePage to align with the new theme structure, ensuring consistent styling and color application.
- Removed the deprecated color_palettes.dart file to streamline the theme architecture.
- Introduced new preference keys for TTS settings: voice, speech rate, pitch, and volume.
- Updated SettingsService to handle TTS settings and persist them.
- Enhanced AppSettings to include TTS-related properties.
- Implemented TTS settings UI in AppCustomizationPage, allowing users to select voice and adjust speech parameters.
- Added localization support for TTS settings in multiple languages.
- Updated the Deliverfile to submit for review and skip metadata and screenshots.
- Removed outdated build lane from Fastfile.
- Refactored API service to eliminate fallback to latest assistant message, addressing duplication issues in multi-turn conversations.
This commit refactors the connectivity service to be more robust and less prone to UI flicker.
Key changes:
- Any successful API response now briefly suppresses the offline warning. This prevents the UI from flashing an offline message between regular connectivity checks.
- The threshold for showing the offline warning is increased from 2 to 3 consecutive failed health checks.
- The timeout for health checks is increased to better handle slow networks.
- The offline warning is now suppressed if there are active data streams to avoid interrupting the user.
- A custom JSON converter is added for conversation metadata to handle potential type mismatches from local storage.
- Integrated BackgroundTasks framework in iOS to manage background processing for audio streams.
- Added methods to register, schedule, and handle background tasks, allowing streams to continue for extended periods.
- Enhanced the BackgroundStreamingHandler to support background task notifications and keep-alive signals.
- Updated Info.plist to permit background task identifiers, ensuring compliance with iOS requirements.
- Improved the PersistentStreamingService to handle background task extensions and keep-alive signals effectively, enhancing overall streaming reliability.
- Deleted the SelfSignedCertificateManager and its associated files to simplify the certificate management process.
- Updated ApiService and ConnectivityService to include self-signed certificate configuration directly, enhancing clarity and maintainability.
- Adjusted comments to reflect the new approach to handling self-signed certificates, ensuring better understanding of security considerations.
- Improved the application startup sequence by deferring unnecessary initializations, contributing to a more efficient first paint performance.
- Updated the wake lock duration in BackgroundStreamingHandler to 3 hours, ensuring the service remains active for longer periods.
- Modified the keepAlive method to support both iOS and Android, allowing for better background task management across platforms.
- Implemented a periodic keep-alive timer in VoiceCallService to refresh the wake lock every 5 minutes, enhancing service reliability during voice calls.
- Added debug logging for successful keep-alive invocations, improving traceability of background operations.
- Updated SocketServiceManager to read the authTokenProvider3 without watching it, preventing unnecessary rebuilds on token changes.
- Enhanced SocketService to manage event listeners more effectively by adding and removing event handlers for 'events' and 'events:channel', improving overall socket management.
- Updated BackgroundStreamingHandler to include microphone permission handling for background execution.
- Modified startBackgroundExecution method to accept a requiresMicrophone parameter, allowing dynamic management of streams requiring microphone access.
- Adjusted service intent to pass microphone requirement status, improving service behavior based on app state.
- Enhanced VoiceCallService to utilize the new microphone support during voice call streaming, ensuring proper resource management.
- Improved BackgroundStreamingService to manage foreground service notifications more effectively, ensuring compliance with Android requirements.
- Implemented dynamic foreground service type resolution based on microphone permission, enhancing service behavior based on app state.
- Added checks for app foreground status in connectivity management, improving responsiveness to network changes.
- Refactored notification handling to streamline service lifecycle management and improve code maintainability.
- Integrated connectivity status monitoring into the RouterNotifier to manage navigation based on network availability.
- Refactored ConnectivityService to streamline connectivity checks and improve state management, ensuring a more reliable online/offline status.
- Updated the connection issue page to directly utilize the connectivity status provider, simplifying the connectivity state handling.
- Improved offline indicator behavior to provide clearer feedback on connectivity changes.
- Enhanced the persistent streaming service to react to connectivity status changes more effectively.
- Added support for self-signed TLS certificates in the ApiService, allowing configuration based on server settings.
- Introduced a toggle in the ServerConnectionPage to enable or disable trusting self-signed certificates.
- Updated localization files to include new strings for self-signed certificate settings in multiple languages.
- Enhanced the OptimizedStorageService to manage trusted servers based on user preferences for self-signed certificates.
- Improved error handling and logging throughout the affected services to ensure clarity and maintainability.
- Added `connectivity_plus` dependency to manage network connectivity status.
- Updated `pubspec.yaml` to include the new dependency version.
- Enhanced `ConnectivityService` to utilize `connectivity_plus` for improved connectivity monitoring and handling.
- Refactored connectivity checks and state management for better performance and reliability.
- Eliminated unnecessary calls to _bindCoreSocketHandlers() in the SocketService class, streamlining the socket event subscription process.
- Improved code clarity and maintainability by reducing redundant method invocations during socket event handling.
- Introduced pre-compiled regex patterns across various components, including streaming_helper, markdown_stream_formatter, and assistant_message_widget, to enhance performance during image extraction and markdown formatting.
- Updated the AssistantMessageWidget to utilize these optimized patterns for TTS sanitization and image processing, reducing unnecessary regex evaluations.
- Improved overall efficiency in handling markdown content by leveraging pre-compiled patterns for common markdown syntax detection.
- Updated BackgroundStreamingService to start in the foreground immediately to prevent timeout issues, with a placeholder notification.
- Enhanced error handling in BackgroundStreamingHandler to catch exceptions when starting the foreground service, ensuring active streams are cleared if the service fails to start.
- Refactored saveStreamStatesForRecovery method to improve logging and clarity in stream state management.
- Added checks to close suspended stream controllers when transitioning to the foreground, enhancing resource management.
- Added checks in the ConnectivityService to prevent operations on a closed stream controller, ensuring stability and preventing potential errors.
- Updated the timer creation and stream addition logic to only execute if the service is not disposed, improving resource management.
- Enhanced the dispose method to safely close the connectivity controller, maintaining clean resource handling.
- Refactored the ConnectivityService to replace health URI references with base URI for improved clarity and consistency.
- Updated methods to probe server health and resolve URIs, ensuring a more streamlined approach to connectivity checks.
- Enhanced the provider setup to create a Dio instance with custom headers from the active server configuration, improving flexibility in server communication.
- Removed the omitProviderInModelName key from PreferenceKeys and its associated logic throughout the codebase.
- Updated SettingsService and AppSettings to eliminate references to the omitted provider functionality.
- Cleaned up related localization strings in multiple languages to reflect the removal of this feature.
- Enhanced code clarity and maintainability by streamlining settings management.