a3d45ca9ec
Moshi is faster to decode JSON at runtime, is actively maintained, has a smaller memory and method footprint, and a slightly smaller APK size. Moshi also correctly creates default constructor arguments instead of leaving them null, which was a source of `NullPointerExceptions` when using Gson. The conversion broadly consisted of: - Adding `@JsonClass(generateAdapter = true)` to data classes that marshall to/from JSON. - Replacing `@SerializedName(value = ...)` with `@Json(name = ...)`. - Replacing Gson instances with Moshi in Retrofit, Hilt, and tests. - Using Moshi adapters to marshall to/from JSON instead of Gson `toJson` / `fromJson`. - Deleting `Rfc3339DateJsonAdapter` and related code, and using the equivalent adapter bundled with Moshi. - Rewriting `GuardedBooleanAdapter` as a more generic `GuardedAdapter`. - Deleting unused ProGuard rules; Moshi generates adapters using code generation, not runtime reflection. The conversion surfaced some bugs which have been fixed. - Not all audio attachments have attachment size metadata. Don't show the attachment preview if the metadata is missing. - Some `throwable` were not being logged correctly. - The wrong type was being used when parsing the response when sending a scheduled status. - Exceptions other than `HttpException` or `IoException` would also cause a status to be resent. If there's a JSON error parsing a response the status would be repeatedly sent. - In tests strings containing error responses were not valid JSON. - Workaround Mastodon a bug and ensure `filter.keywords` is populated, https://github.com/mastodon/mastodon/issues/29142 |
||
---|---|---|
.. | ||
src/main | ||
README.md | ||
build.gradle.kts | ||
settings.gradle.kts |
README.md
mkserverversions
Synopsis
mkserverversions
creates a JSON5 file that maps different Fediverse server
names to a list of the different version strings seen for those servers, as
recorded by Fediverse Observer.
This is used as input data for core/network/ServerTest
, to ensure that the
version parsing code can handle real-world version strings.
Run mkserverversions
every month to update the test data, and update the
parsing code if any of the tests fail.
Usage
From the parent directory, run:
./runtools mkserverversions
Verify the modifications made to server-versions.json5
, re-run the tests,
and commit the result.