Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ACTIVE_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This document lists the changes that you will need to actively handle, through feature flags.


## 0.19.11

- Added `last_donation_notification` field to LocalUser
- Donation Dialog Shown Endpoint

## 0.19.6

- ImageDetails
Expand Down
238 changes: 238 additions & 0 deletions GeneratorScripts/src/main/kotlin/MapperGenerator0x19x11.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ fun main() {
val exclusionTarget = setOf<String>(
// "LocalUser", "MyUserInfo", "LocalSiteRateLimit"
)
genMapRoutes("v0/x19/x6", exclusionSrc, exclusionTarget)
genMapRoutes("v0/x19/x11", exclusionSrc, exclusionTarget)
}
12 changes: 6 additions & 6 deletions GeneratorScripts/src/main/kotlin/autogenscripts/GenTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ suspend fun downloadTypes(
println(String(proc.inputStream.readAllBytes()))

for (typeFile in datatypes.listFiles()!!) {
if (typeFile.name.startsWith("lib") || !typeFile.name.contains("module")) {
if (typeFile.name.startsWith("lib")) {
typeFile.delete()
} else if (typeFile.name.endsWith(".kt") && typeFile.isFile()) {
val originalTypeFile = typeFile.readText()

val fileName = typeFile.name.substringBefore(".")
val f = File(datatypes, "$fileName.kt")
f.createNewFile()
Expand All @@ -102,12 +104,12 @@ suspend fun downloadTypes(
var imports = ""

// typealiases are not serializable
if (!typeFile.readText().contains("typealias")) {
if (!originalTypeFile.contains("typealias")) {
imports += "import kotlinx.serialization.Serializable\n\n@Serializable"
}

val lines =
typeFile.readText()
originalTypeFile
.split(Regex("\r?\n"))
.drop(15) // Remove weird dukat imports
.filter { !it.contains("definedExternally") } // Remove these weird getters and setters
Expand Down Expand Up @@ -219,8 +221,6 @@ suspend fun downloadTypes(
if (lines.last() != "" && lines.last() != "\r") {
f.appendText("\n")
}

typeFile.delete()
}
}

Expand All @@ -230,5 +230,5 @@ suspend fun downloadTypes(
}

suspend fun main() {
downloadTypes("0.19.6", "v0/x19/x6")
downloadTypes("0.19.11-donation-dialog.1", "v0/x19/x11")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class FeatureFlags(val version: Version) {
private val v0x19x2Plus = version.withoutSuffixes() >= "0.19.2".toVersion()
private val v0x19x4Plus = version.withoutSuffixes() >= "0.19.4".toVersion()
private val v0x19x6Plus = version.withoutSuffixes() >= "0.19.6".toVersion()
private val v0x19x11Plus = version.withoutSuffixes() >= "0.19.11".toVersion()

/**
* InstanceBlock Feature added in 0.19
Expand Down Expand Up @@ -98,4 +99,9 @@ class FeatureFlags(val version: Version) {
* Search posts on title, feature added in 0.19.6
*/
fun searchPostsOnTitle(): Boolean = v0x19x6Plus

/**
* Mark donation dialog as shown, feature added in 0.19.11
*/
fun markDonationDialogShown(): Boolean = v0x19x11Plus
}
5 changes: 3 additions & 2 deletions app/src/commonMain/kotlin/it/vercruysse/lemmyapi/LemmyApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ object LemmyApi {
0, 1 -> it.vercruysse.lemmyapi.v0.x19.x0.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
2, 3 -> it.vercruysse.lemmyapi.v0.x19.x3.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
4, 5 -> it.vercruysse.lemmyapi.v0.x19.x4.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
6, 7, 8 -> it.vercruysse.lemmyapi.v0.x19.x6.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
else -> it.vercruysse.lemmyapi.v0.x19.x6.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
6, 7, 8, 9, 10 -> it.vercruysse.lemmyapi.v0.x19.x6.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
11 -> it.vercruysse.lemmyapi.v0.x19.x11.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
else -> it.vercruysse.lemmyapi.v0.x19.x11.LemmyApiUniWrapper(client, semverV, baseUrlInstance, auth)
}

else -> throw NotSupportedException("Unsupported Lemmy minor version: $version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ abstract class LemmyApiBaseController(client: HttpClient, actualVersion: Version
*/
abstract suspend fun leaveAdmin(): Result<GetSiteResponse>

/**
* Mark donation dialog as shown.
*
* @POST("user/donation_dialog_shown")
*/
abstract suspend fun markDonationDialogShown(): Result<Unit>

/**
* Add an admin to your site.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ data class LocalUser(
val enable_keyboard_navigation: Boolean,
val enable_animated_images: Boolean,
val collapse_bot_comments: Boolean,
/** Added in 0.19.11 */
val last_donation_notification: String = "",
) : DatatypeRoot, Identity
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,13 @@ internal class LemmyApiUniWrapper(client: HttpClient, actualVersion: Version, ba
override suspend fun leaveAdmin(): Result<it.vercruysse.lemmyapi.datatypes.GetSiteResponse> =
apiV18.leaveAdmin(it.vercruysse.lemmyapi.v0.x18.x5.datatypes.LeaveAdmin(auth ?: "")).map(transformer::toUni)

/**
* Mark donation dialog as shown.
*
* @POST("user/donation_dialog_shown")
*/
override suspend fun markDonationDialogShown(): Result<Unit> = notSupported()

/**
* Add an admin to your site.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,13 @@ internal class LemmyApiUniWrapper(client: HttpClient, actualVersion: Version, ba
override suspend fun leaveAdmin(): Result<it.vercruysse.lemmyapi.datatypes.GetSiteResponse> =
api.leaveAdmin().map(transformer::toUni)

/**
* Mark donation dialog as shown.
*
* @POST("user/donation_dialog_shown")
*/
override suspend fun markDonationDialogShown(): Result<Unit> = notSupported()

/**
* Add an admin to your site.
*
Expand Down
Loading
Loading