2023-02-04 19:58:53 +01:00
|
|
|
plugins {
|
|
|
|
alias(libs.plugins.android.application)
|
2023-06-29 18:37:46 +02:00
|
|
|
alias(libs.plugins.google.ksp)
|
2023-02-04 19:58:53 +01:00
|
|
|
alias(libs.plugins.kotlin.android)
|
|
|
|
alias(libs.plugins.kotlin.parcelize)
|
2023-09-01 20:33:23 +02:00
|
|
|
alias(libs.plugins.aboutlibraries)
|
2023-10-07 19:30:11 +02:00
|
|
|
alias(libs.plugins.hilt)
|
2023-10-25 18:39:31 +02:00
|
|
|
alias(libs.plugins.room)
|
2023-10-03 12:56:30 +02:00
|
|
|
|
|
|
|
id "app.pachli.plugins.markdown2resource"
|
2018-07-16 19:01:34 +02:00
|
|
|
}
|
|
|
|
|
2023-09-28 13:50:02 +02:00
|
|
|
apply from: 'gitTools.gradle'
|
2023-02-10 21:22:32 +01:00
|
|
|
|
2023-02-16 20:20:52 +01:00
|
|
|
final def gitSha = ext.getGitSha()
|
2023-09-28 13:50:02 +02:00
|
|
|
final def gitRevCount = ext.getGitRevCount()
|
2023-02-04 19:58:53 +01:00
|
|
|
|
|
|
|
// The app name
|
2023-09-05 13:28:56 +02:00
|
|
|
final def APP_NAME = "Pachli"
|
2023-02-04 19:58:53 +01:00
|
|
|
// The application id. Must be unique, e.g. based on your domain
|
2023-09-05 13:28:56 +02:00
|
|
|
final def APP_ID = "app.pachli"
|
|
|
|
// url of a custom app logo. Recommended size at least 600x600. Keep empty to use the default logo.
|
2023-02-04 19:58:53 +01:00
|
|
|
final def CUSTOM_LOGO_URL = ""
|
|
|
|
// e.g. mastodon.social. Keep empty to not suggest any instance on the signup screen
|
|
|
|
final def CUSTOM_INSTANCE = ""
|
|
|
|
// link to your support account. Will be linked on the about page when not empty.
|
2023-09-05 13:28:56 +02:00
|
|
|
final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Pachli"
|
2023-02-04 19:58:53 +01:00
|
|
|
|
2017-01-03 00:30:27 +01:00
|
|
|
android {
|
2023-10-11 12:28:45 +02:00
|
|
|
compileSdk 34
|
2023-09-05 13:28:56 +02:00
|
|
|
namespace "app.pachli"
|
2017-01-03 00:30:27 +01:00
|
|
|
defaultConfig {
|
2019-10-29 20:30:46 +01:00
|
|
|
applicationId APP_ID
|
2023-09-05 13:28:56 +02:00
|
|
|
namespace "app.pachli"
|
2023-02-04 19:58:53 +01:00
|
|
|
minSdk 23
|
2023-10-11 12:28:45 +02:00
|
|
|
targetSdk 34
|
2023-11-10 13:55:32 +01:00
|
|
|
versionCode 7
|
|
|
|
versionName "1.4.0"
|
2018-12-17 15:25:35 +01:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
2018-09-25 19:04:57 +02:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2018-12-25 20:06:28 +01:00
|
|
|
|
2019-10-29 20:30:46 +01:00
|
|
|
resValue "string", "app_name", APP_NAME
|
|
|
|
|
|
|
|
buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
|
|
|
|
buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
|
|
|
|
buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
|
2017-01-03 00:30:27 +01:00
|
|
|
}
|
|
|
|
buildTypes {
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
debug {
|
|
|
|
getIsDefault().set(true)
|
|
|
|
}
|
|
|
|
|
2017-01-03 00:30:27 +01:00
|
|
|
release {
|
2017-04-08 00:08:51 +02:00
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
2018-08-15 20:46:37 +02:00
|
|
|
proguardFiles 'proguard-rules.pro'
|
2017-01-03 00:30:27 +01:00
|
|
|
}
|
2018-07-16 19:01:34 +02:00
|
|
|
}
|
|
|
|
|
2023-02-04 19:58:53 +01:00
|
|
|
flavorDimensions += "color"
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
flavorDimensions += "store"
|
|
|
|
|
2018-07-16 19:01:34 +02:00
|
|
|
productFlavors {
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
blue {
|
|
|
|
dimension "color"
|
|
|
|
}
|
|
|
|
|
2023-09-05 13:28:56 +02:00
|
|
|
orange {
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
dimension "color"
|
2023-09-05 13:28:56 +02:00
|
|
|
resValue "string", "app_name", APP_NAME + " Current"
|
|
|
|
applicationIdSuffix ".current"
|
2023-09-28 13:50:02 +02:00
|
|
|
versionNameSuffix "+" + gitSha
|
2017-12-08 12:15:46 +01:00
|
|
|
}
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
|
|
|
|
fdroid {
|
|
|
|
dimension "store"
|
|
|
|
}
|
|
|
|
|
|
|
|
github {
|
|
|
|
dimension "store"
|
|
|
|
}
|
|
|
|
|
|
|
|
google {
|
|
|
|
dimension "store"
|
|
|
|
}
|
2017-01-03 00:30:27 +01:00
|
|
|
}
|
2017-10-25 21:56:27 +02:00
|
|
|
|
2023-02-04 19:58:53 +01:00
|
|
|
lint {
|
2023-03-13 10:23:42 +01:00
|
|
|
lintConfig file("lint.xml")
|
2023-10-30 19:03:45 +01:00
|
|
|
// Regenerate by running `./gradlew updateLintBaselineOrangeDebug`
|
2023-03-13 10:23:42 +01:00
|
|
|
baseline = file("lint-baseline.xml")
|
2017-04-13 06:01:02 +02:00
|
|
|
}
|
2023-03-13 10:23:42 +01:00
|
|
|
|
2021-01-21 18:57:09 +01:00
|
|
|
buildFeatures {
|
2023-02-04 19:58:53 +01:00
|
|
|
buildConfig true
|
|
|
|
resValues true
|
2021-01-21 18:57:09 +01:00
|
|
|
viewBinding true
|
|
|
|
}
|
2018-03-09 22:02:32 +01:00
|
|
|
testOptions {
|
|
|
|
unitTests {
|
2019-09-22 08:18:44 +02:00
|
|
|
returnDefaultValues = true
|
2018-03-09 22:02:32 +01:00
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
2023-01-12 19:10:11 +01:00
|
|
|
unitTests.all {
|
|
|
|
systemProperty 'robolectric.logging.enabled', 'true'
|
2023-02-28 21:28:05 +01:00
|
|
|
systemProperty 'robolectric.lazyload', 'ON'
|
2023-02-04 19:58:53 +01:00
|
|
|
}
|
2018-03-09 22:02:32 +01:00
|
|
|
}
|
2018-12-25 20:06:28 +01:00
|
|
|
sourceSets {
|
|
|
|
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
|
|
|
|
}
|
|
|
|
|
2023-02-04 19:58:53 +01:00
|
|
|
// Exclude unneeded files added by libraries
|
|
|
|
packagingOptions.resources.excludes += [
|
|
|
|
'LICENSE_OFL',
|
|
|
|
'LICENSE_UNICODE',
|
|
|
|
]
|
|
|
|
|
2019-03-29 19:56:53 +01:00
|
|
|
bundle {
|
|
|
|
language {
|
|
|
|
// bundle all languages in every apk so the dynamic language switching works
|
|
|
|
enableSplit = false
|
|
|
|
}
|
|
|
|
}
|
2023-09-27 18:06:14 +02:00
|
|
|
|
2022-12-05 19:13:15 +01:00
|
|
|
dependenciesInfo {
|
|
|
|
includeInApk false
|
|
|
|
includeInBundle false
|
|
|
|
}
|
2023-09-27 18:06:14 +02:00
|
|
|
|
2023-02-04 19:58:53 +01:00
|
|
|
applicationVariants.configureEach { variant ->
|
2023-09-28 13:50:02 +02:00
|
|
|
tasks.register("printVersionInfo${variant.name.capitalize()}") {
|
|
|
|
notCompatibleWithConfigurationCache("Should always print the version info")
|
|
|
|
println variant.versionCode + " " + variant.versionName
|
|
|
|
}
|
2023-02-04 19:58:53 +01:00
|
|
|
variant.outputs.configureEach {
|
2023-09-28 13:50:02 +02:00
|
|
|
// Set the "orange" release versionCode to the number of commits on the
|
|
|
|
// branch, to ensure the versionCode updates on every release.
|
2023-11-08 09:59:13 +01:00
|
|
|
if (variant.buildType.name == "release" && variant.flavorName.startsWith("orange")) {
|
2023-09-28 13:50:02 +02:00
|
|
|
versionCodeOverride = gitRevCount
|
|
|
|
}
|
2023-09-05 13:28:56 +02:00
|
|
|
outputFileName = "Pachli_${variant.versionName}_${variant.versionCode}_${gitSha}_" +
|
2023-02-04 19:58:53 +01:00
|
|
|
"${variant.flavorName}_${buildType.name}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-25 18:39:31 +02:00
|
|
|
room {
|
|
|
|
schemaDirectory("$projectDir/schemas/")
|
|
|
|
}
|
|
|
|
|
2023-06-29 18:37:46 +02:00
|
|
|
ksp {
|
|
|
|
arg("room.incremental", "true")
|
2023-10-25 18:39:31 +02:00
|
|
|
arg("room.generateKotlin", "true")
|
2019-05-18 08:06:30 +02:00
|
|
|
}
|
|
|
|
|
2023-03-13 10:18:41 +01:00
|
|
|
configurations {
|
|
|
|
// JNI-only libraries don't play nicely with Robolectric
|
|
|
|
// see https://github.com/tuskyapp/Tusky/pull/3367
|
|
|
|
testImplementation.exclude group: "org.conscrypt", module: "conscrypt-android"
|
|
|
|
testRuntime.exclude group: "org.conscrypt", module: "conscrypt-android"
|
|
|
|
}
|
|
|
|
|
2023-09-01 20:33:23 +02:00
|
|
|
aboutLibraries {
|
|
|
|
configPath = "licenses"
|
|
|
|
includePlatform = false
|
|
|
|
duplicationMode = com.mikepenz.aboutlibraries.plugin.DuplicateMode.MERGE
|
|
|
|
prettyPrint = true
|
|
|
|
}
|
|
|
|
|
2023-10-03 12:56:30 +02:00
|
|
|
markdown2resource {
|
|
|
|
files = [ layout.projectDirectory.file('../PRIVACY.md') ]
|
|
|
|
}
|
|
|
|
|
2022-11-04 20:10:26 +01:00
|
|
|
// library versions are in PROJECT_ROOT/gradle/libs.versions.toml
|
2017-01-03 00:30:27 +01:00
|
|
|
dependencies {
|
2022-11-04 20:10:26 +01:00
|
|
|
implementation libs.kotlinx.coroutines.android
|
|
|
|
implementation libs.kotlinx.coroutines.rx3
|
|
|
|
|
|
|
|
implementation libs.bundles.androidx
|
|
|
|
implementation libs.bundles.room
|
2023-06-29 18:37:46 +02:00
|
|
|
ksp libs.androidx.room.compiler
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.android.material
|
|
|
|
|
|
|
|
implementation libs.gson
|
|
|
|
|
|
|
|
implementation libs.bundles.retrofit
|
|
|
|
implementation libs.networkresult.calladapter
|
|
|
|
|
|
|
|
implementation libs.bundles.okhttp
|
|
|
|
|
|
|
|
implementation libs.conscrypt.android
|
|
|
|
|
|
|
|
implementation libs.bundles.glide
|
2023-07-11 15:34:14 +02:00
|
|
|
ksp libs.glide.compiler
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.bundles.rxjava3
|
|
|
|
|
|
|
|
implementation libs.bundles.autodispose
|
|
|
|
|
2023-10-07 19:30:11 +02:00
|
|
|
implementation libs.hilt.android
|
2023-10-18 15:02:17 +02:00
|
|
|
ksp libs.hilt.compiler
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.sparkbutton
|
|
|
|
|
Fix image zoom / pan / scroll / swipe (#3894)
Migrate to touchimageview from photoview, and adjust the touch logic to correctly handle single finger drag, two finger pinch/stretch, flings, taps, and swipes.
As before, the features are:
- Single tap, show/hide controls and media description
- Double tap, zoom in/out
- Single finger drag up/down, scale/translate image, dismiss if scrolled too far
- Single finger drag left/right
- When not zoomed, swipe to next image if multiple images present
- When zoomed, scroll to edge of image, then to next image if multiple images present
- Two finger pinch/zoom, zoom in/out on the image
Behaviour differences to previous code
1. Bug fix: The image can't get "stuck" when zoomed, and impossible to scroll
2. Bug fix: Pinching is not mis-interpreted as a fling, closing the image
3. Bug fix: The zoom state of images is not lost or misinterpreted when the user swipes through multiple images
4. Bug fix: Double-tap zooms all the way, instead of stopping
5. Tapping outside the image does not dismiss it, controls and description show/hide
Fixes https://github.com/tuskyapp/Tusky/issues/3562, https://github.com/tuskyapp/Tusky/issues/2297
2023-07-31 12:44:01 +02:00
|
|
|
implementation libs.touchimageview
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.bundles.material.drawer
|
2023-02-04 19:58:53 +01:00
|
|
|
implementation libs.material.typeface
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.image.cropper
|
|
|
|
|
|
|
|
implementation libs.bundles.filemojicompat
|
|
|
|
|
|
|
|
implementation libs.bouncycastle
|
|
|
|
implementation libs.unified.push
|
|
|
|
|
2023-03-10 20:30:55 +01:00
|
|
|
implementation libs.bundles.xmldiff
|
2023-09-05 13:28:56 +02:00
|
|
|
|
2023-09-01 20:33:23 +02:00
|
|
|
implementation libs.bundles.aboutlibraries
|
2023-11-04 22:22:44 +01:00
|
|
|
implementation libs.timber
|
2023-03-10 20:30:55 +01:00
|
|
|
|
feat: Periodically check for updates and alert user (#236)
Users can inadvertently get stuck on older versions of the app; e.g., by
installing from one F-Droid repository that stops hosting the app at
some later time.
Analytics from the Play Store also shows a long tail of users who are,
for some reason, on an older version.
On resuming `MainActivity`, and approximately once per day, check and
see if a newer version of Pachli is available, and prompt the user to
update by going to the relevant install location (Google Play, F-Droid,
or GitHub).
The dialog prompt allows them to ignore this specific version, or
disable all future update notifications. This is also exposed through
the preferences, so the user can adjust it there too.
A different update check method is used for each installation location.
- F-Droid: Use the F-Droid API to query for the newest released version
- GitHub: Use the GitHub API to query for the newest release, and check
the APK filename attached to that release
- Google Play: Use the Play in-app-updates library
(https://developer.android.com/guide/playcore/in-app-updates) to query
for the newest released version
These are kept in different build flavours (source sets), so that e.g.,
the build for the F-Droid store can only query the F-Droid API, the UI
strings are specific to F-Droid, etc. This also ensures that the update
service libraries are specific to that build and do not
"cross-contaminate".
Note that this *does not* update the app, it takes the user to either
the relevant store page (F-Droid, Play) or GitHub release page. The user
must still start the update from that page.
CI configuration is updated to build the different flavours.
2023-11-08 08:42:39 +01:00
|
|
|
googleImplementation libs.app.update
|
|
|
|
googleImplementation libs.app.update.ktx
|
|
|
|
|
2022-11-04 20:10:26 +01:00
|
|
|
testImplementation libs.androidx.test.junit
|
|
|
|
testImplementation libs.robolectric
|
|
|
|
testImplementation libs.bundles.mockito
|
|
|
|
testImplementation libs.mockwebserver
|
|
|
|
testImplementation libs.androidx.core.testing
|
|
|
|
testImplementation libs.kotlinx.coroutines.test
|
2022-11-07 20:04:07 +01:00
|
|
|
testImplementation libs.androidx.work.testing
|
Convert NotificationsFragment and related code to Kotlin, use the Paging library (#3159)
* Unmodified output from "Convert Java to Kotlin" on NotificationsFragment.java
* Bare minimum changes to get this to compile and run
- Use `lateinit` for `eventhub`, `adapter`, `preferences`, and `scrolllistener`
- Removed override for accountManager, it can be used from the superclass
- Add `?.` where non-nullity could not (yet) be guaranteed
- Remove `?` from type lists where non-nullity is guaranteed
- Explicitly convert lists to mutable where necessary
- Delete unused function `findReplyPosition`
* Remove all unnecessary non-null (!!) assertions
The previous change meant some values are no longer nullable. Remove the
non-null assertions.
* Lint ListStatusAccessibilityDelegate call
- Remove redundant constructor
- Move block outside of `()`
* Use `let` when handling compose button visibility on scroll
* Replace a `requireNonNull` with `!!`
* Remove redundant return values
* Remove or rename unused lambda parameters
* Remove unnecessary type parameters
* Remove unnecessary null checks
* Replace cascading-if statement with `when`
* Simplify calculation of `topId`
* Use more appropriate list properties and methods
- Access the last value with `.last()`
- Access the last index with `.lastIndex`
- Replace logical-chain with `asRightOrNull` and `?.`
- `.isNotEmpty()`, not `!...isEmpty()`
* Inline unnecessary variable
* Use PrefKeys constants instead of bare strings
* Use `requireContext()` instead of `context!!`
* Replace deprecated `onActivityCreated()` with `onViewCreated()`
* Remove unnecessary variable setting
* Replace `size == 0` check with `isEmpty()`
* Format with ktlint, no functionality changes
* Convert NotifcationsAdapter to Kotlin
Does not compile, this is the unchanged output of the "Convert to Kotlin"
function
* Minimum changes to get NotificationsAdapter to compile
* Remove unnecessary visibility modifiers
* Use `isNotEmpty()`
* Remove unused lambda parameters
* Convert cascading-if to `when`
* Simplifiy assignment op
* Use explicit argument names with `copy()`
* Use `.firstOrNull()` instead of `if`
* Mark as lateinit to avoid unnecessary null checks
* Format with ktlint, whitespace changes only
* Bare minimum necessary to demonstrate paging in notifications
Create `NotificationsPagingSource`. This uses a new `notifications2()` API
call, which will exist until all the code has been adapted. Instead of
using placeholders,
Create `NotificationsPagingAdapter` (will replace `NotificationsAdapater`)
to consume this data.
Expose the paging source view a new `NotificationsViewModel` `flow`, and
submit new pages to the adapter as they are available in
`NotificationsFragment`.
Comment out any other code in `NotificationsFragment` that deals with
loading data from the network. This will be updated as necessary, either
here, or in the view model.
Lots of functionality is missing, including:
- Different views for different notification types
- Starting at the remembered notification position
- Interacting with notifications
- Adjusting the UI state to match the loading state
These will be added incrementally.
* Migrate StatusNotificationViewHolder impl. to NotificationsPagingAdapter
With this change `NotificationsPagingAdapter` shows notifications about a
status correctly.
- Introduce a `ViewHolder` abstract class that all Notification view holders
derive from. Modify the fallback view holder to use this.
- Implement `StatusNotificationViewHolder`. Much of the code is from the
existing implementation in the `NotificationAdapater`.
- The original code split the code that binds values to views between the
adapter's `bindViewHolder` method and the view holder's methods.
In this code, all of the binding code is in the view holder, in a `bind`
method. This is called by the adapter's `bindViewHolder` method. This keeps
all the binding logic in the view holder, where it belongs.
- The new `StatusNotificationViewHolder` uses view binding to access its views
instead of `findViewById`.
- Logically, information about whether to show sensitive media, or open
content warnings should be part of the `StatusDisplayOptions`. So add those
as fields, and populate them appropriately.
This affects code outside notification handling, which will be adjusted
later.
* Note some TODOs to complete before the PR is finished
* Extract StatusNotificationViewHolder to a new file
* Add TODO for NotificationViewData.Concrete
* Convert the adapter to take NotificationViewData.Concrete
* Add a view holder for regular status notifications
* Migrate Follow and FollowRequest notifications
* Migrate report notifications
* Convert onViewThread to use the adapter data
* Convert onViewMedia to use the adapter data
* Convert onMore to use the adapter data
* Convert onReply to use the adapter data
* Convert NotificationViewData to Kotlin
* Re-implement the reblog functionality
- Move reblogging in to the view model
- Update the UI via the adapter's `snapshot()` and `notifyItemChanged()`
methods
* Re-implement the favourite functionality
Same approach as reblog
* Re-implement the bookmark functionality
Same approach as reblog
* Add TODO re StatusActionListener interface
* Add TODO re event handling
* Re-implementing the voting functionality
* Re-implement viewing hidden content
- Hidden media
- Content behind a content warning
* Add a TODO re pinning
* Re-implement "Show more" / "Show less"
* Delete unused updateStatus() function
* Comment out the scroll listener for the moment
* Re-implement applying filters to notifications
Introduce `NotificationsRepository`, to provide access to the notifications
stream.
When changing the filters the flow is as follows:
- User clicks "Apply" in the fragment.
- Fragment calls `viewModel.accept()` with a `UiAction.ApplyFilter` (new
class).
- View model maintains a private flow of incoming UI actions. The new action
is emitted to that flow.
- In view model, `notificationFilter` waits for `.ApplyFilter` actions, and
ensures the filter is saved, then emits it.
- In view model, `pagingDataFlow` waits for new items from
`notificationsFilter` and fetches the notifications from the repository in
response. The repository provides `Notification`, so the model maps them to
`NotificationViewData.Concrete` for display by the adapter.
- In view model the UI state also waits for new items from
`notificationsFilter` and emits a new `UiState` every time the filter is
changed.
When opening the fragment for the first time:
- All of the above machinery, but `notificationFilter` also fetches the filter
from the active account and emits that first. This triggers the first fetch
and the first update of `uiState`.
Also:
- Add TODOs for functionality that is not implemented yet
- Delete a lot of dead code from NotificationsFragment
* Include important preference values in `uiState`
Listen to the flow of eventHub events, filtered to preference changes that
are relevant to the notification view.
When preferences change (or when the view model starts), fetch the current
values, and include them in `uiState`.
Remove preference handling from `NotificationsFragment`, and just use
the values from `uiState`.
Adjust how the `useAbsoluteTime` preference is handled. The previous code
loaded new content (via a diffutil) in to the adapter, which would trigger
a re-binding of the timestamp.
As the adapter content is immutable, the new code simply triggers a
re-binding of the views that are currently visible on screen.
* Update UI in response to different load states
Notifications can be loaded at the top and bottom of the timeline. Add a
new layout to show the progress of these loads, and any errors that can
occur.
Catch network errors in `NotificationsPagingSource` and convert to
`LoadState.Error`.
Add a header/footer to the notifications list to show the load state.
Collect the load state from the adapter, use this to drive the visibility
of different views.
* Save and restore the last read notification ID
Use this when fetching notifications, to centre the list around the
notification that was last read.
* Call notifyItemRangeChanged with the correct parameters
* Don't try and save list position if there are no items in the list
* Show/hide the "Nothing to see" view appropriately
* Update comments
* Handle the case where the notification key no longer exists
* Re-implement support for showMediaPreview and other settings
* Re-implement "hide FAB when scrolling" preference
* Delete dead code
* Delete Notifications Adapater and Placeholder types
* Remove NotificationViewData.Concrete subclass
Now there's no Placeholder, everything is a NotificationViewData.
* Improve how notification pages are loaded if the first notification is missing or filtered
* Re-implement clear notifications, show errors
* s/default/from/
* Add missing headers
* Don't process bookmarking via EventHub
- Initiating a bookmark is triggered by the fragment sending a
StatusUiAction.Bookmark
- View model receives this, makes API call, waits for response, emits either
a success or failure state
- Fragment collects success/failure states, updates the UI accordingly
* Don't process favourites via EventHub
* Don't process reblog via EventHub
* Don't process poll votes with EventHub
This removes EventHub from the fragment
* Respond to follow requests via the view model
* Docs and cleanup
* Typo and editing pass
* Minor edits for clarity
* Remove newline in diagram
* Reorder sequence diagram
* s/authorize/accept/
* s/pagingDataFlow/pagingData/
* Add brief KDoc
* Try and fetch a full first page of notifications
* Call the API method `notifications` again
* Log UI errors at the point of handling
* Remove unused variable
* Replace String.format() with interpolation
* Convert NotificationViewData to data class
* Rename copy() to make(), to avoid confusion with default copy() method
* Lint
* Update app/src/main/res/layout/simple_list_item_1.xml
* Update app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingAdapter.kt
* Update app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsViewModel.kt
* Update app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.kt
* Update app/src/main/java/com/keylesspalace/tusky/viewdata/NotificationViewData.kt
* Initial NotificationsViewModel tests
* Add missing import
* More tests, some cleanup
* Comments, re-order some code
* Set StateRestorationPolicy.PREVENT_WHEN_EMPTY
* Mark clearNotifications() as "suspend"
* Catch exceptions from clearNotifications and emit
* Update TODOs with explanations
* Ensure initial fetch uses a null ID
* Stop/start collecting pagingData based on the lifecycle
* Don't hide the list while refreshing
* Refresh notifications on mutes and blocks
* Update tests now clearNotifications is a suspend fun
* Add "Refresh" menu to NotificationsFragment
* Use account.name over account.displayName
* Update app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.kt
Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
* Mark layoutmanager as lateinit
* Mark layoutmanager as lateinit
* Refactor generating UI text
* Add Copyright header
* Correctly apply notification filters
* Show follow request header in notifications
* Wait for follow request actions to complete, so the reqeuest is sent
* Remove duplicate copyright header
* Revert copyright change in unmodified file
* Null check response body
* Move NotificationsFragment to component.notifications
* Use viewlifecycleowner.lifecyclescope
* Show notification filter as a dialog rather than a popup window
The popup window:
- Is inconsistent UI
- Requires a custom layout
- Didn't play nicely with viewbinding
* Refresh adapter on block/mute
* Scroll up slightly when new content is loaded
* Restore progressbar
* Lint
* Update app/src/main/res/layout/simple_list_item_1.xml
---------
Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2023-03-10 20:12:33 +01:00
|
|
|
testImplementation libs.truth
|
|
|
|
testImplementation libs.turbine
|
2023-10-07 19:30:11 +02:00
|
|
|
testImplementation libs.androidx.test.core.ktx
|
|
|
|
testImplementation libs.hilt.android.testing
|
2023-10-18 15:02:17 +02:00
|
|
|
kspTest libs.hilt.compiler
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
androidTestImplementation libs.espresso.core
|
|
|
|
androidTestImplementation libs.androidx.room.testing
|
|
|
|
androidTestImplementation libs.androidx.test.junit
|
2023-10-07 19:30:11 +02:00
|
|
|
androidTestImplementation libs.hilt.android.testing
|
|
|
|
androidTestImplementation libs.androidx.test.core.ktx
|
2023-11-05 13:51:37 +01:00
|
|
|
|
|
|
|
lintChecks project(":checks")
|
2017-11-05 22:32:36 +01:00
|
|
|
}
|