pachli-android/core/data/build.gradle.kts
Nik Clayton e8e84a1538
feat: Persist notification filtering decisions locally (#1196)
Persist the user's notification filtering decisions (i.e., the decision
to show a filtered notification) by caching all notification data,
including the filtering decision, in the database.

## Structure changes

This means re-writing the notification management system to use Room and
the Paging library to manage the notification data.

Implement a repository and remote mediator for notifications that does
this, with knock on effects for the viewmodel and the fragment. Take the
opportunity to rewrite these to reflect (current understanding of) best
practice for state management.

Active account information is included in the viewdata for each
notification when sent to the adapter. This allows the adapter to be
created before the fragment knows the active account from the view
model.

`RemoteKeyDao` is extended to support sorting the "refresh" key for
a timeline. This is used to persist the notifications refresh key
instead of the `lastNotificationId` property in the account (which has
been removed).

## UX changes

A linear progress bar is used to show progress when notifications are
refreshed, as part of the ongoing effort to migrate the UI.
2025-01-19 22:24:30 +01:00

61 lines
1.8 KiB
Plaintext

/*
* Copyright 2024 Pachli Association
*
* This file is a part of Pachli.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Pachli 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 Pachli; if not,
* see <http://www.gnu.org/licenses>.
*/
plugins {
alias(libs.plugins.pachli.android.library)
alias(libs.plugins.pachli.android.hilt)
alias(libs.plugins.kotlin.parcelize)
}
android {
namespace = "app.pachli.core.data"
defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
dependencies {
// TODO: AccountManager currently exposes AccountEntity which must be re-exported.
api(projects.core.database)
implementation(projects.core.common)
implementation(projects.core.eventhub)
?.because("NotificationRepository sends events")
implementation(projects.core.model)
implementation(projects.core.network)
implementation(projects.core.preferences)
// PreferenceDataStore
implementation(libs.bundles.androidx)
// ServerRepository
implementation(libs.semver)
implementation(libs.moshi)
?.because("Notifications serialise using JSON")
testImplementation(projects.core.networkTest)
testImplementation(libs.bundles.mockito)
testImplementation(libs.moshi)
testImplementation(libs.moshi.adapters)
ksp(libs.moshi.codegen)
testImplementation(projects.core.networkTest)
}