ufosc / OSC-Proximity-Chat-App

Talk to the people closest to you. An open source React Native app that combines location and communication into one.
https://osc-proximity-documentation.vercel.app/
GNU General Public License v3.0
40 stars 92 forks source link

Update server UserConfig document from client set profile picture/display name #291

Open h1divp opened 6 days ago

h1divp commented 6 days ago

For #254.

Summary

Currently, the user is able to set their profile picture (a numbered image, and color hex code), and their display name (string) through the Settings Screen.

We need to make sure that, once these settings change, a user's UserConfig document gets updated in Firebase through a fetch call to our backend web API. We also need a way to make similar calls that retrieve UserConfig information, so that profile pictures and display names (among other things) can be retrieved for every message. To do this we need to:

  1. Create two web API endpoints in the backend that update the displayName and userIcon values for the UserConfig firebase document defined in the UserConfig type. The web API lives in /server/src/routes and the endpoints should be created in /server/src/routes/user. Needed error checking code should also be implemented, following the style of the other files in this directory. Note that this Firebase document gets created in a call made in the frontend after the user signs up.
  2. A "Fetch Context" should be created in the frontend, following the style of the Socket Context. The purpose of this file will be to make any needed fetch requests to our backend web API, rather than hardcoding them inside of other files. We currently make all of our backend requests via the Socket Context, which updates too quickly for the purpose of the simple value changes we need.
  3. After UserConfig settings are updated in the Settings Page, use this new context to send the requests to the backend so that the database can be updated upon updates made to display name and profile picture state.

After making these changes, create a PR and mention the Issue Number for this issue (so that it can close automatically after a merge). Comment below to be assigned.

Dependent issues

h1divp commented 6 days ago

One more small thing: The UserConfig type in the backend currently needs a bit of updating. The document attributes should match what's used when the document is created in the frontend. This needs to be put into its own type file in the frontend too but hasn't yet. Apologies for any confusion.

eris6 commented 5 days ago

i can try this !