SUSI allows the user to rate the SUSI Skills with the five-star rating system. SUSI offer a good feedback system where the user can post feedback to any skill by using iOS, Android, and Web clients. In Skill Detail, there is a skill feedback text field where the user can write feedback about SUSI Skill. We display the users posted feedbacks on Skill Detail screen. In this post, we will see how the displaying skills feedback feature implemented on SUSI iOS.
We are displaying three feedback on Skill Detail screen, to see all feedback, there is a “See All Review” option, by clicking user is directed to a new screen where he/she can see all feedback related to particular skill.
We use the endpoint below for getting skill feedback from server side –
With the following params:
- Skill Name
The API endpoint above return the all the feedback array related to particular susi skill. We store feedbacks in an array of
Feedback object, which holds three value:
- Feedback String – Feedback string posted by the user
- Email – Email address of feedback poster user
- Time Stamp – Time of posting feedback
To display feedbacks, we are using
UITableView with two prototype cells, one for feedbacks and one for “See All Review” option.
There can be different cases eg. when the total number of feedback for skill is less than three or three. When the feedback count is three or less than three, there is no need to show “See All Review” option. Also, tableView height is different for different feedback count. For varying tableView height, we have created an outlet for tableView height constraints and vary accordingly.
Handling number of
tableView rows –
Where feedbacks is the array of
Feedback object which holds the feedbacks we are getting from the server side for a skill.
In the above method, we see that how we are handling the number of cells case. Now let’s see how to handle which cells to be present on basis of the number of cells case –
If the number of feedbacks is greater than three than we provide “See All Review” option to the user to see all the feedback related to skill. We are displaying all feedbacks using
UITableViewController. When the user clicks the “See All Review” option, we pass the feedbacks (Array of all the feedback) to new
UITableViewController. By passing feedbacks, we are reducing one network call.
On all skill feedback screen, we are displaying the full review. For the different size of text, we are setting the different size of cell size by using the method below:
Final Output –
- SUSI API Link: https://api.susi.ai/
- SUSI iOS Link: https://github.com/fossasia/susi_iOS
- Apple’s Documentation on UITableViewDelegate: https://developer.apple.com/documentation/uikit/uitableviewdelegate?changes=_6
- Apple’s Documentation on UITableViewDataSource: https://developer.apple.com/documentation/uikit/uitableviewdatasource