[AP_04] Migrate homescreen to new API
The new homescreen API is ready (see tc-server!85 (merged)) but we still need to switch over. The new API allows us to disable individual modules remotely (or rather hide them from the homescreen ...) without updatign the app. The new API also provides a new priority-based method for ordering the modules that will allow us to bring new modules to the front.
The new API has two routes (ignore the admin routes):
GET /modules
POST /modules
The GET route gives you a response like this:
[
{
"id": "qanda",
"priority": 100,
"visible": true
},
{
"id": "cafeteria",
"priority": 200,
"visible": true
},
{
"id": "organizer",
"priority": 300,
"visible": true
},
{
"id": "semesterfee",
"priority": 400,
"visible": true
},
{
"id": "comingsoon",
"priority": 500,
"visible": true
}
]
-
id
follows the new ID format as discussed here -
visible
tells you whether or not the user has hidden the module from the homescreen -
priority
specifies the order (lowest number comes first).
The idea behind the priority approach was that it allows us to move new modules to the front upon release without changing the settings for every user. I recommend sticking to multiples of 100 and swapping the values around for moved modules instead of using the numbers inbetween. This is because the backend only stores the difference to the default values (either a change in priority or visibility).
To save the settings, just POST the new JSON back to /modules
.
Everything below this line will be taken care of on the backend side:
@mlbn33 wrote:
Nach Absprache mit Fabian:
-
Reihenfolge initial: - Fragen und Antworten
- Mensa
- Stundenplan
- Semesterbeitrag
- Coming Soon
-
Remove Business Cards -
Remove Bulletin Board -
Remove Events -
Remove Feedback