[Firebase/Librus] Implement basic push integration.

This commit is contained in:
Kacper Ziubryniewicz 2020-01-19 01:17:33 +01:00
parent e40a0ba2bb
commit 4dfb015057

View File

@ -5,7 +5,10 @@
package pl.szczodrzynski.edziennik.data.firebase package pl.szczodrzynski.edziennik.data.firebase
import pl.szczodrzynski.edziennik.App 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.data.db.entity.Profile
import pl.szczodrzynski.edziennik.getString
class SzkolnyLibrusFirebase(val app: App, val profiles: List<Profile>, val message: FirebaseService.Message) { class SzkolnyLibrusFirebase(val app: App, val profiles: List<Profile>, val message: FirebaseService.Message) {
/*{ /*{
@ -19,7 +22,15 @@ class SzkolnyLibrusFirebase(val app: App, val profiles: List<Profile>, val messa
"gcm.notification.icon": "notification_event.png", "gcm.notification.icon": "notification_event.png",
"objectType": "Calendars/TeacherFreeDays", "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)
}}
} }