forked from github/szkolny
[API/Edudziennik] Fix showing notifications for presence attendances.
This commit is contained in:
parent
8e2297359c
commit
a29a534a40
@ -11,12 +11,8 @@ import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_MESSAGES
|
|||||||
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
|
import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE
|
||||||
import pl.szczodrzynski.edziennik.R
|
import pl.szczodrzynski.edziennik.R
|
||||||
import pl.szczodrzynski.edziennik.data.api.models.Data
|
import pl.szczodrzynski.edziennik.data.api.models.Data
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
import pl.szczodrzynski.edziennik.data.db.entity.*
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Event
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Grade.*
|
import pl.szczodrzynski.edziennik.data.db.entity.Grade.*
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Message
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notice
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notification
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_LUCKY_NUMBER
|
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_LUCKY_NUMBER
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ANNOUNCEMENT
|
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ANNOUNCEMENT
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ATTENDANCE
|
import pl.szczodrzynski.edziennik.data.db.entity.Notification.Companion.TYPE_NEW_ATTENDANCE
|
||||||
@ -128,13 +124,14 @@ class DataNotifications(val data: Data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (attendance in app.db.attendanceDao().getNotNotifiedNow(profileId)) {
|
for (attendance in app.db.attendanceDao().getNotNotifiedNow(profileId)) {
|
||||||
var attendanceTypeStr = app.getString(R.string.notification_type_attendance)
|
val attendanceTypeStr = when (attendance.type) {
|
||||||
when (attendance.type) {
|
Attendance.TYPE_ABSENT -> app.getString(R.string.notification_absence)
|
||||||
Attendance.TYPE_ABSENT -> attendanceTypeStr = app.getString(R.string.notification_absence)
|
Attendance.TYPE_ABSENT_EXCUSED -> app.getString(R.string.notification_absence_excused)
|
||||||
Attendance.TYPE_ABSENT_EXCUSED -> attendanceTypeStr = app.getString(R.string.notification_absence_excused)
|
Attendance.TYPE_BELATED -> app.getString(R.string.notification_belated)
|
||||||
Attendance.TYPE_BELATED -> attendanceTypeStr = app.getString(R.string.notification_belated)
|
Attendance.TYPE_BELATED_EXCUSED -> app.getString(R.string.notification_belated_excused)
|
||||||
Attendance.TYPE_BELATED_EXCUSED -> attendanceTypeStr = app.getString(R.string.notification_belated_excused)
|
Attendance.TYPE_RELEASED -> app.getString(R.string.notification_release)
|
||||||
Attendance.TYPE_RELEASED -> attendanceTypeStr = app.getString(R.string.notification_release)
|
Attendance.TYPE_DAY_FREE -> app.getString(R.string.notification_day_free)
|
||||||
|
else -> app.getString(R.string.notification_type_attendance)
|
||||||
}
|
}
|
||||||
val text = app.getString(
|
val text = app.getString(
|
||||||
if (attendance.subjectLongName.isNullOrEmpty())
|
if (attendance.subjectLongName.isNullOrEmpty())
|
||||||
|
@ -11,9 +11,9 @@ import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_ATTENDANCE_TYPES
|
|||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
import pl.szczodrzynski.edziennik.data.db.entity.Attendance
|
||||||
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
import pl.szczodrzynski.edziennik.data.db.entity.Metadata
|
||||||
|
import pl.szczodrzynski.edziennik.data.db.entity.SYNC_ALWAYS
|
||||||
import pl.szczodrzynski.edziennik.get
|
import pl.szczodrzynski.edziennik.get
|
||||||
import pl.szczodrzynski.edziennik.singleOrNull
|
import pl.szczodrzynski.edziennik.singleOrNull
|
||||||
import pl.szczodrzynski.edziennik.utils.models.Date
|
import pl.szczodrzynski.edziennik.utils.models.Date
|
||||||
@ -77,14 +77,16 @@ class EdudziennikWebAttendance(override val data: DataEdudziennik,
|
|||||||
)
|
)
|
||||||
|
|
||||||
data.attendanceList.add(attendanceObject)
|
data.attendanceList.add(attendanceObject)
|
||||||
data.metadataList.add(Metadata(
|
if(type != Attendance.TYPE_PRESENT) {
|
||||||
profileId,
|
data.metadataList.add(Metadata(
|
||||||
Metadata.TYPE_ATTENDANCE,
|
profileId,
|
||||||
id,
|
Metadata.TYPE_ATTENDANCE,
|
||||||
profile.empty,
|
id,
|
||||||
profile.empty,
|
profile.empty,
|
||||||
System.currentTimeMillis()
|
profile.empty,
|
||||||
))
|
System.currentTimeMillis()
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setSyncNext(ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE, SYNC_ALWAYS)
|
data.setSyncNext(ENDPOINT_EDUDZIENNIK_WEB_ATTENDANCE, SYNC_ALWAYS)
|
||||||
|
@ -1158,4 +1158,5 @@
|
|||||||
<string name="event_manual_unshare_remove">Usuwam udostępnione wydarzenie...</string>
|
<string name="event_manual_unshare_remove">Usuwam udostępnione wydarzenie...</string>
|
||||||
<string name="event_manual_remove">Usuwam wydarzenie...</string>
|
<string name="event_manual_remove">Usuwam wydarzenie...</string>
|
||||||
<string name="counter_activity_sync">Synchronizuj</string>
|
<string name="counter_activity_sync">Synchronizuj</string>
|
||||||
|
<string name="notification_day_free">Dzień wolny</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user