forked from github/szkolny
[Firebase/Librus] Implement basic push integration.
This commit is contained in:
parent
e40a0ba2bb
commit
4dfb015057
@ -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<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",
|
||||
"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)
|
||||
}}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user