Homework
Homework — your menu from the API
Homework — the menu from your server.
- Run the backend (localhost:8080) and the app. The menu should load from
GET /menu(a briefLoading, then pizzas). If you see the CLEARTEXT error — remember the gotcha (usesCleartextTraffic). - Check the error state. Stop the backend and reload the menu (or tap "Retry"). You should see
Errorwith a message and a "Retry" button, not a freeze or a crash. - Check the conversion. In the backend one pizza costs
850cents. On screen it must show€8.50(not€850). If you see cents — checktoDomain().
Required tests:
- Load test: with the backend running, the menu shows real pizzas.
- Error test: with no backend you see
Error+ "Retry", not a crash.
To submit: screenshots: (1) the menu from the server, (2) the Error state with no backend.
Tip. It works! But look at that
Networkobject andviewModel { MenuViewModel(MenuRepository(Network.api)) }— you're building the chain by hand. As lesson 6 adds more (auth, orders), this manual wiring grows and starts to tangle. Next lesson is Koin: dependency injection that turns all this assembly into a few declarations. "Feel the pain, earn the tool."