forked from github/wulkanowy-mirror
Add option to remove notifications captured from vulcan.hebe (#1716)
This commit is contained in:
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user