From 41d14a3809bc312081d299163927bac9b8194626 Mon Sep 17 00:00:00 2001 From: Koliw Date: Sun, 24 Dec 2023 15:43:35 +0100 Subject: [PATCH] =?UTF-8?q?Dodaj=20opcj=C4=99=20wy=C5=82=C4=85czenia=20pow?= =?UTF-8?q?iadomie=C5=84=20o=20nie=20swoim=20szcz=C4=99=C5=9Bliwym=20numer?= =?UTF-8?q?ku=20Dodaje=20opcj=C4=99=20w=20ustawieniach=20kt=C3=B3ra=20powo?= =?UTF-8?q?duje=20=C5=BCe=20gdy=20szcz=C4=99=C5=9Bliwy=20numerek=20wypadni?= =?UTF-8?q?e=20na=20kogo=C5=9B=20innego=20to=20nie=20jest=20wysy=C5=82ane?= =?UTF-8?q?=20powiadomienie.=20Codzienny=20spam=20=C5=BCe=20numer=20X=20ma?= =?UTF-8?q?=20dzi=C5=9B=20szcz=C4=99=C5=9Bliwy=20numer=20mo=C5=BCe=20by?= =?UTF-8?q?=C4=87=20irytuj=C4=85cy=20wi=C4=99c=20wiele=20os=C3=B3b=20mo?= =?UTF-8?q?=C5=BCe=20uzna=C4=87=20to=20za=20u=C5=BCyteczne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pl/szczodrzynski/edziennik/config/ConfigSync.kt | 2 ++ .../edziennik/data/api/task/Notifications.kt | 1 + .../edziennik/ui/settings/cards/SettingsSyncCard.kt | 12 +++++++++--- app/src/main/res/values/strings.xml | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/config/ConfigSync.kt b/app/src/main/java/pl/szczodrzynski/edziennik/config/ConfigSync.kt index 6688838b..47643840 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/config/ConfigSync.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/config/ConfigSync.kt @@ -27,6 +27,8 @@ class ConfigSync(base: Config) { var quietHoursEnd by base.config(null) var quietDuringLessons by base.config(false) + var luckyNumberOnlyMe by base.config(false) + // FCM Tokens var tokenApp by base.config(null) var tokenMobidziennik by base.config(null) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt index bb4f0cb1..55226a7e 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/Notifications.kt @@ -321,6 +321,7 @@ class Notifications(val app: App, val notifications: MutableList, luckyNumbers.removeAll { it.date < today } luckyNumbers.forEach { luckyNumber -> val profile = profiles.singleOrNull { it.id == luckyNumber.profileId } ?: return@forEach + if(app.config.sync.luckyNumberOnlyMe && profile.studentNumber != luckyNumber.number) return@forEach val text = when (profile.studentNumber != -1 && profile.studentNumber == luckyNumber.number) { true -> when (luckyNumber.date.value) { todayValue -> R.string.notification_lucky_number_yours_format diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt index a8a68da1..fd7ba8d3 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt @@ -12,7 +12,6 @@ import android.os.Build.VERSION_CODES import android.provider.Settings import com.danielstone.materialaboutlibrary.model.MaterialAboutCard import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial -import pl.szczodrzynski.edziennik.MainActivity import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.ext.after import pl.szczodrzynski.edziennik.ext.getSyncInterval @@ -128,7 +127,15 @@ class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) { ) { NotificationFilterDialog(activity).show() }, - + util.createPropertyItem( + text = R.string.settings_lucky_number_only_me_text, + subText = R.string.settings_lucky_number_only_me_descryption, + icon = CommunityMaterial.Icon.cmd_bell_cancel, + value = configGlobal.sync.luckyNumberOnlyMe + ) { _, it -> + configGlobal.sync.luckyNumberOnlyMe = it + UpdateWorker.rescheduleNext(app) + }, util.createPropertyActionItem( text = R.string.settings_sync_quiet_hours_text, subText = R.string.settings_sync_quiet_hours_subtext_disabled, @@ -166,7 +173,6 @@ class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) { configGlobal.sync.notifyAboutUpdates = it UpdateWorker.rescheduleNext(app) }, - if (SDK_INT >= VERSION_CODES.KITKAT) util.createActionItem( text = R.string.settings_sync_notifications_settings_text, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e4204e21..cd346382 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1553,4 +1553,7 @@ Wszystkie lekcje: Wyświetl nazwę przedmiotu zamiast rodzaju Odśwież wybrany tydzień + Szczęśliwy Numerek tylko dla Ciebie + Wysyła powiadomienia o Szczęśliwym Numerku jedynie gdy Ty zostaniesz wybrany +