mirror of
https://github.com/Shchoholiev/shopping-assistant-mobile-client.git
synced 2025-04-04 16:49:37 +00:00
Merge pull request #12 from Shchoholiev/bug/SA-242-messages-not-sent
bug/SA-242-messages-not-sent
This commit is contained in:
commit
2fb39776e8
@ -62,7 +62,7 @@ class SearchService {
|
||||
}
|
||||
|
||||
Future<String> startPersonalWishlist(String message) async {
|
||||
|
||||
logger.d('WISHLIST ID: $wishlistId');
|
||||
if (wishlistId == null) {
|
||||
final options = MutationOptions(
|
||||
document: gql(startPersonalWishlistMutations),
|
||||
@ -81,7 +81,7 @@ class SearchService {
|
||||
}
|
||||
|
||||
Future<void> sendMessages(String message) async {
|
||||
|
||||
logger.d('WISHLIST ID: $wishlistId');
|
||||
if (wishlistId != null) {
|
||||
final sseStream = client.getServerSentEventStream(
|
||||
'api/productssearch/search/$wishlistId',
|
||||
|
@ -114,6 +114,7 @@ class ChatScreenState extends State<ChatScreen> {
|
||||
Future<void> _loadPreviousMessages() async {
|
||||
final pageNumber = 1;
|
||||
final pageSize = 200;
|
||||
logger.d('WISH LIST ID: $widget.wishlistId');
|
||||
appBarTitle = Text(widget.wishlistName, style: TextStyle(fontSize: 18.0));
|
||||
try {
|
||||
final previousMessages = await _searchService.getMessagesFromPersonalWishlist(widget.wishlistId, pageNumber, pageSize);
|
||||
@ -220,7 +221,7 @@ class ChatScreenState extends State<ChatScreen> {
|
||||
|
||||
void _sendMessage() {
|
||||
final message = _messageController.text;
|
||||
|
||||
logger.d('WISH LIST ID: $widget.wishlistId');
|
||||
if (widget.wishlistId.isEmpty) {
|
||||
setState(() {
|
||||
messages.add(Message(text: "What are you looking for?", role: "Application"));
|
||||
@ -231,6 +232,7 @@ class ChatScreenState extends State<ChatScreen> {
|
||||
setState(() {
|
||||
messages.add(Message(text: message, role: "User"));
|
||||
});
|
||||
_searchService.wishlistId = widget.wishlistId.toString();
|
||||
_sendMessageToAPI(message);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user