Add option to remove notifications captured from vulcan.hebe (#1716)

This commit is contained in:
Michael
2021-12-27 08:48:47 +01:00
committed by GitHub
parent 6520f8a0d7
commit bd883c9f38
6 changed files with 26 additions and 2 deletions

View File

@ -133,6 +133,12 @@ class PreferencesRepository @Inject constructor(
R.bool.pref_default_notification_piggyback
)
val isNotificationPiggybackRemoveOriginalEnabled: Boolean
get() = getBoolean(
R.string.pref_key_notifications_piggyback_cancel_original,
R.bool.pref_default_notification_piggyback_cancel_original
)
val isDebugNotificationEnableKey = context.getString(R.string.pref_key_notification_debug)
val isDebugNotificationEnable: Boolean
get() = getBoolean(isDebugNotificationEnableKey, R.bool.pref_default_notification_debug)

View File

@ -19,6 +19,9 @@ class VulcanNotificationListenerService : NotificationListenerService() {
override fun onNotificationPosted(statusBarNotification: StatusBarNotification?) {
if (statusBarNotification?.packageName == "pl.edu.vulcan.hebe" && preferenceRepository.isNotificationPiggybackEnabled) {
syncManager.startOneTimeSyncWorker()
if (preferenceRepository.isNotificationPiggybackRemoveOriginalEnabled) {
cancelNotification(statusBarNotification.key)
}
}
}
}