From 50ada5f95b7b77940f7751d212be3921d7be4980 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Mon, 9 Dec 2019 16:37:21 +0100 Subject: [PATCH] [APIv2/Szkolny] Move profiles parameter to getEvents function --- .../edziennik/api/v2/events/task/ServerSyncTask.kt | 4 ++-- .../pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/events/task/ServerSyncTask.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/events/task/ServerSyncTask.kt index 49ded1dc..276971b6 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/events/task/ServerSyncTask.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/events/task/ServerSyncTask.kt @@ -21,9 +21,9 @@ class ServerSyncTask : IApiTask(-1) { } fun run(app: App, profiles: List, taskCallback: EdziennikCallback) { - val api = SzkolnyApi(app, profiles) + val api = SzkolnyApi(app) - val events = api.getEvents() + val events = api.getEvents(profiles) if (events.isNotEmpty()) { app.db.eventDao().addAll(events) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt index e583c36a..8d65586b 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt @@ -22,7 +22,7 @@ import retrofit2.converter.gson.GsonConverterFactory import retrofit2.create import java.util.concurrent.TimeUnit.SECONDS -class SzkolnyApi(val app: App, val profiles: List) { +class SzkolnyApi(val app: App) { private var api: SzkolnyService @@ -49,7 +49,7 @@ class SzkolnyApi(val app: App, val profiles: List) { api = retrofit.create() } - fun getEvents(): List { + fun getEvents(profiles: List): List { val teams = app.db.teamDao().allNow val response = api.serverSync(ServerSyncRequest(