Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dodaj opcję wyłączenia powiadomień o nie swoim szczęśliwym numerku #192

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class ConfigSync(base: Config) {
var quietHoursEnd by base.config<Time?>(null)
var quietDuringLessons by base.config<Boolean>(false)

var luckyNumberOnlyMe by base.config<Boolean>(false)

// FCM Tokens
var tokenApp by base.config<String?>(null)
var tokenMobidziennik by base.config<String?>(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class Notifications(val app: App, val notifications: MutableList<Notification>,
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1553,4 +1553,7 @@
<string name="home_timetable_all_lessons">Wszystkie lekcje:</string>
<string name="agenda_config_subject_important">Wyświetl nazwę przedmiotu zamiast rodzaju</string>
<string name="menu_timetable_sync">Odśwież wybrany tydzień</string>
<string name="settings_lucky_number_only_me_text">Szczęśliwy Numerek tylko dla Ciebie</string>
<string name="settings_lucky_number_only_me_descryption">Wysyła powiadomienia o Szczęśliwym Numerku jedynie gdy Ty zostaniesz wybrany</string>

</resources>