Fixed a bug that would cause the tab for a day without canteen offers to not be shown, causing the offers for the next days to be shifted over, thus not showing the offers for the last day that's available online. I know I didn't explain that very well, but it's fixed now anyway, soo (: also made some minor visual adjustments to margins and colours

This commit is contained in:
denizk0461
2023-04-20 21:35:09 +02:00
parent 07a2902367
commit b39aa1f003
11 changed files with 88 additions and 64 deletions
@@ -6,6 +6,7 @@ import com.denizk0461.studip.data.StwParser
import com.denizk0461.studip.model.CanteenOffer
import com.denizk0461.studip.model.DietaryPrefObject
import com.denizk0461.studip.model.DietaryPreferences
import com.denizk0461.studip.model.OfferDate
class CanteenViewModel(app: Application) : TemplateViewModel(app) {
@@ -15,6 +16,8 @@ class CanteenViewModel(app: Application) : TemplateViewModel(app) {
fun getDietaryPrefs(): DietaryPrefObject = repo.getDietaryPrefsAsObj()
fun getDates(): List<OfferDate> = returnBlocking { repo.getDates() }
fun fetchOffers(onRefreshUpdate: (status: Int) -> Unit, onFinish: () -> Unit) { doAsync { parser.parse(onRefreshUpdate, onFinish) }}
fun setPreference(pref: DietaryPreferences, newValue: Boolean) { repo.setPreference(pref, newValue) }