Add chat feature with image attachments to feature request page using Firebase #231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a real-time chat feature to the feature request (Elf) page, allowing users to communicate directly with the app developer. The implementation uses Firebase Firestore as the backend and includes a permission system where the admin can chat with all users while regular users can only chat with the admin. Users can send text messages and attach images.
Resolves #214
Changes
Core Implementation
New Chat System
ChatMessageandChatRoommodels with Firestore serializationChatServicefor managing chat operations with Firebase Firestore and Firebase StorageChatPageUI with message list, input field, image attachments, and FAQ dialogImage Attachment Feature
showPositionedMenuwith "Add Image" optionImageDumperservice for image picking and cropping (1:1 aspect ratio, max 512x512)chat_images/{roomId}/{userId}_{timestamp}.jpgCachedNetworkImagewith loading spinnerPermission System
User Experience
Localization
Added complete bilingual support (English and Chinese) for all chat-related strings:
Testing
Created comprehensive widget tests:
elf_page_test.dart- Tests chat button navigationchat_page_test.dart- Tests authentication flow, FAQ dialog, and message displayTechnical Details
Firestore Structure:
Firebase Storage Structure:
Dependencies:
cloud_firestore: ^5.6.1(no security vulnerabilities)firebase_storage: ^12.5.0(no security vulnerabilities)Before Merging
The following commands need to be run in CI to complete the implementation:
make build-l10n- Generate localization code from ARB filesmake format- Format all Dart filesmake lint- Verify code qualitymake test- Run all tests including new chat testsmake build-mock- Generate mock files for new test dependenciesFirebase Configuration Required
Before deploying to production, Firebase needs to be configured:
chat_service.dart)chat_messages:roomId (ASC) + createdAt (DESC)chat_rooms:participants (ARRAY) + lastMessageAt (DESC)Screenshots
The chat feature includes:
Known Limitations (Intentional MVP Scope)
These can be added in future iterations based on user needs.
Code Quality
ImageDumperservice for consistencyOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.