T
T
terminator-light2019-09-09 22:19:46
Mobile development
terminator-light, 2019-09-09 22:19:46

How do you implement such logic in your applications?

Let's say a product needs to be added to the cart or favorites, and feedback needs to be given. The user clicks on the button. There are 2 scenarios:
1. A request is sent to the server, a response comes. If successful, it shows that "added ..."
2. Show that "added ...", and it doesn't matter if it was added / not added. Only then do you send a request.
The 1st looks logical, but the answer is not so fast, you have to show the progressbar.
The 2nd can lie to the user: if the connection is lost or the server returns an error, then before that there will be a message about adding, but in the end nothing will be added

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
irishmann, 2019-09-09
@terminator-light

The third option is to set the status "processing" to allow the user to continue using the application, in another thread we wait for the product to be added to the cart, and then we notify the user whether it was successful or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question