User blocking and reporting is a feature that is required by Apple and Google in all mobile applications where users can create and share their own content with others. This is extremely important in applications such as:
- messaging
- dating apps
- social networks
- marketplace apps
- photo sharing apps
This functionality lives in lib\services\FirebaseHelper.dart which is a helper class for most of our firebase operations.
The functions used for this are :
- FireStoreUtils.blockUser()
- This method is used to report/block the target user
- by default, our app uses Firebase for storing all user reports.
- the Firestore table name is “reports“, which gets automatically created when you report a user for the first time
- FireStoreUtils.getBlocks()
- This method retrieves the blocked/reported users from the “reports” table
Changing to Your Own Backend
If you are planning to use your own backend for the entire application, you’ll need to migrate the user reporting module to your own server endpoints. Fortunately, all you need to do is override these two methods in lib\services\FirebaseHelper.dart .