From ffc47f8368f4a040ab032a2aa9dbfe395a4af006 Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Tue, 1 May 2018 18:42:11 +0200 Subject: [PATCH] Further notification improvements Signed-off-by: Janne Koschinski <janne@kuschku.de> --- app/build.gradle.kts | 21 ++++- app/sampledata/libraries.json | 2 +- .../quasseldroid/dagger/SettingsModule.kt | 3 + .../service/QuasselNotificationBackend.kt | 94 ++++++++++++++----- .../quasseldroid/service/QuasselService.kt | 1 + .../settings/NotificationSettings.kt | 44 +++++++++ .../kuschku/quasseldroid/settings/Settings.kt | 23 +++++ .../ui/clientsettings/about/AboutFragment.kt | 2 +- .../util/QuasseldroidNotificationManager.kt | 2 +- .../res/values-de/strings_preferences.xml | 10 ++ .../main/res/values/strings_preferences.xml | 26 +++++ app/src/main/res/xml/preferences.xml | 22 +++++ build.gradle.kts | 21 ++++- lib/build.gradle.kts | 21 ++++- malheur/build.gradle.kts | 21 ++++- persistence/build.gradle.kts | 21 ++++- .../persistence/QuasselDatabase.kt | 6 ++ viewmodel/build.gradle.kts | 21 ++++- 18 files changed, 326 insertions(+), 35 deletions(-) create mode 100644 app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7766e5d8d..a6213a7e7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,6 +17,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* * Quasseldroid - Quassel client for Android * @@ -131,7 +150,7 @@ android { } dependencies { - implementation(kotlin("stdlib", "1.2.40")) + implementation(kotlin("stdlib", "1.2.41")) // App Compat withVersion("27.1.1") { diff --git a/app/sampledata/libraries.json b/app/sampledata/libraries.json index 81d668907..312203a3d 100644 --- a/app/sampledata/libraries.json +++ b/app/sampledata/libraries.json @@ -170,7 +170,7 @@ }, { "name": "Kotlin Standard Library", - "version": "1.2.40", + "version": "1.2.41", "license": { "short_name": "Apache-2.0", "full_name": "Apache License" diff --git a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt b/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt index 74caf21aa..661d5941c 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/dagger/SettingsModule.kt @@ -35,6 +35,9 @@ class SettingsModule { @Provides fun provideMessageSettings(context: Context) = Settings.message(context) + @Provides + fun provideNotificationSettings(context: Context) = Settings.notification(context) + @Provides fun provideAutoCompleteSettings(context: Context) = Settings.autoComplete(context) diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt index e0e7ad22b..7a7dcf937 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselNotificationBackend.kt @@ -33,6 +33,8 @@ import de.kuschku.quasseldroid.GlideApp import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.persistence.QuasselDatabase import de.kuschku.quasseldroid.settings.MessageSettings +import de.kuschku.quasseldroid.settings.NotificationSettings +import de.kuschku.quasseldroid.settings.Settings import de.kuschku.quasseldroid.util.AvatarHelper import de.kuschku.quasseldroid.util.NotificationMessage import de.kuschku.quasseldroid.util.QuasseldroidNotificationManager @@ -45,7 +47,6 @@ import javax.inject.Inject class QuasselNotificationBackend @Inject constructor( private val context: Context, private val database: QuasselDatabase, - private val messageSettings: MessageSettings, private val contentFormatter: ContentFormatter, private val notificationHandler: QuasseldroidNotificationManager ) : NotificationManager { @@ -56,43 +57,80 @@ class QuasselNotificationBackend @Inject constructor( R.color.senderColorC, R.color.senderColorD, R.color.senderColorE, R.color.senderColorF ).map(context::getColorCompat).toIntArray() + private lateinit var notificationSettings: NotificationSettings + + private lateinit var messageSettings: MessageSettings private val selfColor = context.getColorCompat(android.R.color.background_dark) + init { + updateSettings() + } + override fun init(session: Session) { val buffers = session.bufferSyncer.bufferInfos() for (buffer in buffers) { val lastSeenId = session.bufferSyncer.lastSeenMsg(buffer.bufferId) database.notifications().markRead(buffer.bufferId, lastSeenId) - if (buffer.type.hasFlag(Buffer_Type.QueryBuffer)) { - val activity = session.bufferSyncer.activity(buffer.bufferId) - if (activity.hasFlag(Message_Type.Plain) || - activity.hasFlag(Message_Type.Action) || - activity.hasFlag(Message_Type.Notice)) - session.backlogManager.requestBacklogFiltered( - buffer.bufferId, lastSeenId, -1, 20, 0, - Message_Type.of(Message_Type.Plain, Message_Type.Action, Message_Type.Notice).toInt(), - 0 - ) - } else { - val highlightCount = session.bufferSyncer.highlightCount(buffer.bufferId) - if (highlightCount != 0) { - session.backlogManager.requestBacklogFiltered( - buffer.bufferId, lastSeenId, -1, 20, 0, - Message_Type.of(Message_Type.Plain, Message_Type.Action, Message_Type.Notice).toInt(), - Message_Flag.of(Message_Flag.Highlight).toInt() - ) + val level = buffer.type.let { + when { + it hasFlag Buffer_Type.QueryBuffer -> notificationSettings.query + it hasFlag Buffer_Type.ChannelBuffer -> notificationSettings.channel + else -> notificationSettings.other + } + } + + when (level) { + NotificationSettings.Level.ALL -> { + val activity = session.bufferSyncer.activity(buffer.bufferId) + if (activity.hasFlag(Message_Type.Plain) || + activity.hasFlag(Message_Type.Action) || + activity.hasFlag(Message_Type.Notice)) + session.backlogManager.requestBacklogFiltered( + buffer.bufferId, lastSeenId, -1, 20, 0, + Message_Type.of(Message_Type.Plain, Message_Type.Action, Message_Type.Notice).toInt(), + 0 + ) + } + NotificationSettings.Level.HIGHLIGHT -> { + val highlightCount = session.bufferSyncer.highlightCount(buffer.bufferId) + if (highlightCount != 0) { + session.backlogManager.requestBacklogFiltered( + buffer.bufferId, lastSeenId, -1, 20, 0, + Message_Type.of(Message_Type.Plain, Message_Type.Action, Message_Type.Notice).toInt(), + Message_Flag.of(Message_Flag.Highlight).toInt() + ) + } + } + NotificationSettings.Level.NONE -> { + // We don’t want notifications for this type of channel, so we won’t get any. } } } } + fun updateSettings() { + notificationSettings = Settings.notification(context) + messageSettings = Settings.message(context) + } + @Synchronized override fun processMessages(session: Session, vararg messages: Message) { val results = messages.filter { - it.flag.hasFlag(Message_Flag.Highlight) || - it.bufferInfo.type.hasFlag(Buffer_Type.QueryBuffer) + val level = it.bufferInfo.type.let { + when { + it hasFlag Buffer_Type.QueryBuffer -> notificationSettings.query + it hasFlag Buffer_Type.ChannelBuffer -> notificationSettings.channel + else -> notificationSettings.other + } + } + + when (level) { + NotificationSettings.Level.ALL -> true + NotificationSettings.Level.HIGHLIGHT -> it.flag.hasFlag(Message_Flag.Highlight) + NotificationSettings.Level.NONE -> false + } }.filter { val bufferName = it.bufferInfo.bufferName ?: "" val networkId = it.bufferInfo.networkId @@ -173,11 +211,15 @@ class QuasselNotificationBackend @Inject constructor( val size = context.resources.getDimensionPixelSize(R.dimen.notification_avatar_width) val avatarList = AvatarHelper.avatar(messageSettings, it) - val avatarResult = GlideApp.with(context).loadWithFallbacks(avatarList) - ?.optionalCircleCrop() - ?.placeholder(TextDrawable.builder().buildRound(initial, senderColor)) - ?.submit(size, size) - ?.get() + val avatarResult = try { + GlideApp.with(context).loadWithFallbacks(avatarList) + ?.optionalCircleCrop() + ?.placeholder(TextDrawable.builder().buildRound(initial, senderColor)) + ?.submit(size, size) + ?.get() + } catch (_: Throwable) { + null + } val avatar = avatarResult ?: TextDrawable.builder().buildRound(initial, senderColor) NotificationMessage( diff --git a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt index ded101d70..afac73fae 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/service/QuasselService.kt @@ -70,6 +70,7 @@ class QuasselService : DaggerLifecycleService(), override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { update() + notificationBackend.updateSettings() } private fun update() { diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt new file mode 100644 index 000000000..83329df1c --- /dev/null +++ b/app/src/main/java/de/kuschku/quasseldroid/settings/NotificationSettings.kt @@ -0,0 +1,44 @@ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 Ken Børge Viktil + * Copyright (c) 2018 Magnus Fjell + * Copyright (c) 2018 Martin Sandsmark + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package de.kuschku.quasseldroid.settings + +data class NotificationSettings( + val query: Level = Level.ALL, + val channel: Level = Level.HIGHLIGHT, + val other: Level = Level.NONE +) { + enum class Level { + ALL, + HIGHLIGHT, + NONE; + + companion object { + private val map = values().associateBy { it.name } + fun of(name: String) = map[name] + } + } + + companion object { + val DEFAULT = NotificationSettings() + } +} diff --git a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt index 5196c970d..b66503e7a 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/settings/Settings.kt @@ -123,6 +123,29 @@ object Settings { ) } + fun notification(context: Context) = context.sharedPreferences { + NotificationSettings( + query = NotificationSettings.Level.of( + getString( + context.getString(R.string.preference_notification_query_key), + "" + ) + ) ?: NotificationSettings.DEFAULT.query, + channel = NotificationSettings.Level.of( + getString( + context.getString(R.string.preference_notification_channel_key), + "" + ) + ) ?: NotificationSettings.DEFAULT.channel, + other = NotificationSettings.Level.of( + getString( + context.getString(R.string.preference_notification_other_key), + "" + ) + ) ?: NotificationSettings.DEFAULT.other + ) + } + fun autoComplete(context: Context) = context.sharedPreferences { AutoCompleteSettings( senderDoubleClick = getBoolean( diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt index e5e8d6cf8..a291be6eb 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/clientsettings/about/AboutFragment.kt @@ -218,7 +218,7 @@ class AboutFragment : DaggerFragment() { ), Library( name = "Kotlin Standard Library", - version = "1.2.40", + version = "1.2.41", license = apache2, url = "https://kotlinlang.org/" ), diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt b/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt index 97825ab1f..aae8f6baa 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/util/QuasseldroidNotificationManager.kt @@ -60,7 +60,7 @@ class QuasseldroidNotificationManager @Inject constructor(private val context: C NotificationChannel( context.getString(R.string.notification_channel_background), context.getString(R.string.notification_channel_connection_title), - NotificationManager.IMPORTANCE_MIN + NotificationManager.IMPORTANCE_LOW ), NotificationChannel( context.getString(R.string.notification_channel_highlight), diff --git a/app/src/main/res/values-de/strings_preferences.xml b/app/src/main/res/values-de/strings_preferences.xml index 889e89986..91a1876c8 100644 --- a/app/src/main/res/values-de/strings_preferences.xml +++ b/app/src/main/res/values-de/strings_preferences.xml @@ -43,6 +43,16 @@ <string name="preference_show_lag_summary">Zeigt die Gerät-Core-Latenz in der Statusleiste</string> + <string name="preference_notifications_title">Benachrichtigungen</string> + + <string name="preference_notification_query_title">Direktnachrichten</string> + <string name="preference_notification_channel_title">Räume</string> + <string name="preference_notification_other_title">Andere Nachrichten</string> + <string name="preference_notifications_level_all">Alle Nachrichten</string> + <string name="preference_notifications_level_highlight">Erwähnungen</string> + <string name="preference_notifications_level_none">Niemals</string> + + <string name="preference_messages_title">Nachrichten</string> <string name="preference_monospace_title">Monospace-Schrift verwenden</string> diff --git a/app/src/main/res/values/strings_preferences.xml b/app/src/main/res/values/strings_preferences.xml index b22097270..d59aa3e8f 100644 --- a/app/src/main/res/values/strings_preferences.xml +++ b/app/src/main/res/values/strings_preferences.xml @@ -78,6 +78,32 @@ <string name="preference_show_lag_summary">Displays the lag between client and core in the action bar</string> + <string name="preference_notifications_title">Notifications</string> + + <string name="preference_notification_query_key" translatable="false">notification_query</string> + <string name="preference_notification_query_title">Direct Messages</string> + + <string name="preference_notification_channel_key" translatable="false">notification_channel</string> + <string name="preference_notification_channel_title">Channel Messages</string> + + <string name="preference_notification_other_key" translatable="false">notification_other</string> + <string name="preference_notification_other_title">Other Messages</string> + + <string name="preference_notifications_level_all">All Messages</string> + <string name="preference_notifications_level_highlight">Mentions</string> + <string name="preference_notifications_level_none">Never</string> + <string-array name="preference_notifications_level_entries"> + <item>@string/preference_notifications_level_all</item> + <item>@string/preference_notifications_level_highlight</item> + <item>@string/preference_notifications_level_none</item> + </string-array> + <string-array name="preference_notifications_level_entryvalues" translatable="false"> + <item>ALL</item> + <item>HIGHLIGHT</item> + <item>NONE</item> + </string-array> + + <string name="preference_messages_title">Messages</string> <string name="preference_monospace_key" translatable="false">monospace</string> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 92d3b93a6..d47e15237 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -44,6 +44,28 @@ android:title="@string/preference_show_lag_title" /> </PreferenceCategory> + <PreferenceCategory android:title="@string/preference_notifications_title"> + <DropDownPreference + android:defaultValue="ALL" + android:entries="@array/preference_notifications_level_entries" + android:entryValues="@array/preference_notifications_level_entryvalues" + android:key="@string/preference_notification_query_key" + android:title="@string/preference_notification_query_title" /> + <DropDownPreference + android:defaultValue="HIGHLIGHT" + android:entries="@array/preference_notifications_level_entries" + android:entryValues="@array/preference_notifications_level_entryvalues" + android:key="@string/preference_notification_channel_key" + android:title="@string/preference_notification_channel_title" /> + <DropDownPreference + android:defaultValue="NONE" + android:entries="@array/preference_notifications_level_entries" + android:entryValues="@array/preference_notifications_level_entryvalues" + android:key="@string/preference_notification_other_key" + android:title="@string/preference_notification_other_title" /> + <!-- TODO: Add Notification ringtone/etc setting links --> + </PreferenceCategory> + <PreferenceCategory android:title="@string/preference_messages_title"> <SwitchPreference diff --git a/build.gradle.kts b/build.gradle.kts index 82f81e70d..11145919d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,22 @@ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + buildscript { repositories { google() @@ -5,7 +24,7 @@ buildscript { } dependencies { classpath("com.android.tools.build:gradle:3.1.2") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.41") } } diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index adcbfa55b..e5afee061 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -17,6 +17,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* * Quasseldroid - Quassel client for Android * @@ -51,7 +70,7 @@ plugins { } dependencies { - implementation(kotlin("stdlib", "1.2.40")) + implementation(kotlin("stdlib", "1.2.41")) withVersion("27.1.1") { implementation("com.android.support", "support-annotations", version) diff --git a/malheur/build.gradle.kts b/malheur/build.gradle.kts index 8afb5cc04..92d078e95 100644 --- a/malheur/build.gradle.kts +++ b/malheur/build.gradle.kts @@ -17,6 +17,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* * Quasseldroid - Quassel client for Android * @@ -68,7 +87,7 @@ android { } dependencies { - implementation(kotlin("stdlib", "1.2.40")) + implementation(kotlin("stdlib", "1.2.41")) implementation("com.google.code.gson", "gson", "2.8.2") } diff --git a/persistence/build.gradle.kts b/persistence/build.gradle.kts index 09d7c058a..039b8c6e5 100644 --- a/persistence/build.gradle.kts +++ b/persistence/build.gradle.kts @@ -17,6 +17,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* * Quasseldroid - Quassel client for Android * @@ -74,7 +93,7 @@ android { } dependencies { - implementation(kotlin("stdlib", "1.2.40")) + implementation(kotlin("stdlib", "1.2.41")) // App Compat withVersion("27.1.1") { diff --git a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt index bc7a596e9..e8563824d 100644 --- a/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt +++ b/persistence/src/main/java/de/kuschku/quasseldroid/persistence/QuasselDatabase.kt @@ -246,12 +246,18 @@ abstract class QuasselDatabase : RoomDatabase() { @Insert(onConflict = OnConflictStrategy.REPLACE) fun save(vararg entities: NotificationData) + @Query("SELECT * FROM notification ORDER BY time ASC") + fun all(): List<NotificationData> + @Query("SELECT * FROM notification WHERE bufferId = :bufferId ORDER BY time ASC") fun all(bufferId: BufferId): List<NotificationData> @Query("DELETE FROM notification WHERE bufferId = :bufferId AND messageId <= :messageId") fun markRead(bufferId: BufferId, messageId: MsgId) + @Query("DELETE FROM notification WHERE bufferId = :bufferId AND flag & 2 = 0") + fun markReadNormal(bufferId: BufferId) + @Query("DELETE FROM notification") fun clear() } diff --git a/viewmodel/build.gradle.kts b/viewmodel/build.gradle.kts index 7bb314e41..026e5d4a3 100644 --- a/viewmodel/build.gradle.kts +++ b/viewmodel/build.gradle.kts @@ -17,6 +17,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* + * Quasseldroid - Quassel client for Android + * + * Copyright (c) 2018 Janne Koschinski + * Copyright (c) 2018 The Quassel Project + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + /* * Quasseldroid - Quassel client for Android * @@ -68,7 +87,7 @@ android { } dependencies { - implementation(kotlin("stdlib", "1.2.40")) + implementation(kotlin("stdlib", "1.2.41")) // App Compat withVersion("27.1.1") { -- GitLab