Feedback from users is one of the most important aspect of software development. This helps developers collect data about the bugs that need to be fixed and the improvements that need to be done in a software. This also provides them with an insight into what needs to be done for the long term sustainability of the app.
SUSI.AI Android, web and iOS clients allow user to rate the SUSI Skills allow the user to post feedback about a skill. Users can send their invaluable feedback about how helpful a skill is for them and how could it be improved. This blog focuses on the implementation of the feature to post feedback from the SUSI.AI Android client.
Steps to post feedback
- Log into the app. You will see the Chat Activity once you are logged into the app.
- Tap the FAB on the upper right corner of the Chat Activity.
- You will see the list of all skills.
- Tap on any skill of your choice.
- Write feedback about SUSI skill
Click on POST button to post the skill feedback. A toast, with the message “Skill feedback updated”, will appear at the bottom of the screen.
Note : An anonymous user cannot submit feedback for the skill. You must be logged-in in order to post feedback. If you are not logged-in, the post feedback section would not be visible. Instead you will see a text message saying “Please login to post feedback”.
Implementation of post skill feedback feature
Case 1 : The user is logged in i.e. the access token is not null.
This is how the post feedback UI looks like, when the user is logged in :
Now, add the following code inside a service to make a post request to feedbackSkill.json API.
Further, attach an OnClickListener with the POST button and call the postFeedback() present in the presenter layer, as can be seen in the following code :
The postFeedback() in the presenter will now invoke the postFeedback() method present in the model as follows :
Here is how the postFeedback() method in the model looks like :
Once the call is made successfully to the server, the next step is to update the UI. This is achieved with the help of the onUpdateFeedbackModelSuccess() called above, if the response is received.
Clearly, if the response is successful and the response body is non-null, it implies that the feedback submitted by the user has been successfully updated on the server. Thus, we display a toast to notify the user of the successful submission of the feedback. This is achieved with the help of the updateFeedback() method in the view, as follows :
Note : The response from the server to the above post request would be similar to the one shown below :
Case 2 : The user is not logged in.
In this case simply display a text message saying “Please login to post feedback”.
This is how the post feedback feature has been implemented in SUSI.AI Android App.
- TextInputLayout | Android Developers
- Styling Buttons | Android Developers