forked from github/szkolny
[APIv2/Szkolny] Move profiles parameter to getEvents function
This commit is contained in:
parent
40ba9e8434
commit
50ada5f95b
@ -21,9 +21,9 @@ class ServerSyncTask : IApiTask(-1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun run(app: App, profiles: List<ProfileFull>, taskCallback: EdziennikCallback) {
|
fun run(app: App, profiles: List<ProfileFull>, taskCallback: EdziennikCallback) {
|
||||||
val api = SzkolnyApi(app, profiles)
|
val api = SzkolnyApi(app)
|
||||||
|
|
||||||
val events = api.getEvents()
|
val events = api.getEvents(profiles)
|
||||||
|
|
||||||
if (events.isNotEmpty()) {
|
if (events.isNotEmpty()) {
|
||||||
app.db.eventDao().addAll(events)
|
app.db.eventDao().addAll(events)
|
||||||
|
@ -22,7 +22,7 @@ import retrofit2.converter.gson.GsonConverterFactory
|
|||||||
import retrofit2.create
|
import retrofit2.create
|
||||||
import java.util.concurrent.TimeUnit.SECONDS
|
import java.util.concurrent.TimeUnit.SECONDS
|
||||||
|
|
||||||
class SzkolnyApi(val app: App, val profiles: List<ProfileFull>) {
|
class SzkolnyApi(val app: App) {
|
||||||
|
|
||||||
private var api: SzkolnyService
|
private var api: SzkolnyService
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class SzkolnyApi(val app: App, val profiles: List<ProfileFull>) {
|
|||||||
api = retrofit.create()
|
api = retrofit.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEvents(): List<EventFull> {
|
fun getEvents(profiles: List<ProfileFull>): List<EventFull> {
|
||||||
val teams = app.db.teamDao().allNow
|
val teams = app.db.teamDao().allNow
|
||||||
|
|
||||||
val response = api.serverSync(ServerSyncRequest(
|
val response = api.serverSync(ServerSyncRequest(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user