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)
|
2024-05-10 15:55:07 +02:00
|
|
|
alias(libs.plugins.hilt.android)
|
2023-02-04 19:58:53 +01:00
|
|
|
alias(libs.plugins.kotlin.android)
|
|
|
|
alias(libs.plugins.kotlin.parcelize)
|
2018-07-16 19:01:34 +02:00
|
|
|
}
|
|
|
|
|
2023-02-16 20:20:52 +01:00
|
|
|
apply from: 'getGitSha.gradle'
|
2023-02-10 21:22:32 +01:00
|
|
|
|
2023-02-16 20:20:52 +01:00
|
|
|
final def gitSha = ext.getGitSha()
|
2023-02-04 19:58:53 +01:00
|
|
|
|
|
|
|
// The app name
|
|
|
|
final def APP_NAME = "Tusky"
|
|
|
|
// The application id. Must be unique, e.g. based on your domain
|
|
|
|
final def APP_ID = "com.keylesspalace.tusky"
|
|
|
|
// url of a custom app logo. Recommended size at least 600x600. Keep empty to use the Tusky elephant friend.
|
|
|
|
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.
|
|
|
|
final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Tusky"
|
|
|
|
|
2017-01-03 00:30:27 +01:00
|
|
|
android {
|
2024-02-23 10:27:19 +01:00
|
|
|
compileSdk 34
|
2023-02-04 19:58:53 +01:00
|
|
|
namespace "com.keylesspalace.tusky"
|
2017-01-03 00:30:27 +01:00
|
|
|
defaultConfig {
|
2019-10-29 20:30:46 +01:00
|
|
|
applicationId APP_ID
|
2022-12-06 20:32:26 +01:00
|
|
|
namespace "com.keylesspalace.tusky"
|
2023-09-12 19:25:45 +02:00
|
|
|
minSdk 24
|
2024-02-23 10:27:19 +01:00
|
|
|
targetSdk 34
|
2024-05-10 13:31:40 +02:00
|
|
|
versionCode 121
|
|
|
|
versionName "25.2"
|
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 {
|
2024-02-17 15:15:19 +01:00
|
|
|
debug {
|
|
|
|
isDefault 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'
|
2024-02-29 15:29:05 +01:00
|
|
|
|
|
|
|
kotlinOptions {
|
|
|
|
freeCompilerArgs = [
|
|
|
|
"-Xno-param-assertions",
|
|
|
|
"-Xno-call-assertions",
|
|
|
|
"-Xno-receiver-assertions"
|
|
|
|
]
|
|
|
|
}
|
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"
|
2018-07-16 19:01:34 +02:00
|
|
|
productFlavors {
|
2019-06-09 16:55:34 +02:00
|
|
|
blue {}
|
2018-07-16 19:01:34 +02:00
|
|
|
green {
|
2020-11-28 17:34:21 +01:00
|
|
|
resValue "string", "app_name", APP_NAME + " Test"
|
2017-12-08 12:15:46 +01:00
|
|
|
applicationIdSuffix ".test"
|
2023-02-04 19:58:53 +01:00
|
|
|
versionNameSuffix "-" + gitSha
|
2024-02-17 15:15:19 +01:00
|
|
|
isDefault true
|
2017-12-08 12:15:46 +01:00
|
|
|
}
|
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")
|
2024-04-02 21:02:51 +02:00
|
|
|
// Regenerate by deleting the file and running `./gradlew app:lintGreenDebug`
|
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
|
|
|
|
}
|
2024-05-10 15:55:07 +02:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-12-05 19:13:15 +01:00
|
|
|
dependenciesInfo {
|
|
|
|
includeInApk false
|
|
|
|
includeInBundle false
|
|
|
|
}
|
2023-02-04 19:58:53 +01:00
|
|
|
applicationVariants.configureEach { variant ->
|
|
|
|
variant.outputs.configureEach {
|
|
|
|
outputFileName = "Tusky_${variant.versionName}_${variant.versionCode}_${gitSha}_" +
|
|
|
|
"${variant.flavorName}_${buildType.name}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-29 18:37:46 +02:00
|
|
|
ksp {
|
|
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
2024-02-23 12:21:31 +01:00
|
|
|
arg("room.generateKotlin", "true")
|
2023-06-29 18:37:46 +02:00
|
|
|
arg("room.incremental", "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"
|
|
|
|
}
|
|
|
|
|
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.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
|
|
|
|
|
Replace Gson library with Moshi (#4309)
**! ! Warning**: Do not merge before testing every API call and database
read involving JSON !
**Gson** is obsolete and has been superseded by **Moshi**. But more
importantly, parsing Kotlin objects using Gson is _dangerous_ because
Gson uses Java serialization and is **not Kotlin-aware**. This has two
main consequences:
- Fields of non-null types may end up null at runtime. Parsing will
succeed, but the code may crash later with a `NullPointerException` when
trying to access a field member;
- Default values of constructor parameters are always ignored. When
absent, reference types will be null, booleans will be false and
integers will be zero.
On the other hand, Kotlin-aware parsers like **Moshi** or **Kotlin
Serialization** will validate at parsing time that all received fields
comply with the Kotlin contract and avoid errors at runtime, making apps
more stable and schema mismatches easier to detect (as long as logs are
accessible):
- Receiving a null value for a non-null type will generate a parsing
error;
- Optional types are declared explicitly by adding a default value. **A
missing value with no default value declaration will generate a parsing
error.**
Migrating the entity declarations from Gson to Moshi will make the code
more robust but is not an easy task because of the semantic differences.
With Gson, both nullable and optional fields are represented with a null
value. After converting to Moshi, some nullable entities can become
non-null with a default value (if they are optional and not nullable),
others can stay nullable with no default value (if they are mandatory
and nullable), and others can become **nullable with a default value of
null** (if they are optional _or_ nullable _or_ both). That third option
is the safest bet when it's not clear if a field is optional or not,
except for lists which can usually be declared as non-null with a
default value of an empty list (I have yet to see a nullable array type
in the Mastodon API).
Fields that are currently declared as non-null present another
challenge. In theory, they should remain as-is and everything will work
fine. In practice, **because Gson is not aware of nullable types at
all**, it's possible that some non-null fields currently hold a null
value in some cases but the app does not report any error because the
field is not accessed by Kotlin code in that scenario. After migrating
to Moshi however, parsing such a field will now fail early if a null
value or no value is received.
These fields will have to be identified by heavily testing the app and
looking for parsing errors (`JsonDataException`) and/or by going through
the Mastodon documentation. A default value needs to be added for
missing optional fields, and their type could optionally be changed to
nullable, depending on the case.
Gson is also currently used to serialize and deserialize objects to and
from the local database, which is also challenging because backwards
compatibility needs to be preserved. Fortunately, by default Gson omits
writing null fields, so a field of type `List<T>?` could be replaced
with a field of type `List<T>` with a default value of `emptyList()` and
reading back the old data should still work. However, nullable lists
that are written directly (not as a field of another object) will still
be serialized to JSON as `"null"` so the deserializing code must still
be handling null properly.
Finally, changing the database schema is out of scope for this pull
request, so database entities that also happen to be serialized with
Gson will keep their original types even if they could be made non-null
as an improvement.
In the end this is all for the best, because the app will be more
reliable and errors will be easier to detect by showing up earlier with
a clear error message. Not to mention the performance benefits of using
Moshi compared to Gson.
- Replace Gson reflection with Moshi Kotlin codegen to generate all
parsers at compile time.
- Replace custom `Rfc3339DateJsonAdapter` with the one provided by
moshi-adapters.
- Replace custom `JsonDeserializer` classes for Enum types with
`EnumJsonAdapter.create(T).withUnknownFallback()` from moshi-adapters to
support fallback values.
- Replace `GuardedBooleanAdapter` with the more generic `GuardedAdapter`
which works with any type. Any nullable field may now be annotated with
`@Guarded`.
- Remove Proguard rules related to Json entities. Each Json entity needs
to be annotated with `@JsonClass` with no exception, and adding this
annotation will ensure that R8/Proguard will handle the entities
properly.
- Replace some nullable Boolean fields with non-null Boolean fields with
a default value where possible.
- Replace some nullable list fields with non-null list fields with a
default value of `emptyList()` where possible.
- Update `TimelineDao` to perform all Json conversions internally using
`Converters` so no Gson or Moshi instance has to be passed to its
methods.
- ~~Create a custom `DraftAttachmentJsonAdapter` to serialize and
deserialize `DraftAttachment` which is a special entity that supports
more than one json name per field. A custom adapter is necessary because
there is not direct equivalent of `@SerializedName(alternate = [...])`
in Moshi.~~ Remove alternate names for some `DraftAttachment` fields
which were used as a workaround to deserialize local data in 2-years old
builds of Tusky.
- Update tests to make them work with Moshi.
- Simplify a few `equals()` implementations.
- Change a few functions to `val`s
- Turn `NetworkModule` into an `object` (since it contains no abstract
methods).
Please test the app thoroughly before merging. There may be some fields
currently declared as mandatory that are actually optional.
2024-04-02 21:01:04 +02:00
|
|
|
implementation libs.bundles.moshi
|
|
|
|
ksp libs.moshi.kotlin.codegen
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
implementation libs.bundles.retrofit
|
|
|
|
implementation libs.networkresult.calladapter
|
|
|
|
|
|
|
|
implementation libs.bundles.okhttp
|
2024-04-14 16:39:29 +02:00
|
|
|
implementation libs.okio
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
2024-05-10 15:55:07 +02:00
|
|
|
implementation libs.hilt.android
|
|
|
|
ksp libs.hilt.compiler
|
|
|
|
implementation libs.androidx.hilt.work
|
|
|
|
ksp libs.androidx.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
|
|
|
|
|
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
|
2022-11-04 20:10:26 +01:00
|
|
|
|
|
|
|
androidTestImplementation libs.espresso.core
|
|
|
|
androidTestImplementation libs.androidx.room.testing
|
|
|
|
androidTestImplementation libs.androidx.test.junit
|
2017-11-05 22:32:36 +01:00
|
|
|
}
|