mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 13:28:21 +01:00
Add option to remove notifications captured from vulcan.hebe (#1716)
This commit is contained in:
parent
6520f8a0d7
commit
bd883c9f38
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@
|
||||
<bool name="pref_default_optional_arithmetic_average">false</bool>
|
||||
<string name="pref_default_last_sync_date">0</string>
|
||||
<bool name="pref_default_notification_piggyback">false</bool>
|
||||
<bool name="pref_default_notification_piggyback_cancel_original">false</bool>
|
||||
<string-array name="pref_default_dashboard_tiles">
|
||||
<item>LUCKY_NUMBER</item>
|
||||
<item>MESSAGES</item>
|
||||
|
@ -35,5 +35,6 @@
|
||||
<string name="pref_key_message_send_draft">message_send_recipients</string>
|
||||
<string name="pref_key_last_sync_date">last_sync_date</string>
|
||||
<string name="pref_key_notifications_piggyback">notifications_piggyback</string>
|
||||
<string name="pref_key_notifications_piggyback_cancel_original">notifications_piggyback_cancel_original</string>
|
||||
<string name="pref_key_ads_single_support">single_ad_support</string>
|
||||
</resources>
|
||||
|
@ -672,7 +672,9 @@
|
||||
<string name="pref_notify_fix_sync_issues_message">Your device may have data synchronization issues and with notifications.\n\nTo fix them, you need to add Wulkanowy to the autostart and turn off battery optimization/saving in the phone settings.</string>
|
||||
<string name="pref_notify_debug_switch">Show debug notifications</string>
|
||||
<string name="pref_notify_disabled_summary">Synchronization is disabled</string>
|
||||
<string name="pref_notify_notifications_piggyback_header">Official app notifications</string>
|
||||
<string name="pref_notify_notifications_piggyback">Capture official app notifications</string>
|
||||
<string name="pref_notify_notifications_piggyback_cancel_original">Remove official app notifications after capture</string>
|
||||
<string name="pref_notification_piggyback_popup_title">Capture notifications</string>
|
||||
<string name="pref_notification_piggyback_popup_description">With this feature you can gain a substitute of push notifications like in the official app. All you need to do is allow Wulkanowy to receive all notifications in your system settings.\n\nHow it works?\nWhen you get a notification in Dziennik VULCAN, Wulkanowy will be notified (that\'s what these extra permissions are for) and will trigger a sync so that can send its own notification.\n\nFOR ADVANCED USERS ONLY</string>
|
||||
<string name="pref_notification_exact_alarm_popup_title">Upcoming lesson notifications</string>
|
||||
|
@ -16,9 +16,9 @@
|
||||
app:title="@string/pref_notify_upcoming_lessons_switch" />
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_notification_upcoming_lessons_persistent"
|
||||
app:dependency="@string/pref_key_notifications_upcoming_lessons_enable"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_notifications_upcoming_lessons_persistent"
|
||||
app:dependency="@string/pref_key_notifications_upcoming_lessons_enable"
|
||||
app:singleLineTitle="false"
|
||||
app:summary="@string/pref_notify_upcoming_lessons_persistent_summary"
|
||||
app:title="@string/pref_notify_upcoming_lessons_persistent_switch" />
|
||||
@ -31,13 +31,24 @@
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/pref_notify_header_other">
|
||||
app:title="@string/pref_notify_notifications_piggyback_header">
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_notification_piggyback"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_notifications_piggyback"
|
||||
app:singleLineTitle="false"
|
||||
app:title="@string/pref_notify_notifications_piggyback" />
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="@bool/pref_default_notification_piggyback_cancel_original"
|
||||
app:dependency="@string/pref_key_notifications_piggyback"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_notifications_piggyback_cancel_original"
|
||||
app:singleLineTitle="false"
|
||||
app:title="@string/pref_notify_notifications_piggyback_cancel_original" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
app:iconSpaceReserved="false"
|
||||
app:title="@string/pref_notify_header_other">
|
||||
<Preference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/pref_key_notifications_system_settings"
|
||||
|
Loading…
x
Reference in New Issue
Block a user