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