diff --git a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt index 84b80679..b0889696 100644 --- a/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt +++ b/app/src/main/java/io/github/wulkanowy/services/sync/works/NoteWork.kt @@ -14,6 +14,9 @@ import io.github.wulkanowy.data.db.entities.Semester import io.github.wulkanowy.data.db.entities.Student import io.github.wulkanowy.data.repositories.note.NoteRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.NEUTRAL +import io.github.wulkanowy.sdk.scrapper.notes.NoteCategory.POSITIVE import io.github.wulkanowy.services.sync.channels.NewNotesChannel import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView @@ -41,8 +44,20 @@ class NoteWork @Inject constructor( private fun notify(notes: List) { notificationManager.notify(Random.nextInt(Int.MAX_VALUE), NotificationCompat.Builder(context, NewNotesChannel.CHANNEL_ID) - .setContentTitle(context.resources.getQuantityString(R.plurals.note_new_items, notes.size, notes.size)) - .setContentText(context.resources.getQuantityString(R.plurals.note_notify_new_items, notes.size, notes.size)) + .setContentTitle( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_new_items, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_new_items, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_new_items, notes.size, notes.size) + } + ) + .setContentText( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_notify_new_items, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_notify_new_items, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_notify_new_items, notes.size, notes.size) + } + ) .setSmallIcon(R.drawable.ic_stat_note) .setAutoCancel(true) .setDefaults(DEFAULT_ALL) @@ -52,7 +67,13 @@ class NoteWork @Inject constructor( PendingIntent.getActivity(context, MainView.Section.NOTE.id, MainActivity.getStartIntent(context, MainView.Section.NOTE, true), FLAG_UPDATE_CURRENT)) .setStyle(NotificationCompat.InboxStyle().run { - setSummaryText(context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size)) + setSummaryText( + when (NoteCategory.getByValue(notes.first().categoryType)) { + POSITIVE -> context.resources.getQuantityString(R.plurals.praise_number_item, notes.size, notes.size) + NEUTRAL -> context.resources.getQuantityString(R.plurals.neutral_note_number_item, notes.size, notes.size) + else -> context.resources.getQuantityString(R.plurals.note_number_item, notes.size, notes.size) + } + ) notes.forEach { addLine("${it.teacher}: ${it.category}") } this }) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 48629058..28204419 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -252,6 +252,44 @@ Masz %1$d nowych uwag Masz %1$d nowych uwag + + + %d pochwała + %d pochwały + %d pochwał + %d pochwał + + + Nowa pochwała + Nowe pochwały + Nowe pochwały + Nowe pochwały + + + Masz %1$d nową pochwałę + Masz %1$d nowe pochwały + Masz %1$d nowych pochwał + Masz %1$d nowych pochwał + + + + %d neutralna uwaga + %d neutralne uwagi + %d neutralnych uwag + %d neutralnych uwag + + + Nowa neutralna uwaga + Nowe neutralne uwagi + Nowe neutralne uwagi + Nowe neutralne uwagi + + + Masz %1$d nową neutralną uwagę + Masz %1$d nowe neutralne uwagi + Masz %1$d nowych neutralnych uwag + Masz %1$d nowych neutralnych uwag + Brak zadań domowych Wykonane diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d461299d..b917ad5d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -249,6 +249,34 @@ You received %1$d notes + + + %d praise + %d praises + + + New praise + New praises + + + You received %1$d praise + You received %1$d praises + + + + + %d neutral note + %d neutral notes + + + New neutral note + New neutral notes + + + You received %1$d neutral note + You received %1$d neutral notes + + No info about homework