diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt index 34c0f220..5bb6d1cf 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/firebase/SzkolnyLibrusFirebase.kt @@ -5,7 +5,10 @@ package pl.szczodrzynski.edziennik.data.firebase import pl.szczodrzynski.edziennik.App +import pl.szczodrzynski.edziennik.data.api.task.EdziennikTask +import pl.szczodrzynski.edziennik.data.api.task.IApiTask import pl.szczodrzynski.edziennik.data.db.entity.Profile +import pl.szczodrzynski.edziennik.getString class SzkolnyLibrusFirebase(val app: App, val profiles: List, val message: FirebaseService.Message) { /*{ @@ -19,7 +22,15 @@ class SzkolnyLibrusFirebase(val app: App, val profiles: List, val messa "gcm.notification.icon": "notification_event.png", "objectType": "Calendars/TeacherFreeDays", }*/ - init { + init { run { + val apiLogin = message.data.getString("userId") ?: return@run - } + val tasks = profiles.filter { + it.getStudentData("accountLogin", "") == apiLogin + }.map { + EdziennikTask.syncProfile(it.id) + } + + IApiTask.enqueueAll(app, tasks) + }} }