This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2023-04-16 18:19:06 +02:00
|
|
|
package com.denizk0461.studip.viewmodel
|
|
|
|
|
|
|
|
|
|
import android.app.Application
|
|
|
|
|
import androidx.lifecycle.LiveData
|
|
|
|
|
import com.denizk0461.studip.data.StwParser
|
|
|
|
|
import com.denizk0461.studip.model.CanteenOffer
|
|
|
|
|
|
|
|
|
|
class CanteenViewModel(app: Application) : TemplateViewModel(app) {
|
|
|
|
|
|
|
|
|
|
private val parser = StwParser()
|
|
|
|
|
|
|
|
|
|
val allOffers: LiveData<List<CanteenOffer>> = repo.allOffers
|
|
|
|
|
|
2023-04-17 14:19:06 +02:00
|
|
|
// fun insertOffers(offers: List<CanteenOffer>) { doAsync { repo.insertOffers(offers) }}
|
2023-04-16 18:19:06 +02:00
|
|
|
fun nukeOffers() { doAsync { repo.nukeOffers() }}
|
|
|
|
|
|
|
|
|
|
fun fetchOffers(onFinish: () -> Unit) { doAsync { parser.parse(onFinish) }}
|
|
|
|
|
}
|