Option to disable nsfw updates notifications
This commit is contained in:
@@ -155,6 +155,9 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
|
||||
val isTrackerNotificationsEnabled: Boolean
|
||||
get() = prefs.getBoolean(KEY_TRACKER_NOTIFICATIONS, true)
|
||||
|
||||
val isTrackerNsfwDisabled: Boolean
|
||||
get() = prefs.getBoolean(KEY_TRACKER_NO_NSFW, false)
|
||||
|
||||
var notificationSound: Uri
|
||||
get() = prefs.getString(KEY_NOTIFICATIONS_SOUND, null)?.toUriOrNull()
|
||||
?: Settings.System.DEFAULT_NOTIFICATION_URI
|
||||
@@ -587,6 +590,7 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
|
||||
const val KEY_TRACK_CATEGORIES = "track_categories"
|
||||
const val KEY_TRACK_WARNING = "track_warning"
|
||||
const val KEY_TRACKER_NOTIFICATIONS = "tracker_notifications"
|
||||
const val KEY_TRACKER_NO_NSFW = "tracker_no_nsfw"
|
||||
const val KEY_NOTIFICATIONS_SETTINGS = "notifications_settings"
|
||||
const val KEY_NOTIFICATIONS_SOUND = "notifications_sound"
|
||||
const val KEY_NOTIFICATIONS_VIBRATE = "notifications_vibrate"
|
||||
|
||||
@@ -49,6 +49,9 @@ class TrackerNotificationHelper @Inject constructor(
|
||||
if (newChapters.isEmpty() || !applicationContext.checkNotificationPermission(CHANNEL_ID)) {
|
||||
return null
|
||||
}
|
||||
if (manga.isNsfw && settings.isTrackerNsfwDisabled) {
|
||||
return null
|
||||
}
|
||||
val id = manga.url.hashCode()
|
||||
val builder = NotificationCompat.Builder(applicationContext, CHANNEL_ID)
|
||||
val summary = applicationContext.resources.getQuantityString(
|
||||
|
||||
@@ -646,4 +646,6 @@
|
||||
<string name="disable_connectivity_check">Disable connectivity check</string>
|
||||
<string name="ignore_ssl_errors_summary">You can disable SSL certificates verification in case you face an SSL-related issues when accessing network resources. This may affect your security. Application restarting is required after changing this setting.</string>
|
||||
<string name="disable_connectivity_check_summary">Skip the connectivity check in case you have issues with it (e.g. going offline mode even though the network is connected)</string>
|
||||
<string name="disable_nsfw_notifications">Disable NSFW notifications</string>
|
||||
<string name="disable_nsfw_notifications_summary">Do not show notifications about NSFW manga updates</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
@@ -44,6 +45,13 @@
|
||||
android:key="notifications_settings"
|
||||
android:title="@string/notifications_settings" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="tracker_enabled"
|
||||
android:key="tracker_no_nsfw"
|
||||
android:summary="@string/disable_nsfw_notifications_summary"
|
||||
android:title="@string/disable_nsfw_notifications" />
|
||||
|
||||
<Preference
|
||||
android:dependency="tracker_enabled"
|
||||
android:key="ignore_dose"
|
||||
@@ -51,7 +59,8 @@
|
||||
android:summary="@string/disable_battery_optimization_summary"
|
||||
android:title="@string/disable_battery_optimization"
|
||||
app:allowDividerAbove="true"
|
||||
app:isPreferenceVisible="false" />
|
||||
app:isPreferenceVisible="false"
|
||||
tools:isPrefrenceVisible="true" />
|
||||
|
||||
<org.koitharu.kotatsu.settings.utils.LinksPreference
|
||||
android:icon="@drawable/ic_info_outline"
|
||||
|
||||
Reference in New Issue
Block a user