upgrade ktlint plugin to 12.0.3 (#4169)
There are some new rules, I think they mostly make sense, except for the max line length which I had to disable because we are over it in a lot of places. --------- Co-authored-by: Goooler <wangzongler@gmail.com>
This commit is contained in:
parent
33cd6fdb98
commit
5192fb08a5
215 changed files with 2813 additions and 1177 deletions
|
|
@ -22,7 +22,8 @@ data class Account(
|
|||
val id: String,
|
||||
@SerializedName("username") val localUsername: String,
|
||||
@SerializedName("acct") val username: String,
|
||||
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
|
||||
// should never be null per Api definition, but some servers break the contract
|
||||
@SerializedName("display_name") val displayName: String?,
|
||||
@SerializedName("created_at") val createdAt: Date,
|
||||
val note: String,
|
||||
val url: String,
|
||||
|
|
@ -34,8 +35,10 @@ data class Account(
|
|||
@SerializedName("statuses_count") val statusesCount: Int = 0,
|
||||
val source: AccountSource? = null,
|
||||
val bot: Boolean = false,
|
||||
val emojis: List<Emoji>? = emptyList(), // nullable for backward compatibility
|
||||
val fields: List<Field>? = emptyList(), // nullable for backward compatibility
|
||||
// nullable for backward compatibility
|
||||
val emojis: List<Emoji>? = emptyList(),
|
||||
// nullable for backward compatibility
|
||||
val fields: List<Field>? = emptyList(),
|
||||
val moved: Account? = null,
|
||||
val roles: List<Role>? = emptyList()
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ import kotlinx.parcelize.Parcelize
|
|||
data class Attachment(
|
||||
val id: String,
|
||||
val url: String,
|
||||
@SerializedName("preview_url") val previewUrl: String?, // can be null for e.g. audio attachments
|
||||
// can be null for e.g. audio attachments
|
||||
@SerializedName("preview_url") val previewUrl: String?,
|
||||
val meta: MetaData?,
|
||||
val type: Type,
|
||||
val description: String?,
|
||||
|
|
@ -55,7 +56,11 @@ data class Attachment(
|
|||
|
||||
class MediaTypeDeserializer : JsonDeserializer<Type> {
|
||||
@Throws(JsonParseException::class)
|
||||
override fun deserialize(json: JsonElement, classOfT: java.lang.reflect.Type, context: JsonDeserializationContext): Type {
|
||||
override fun deserialize(
|
||||
json: JsonElement,
|
||||
classOfT: java.lang.reflect.Type,
|
||||
context: JsonDeserializationContext
|
||||
): Type {
|
||||
return when (json.toString()) {
|
||||
"\"image\"" -> Type.IMAGE
|
||||
"\"gifv\"" -> Type.GIFV
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.google.gson.annotations.SerializedName
|
|||
data class Conversation(
|
||||
val id: String,
|
||||
val accounts: List<TimelineAccount>,
|
||||
@SerializedName("last_status") val lastStatus: Status?, // should never be null, but apparently its possible https://github.com/tuskyapp/Tusky/issues/1038
|
||||
// should never be null, but apparently its possible https://github.com/tuskyapp/Tusky/issues/1038
|
||||
@SerializedName("last_status") val lastStatus: Status?,
|
||||
val unread: Boolean
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.keylesspalace.tusky.entity
|
|||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.util.Date
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class Filter(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ data class Instance(
|
|||
// val registrations: Registrations,
|
||||
// val contact: Contact,
|
||||
val rules: List<Rule>,
|
||||
val pleroma: PleromaConfiguration?,
|
||||
val pleroma: PleromaConfiguration?
|
||||
) {
|
||||
data class Usage(val users: Users) {
|
||||
data class Users(@SerializedName("active_month") val activeMonth: Int)
|
||||
|
|
@ -23,11 +23,11 @@ data class Instance(
|
|||
data class Thumbnail(
|
||||
val url: String,
|
||||
val blurhash: String?,
|
||||
val versions: Versions?,
|
||||
val versions: Versions?
|
||||
) {
|
||||
data class Versions(
|
||||
@SerializedName("@1x") val at1x: String?,
|
||||
@SerializedName("@2x") val at2x: String?,
|
||||
@SerializedName("@2x") val at2x: String?
|
||||
)
|
||||
}
|
||||
data class Configuration(
|
||||
|
|
@ -36,14 +36,14 @@ data class Instance(
|
|||
val statuses: Statuses?,
|
||||
@SerializedName("media_attachments") val mediaAttachments: MediaAttachments?,
|
||||
val polls: Polls?,
|
||||
val translation: Translation?,
|
||||
val translation: Translation?
|
||||
) {
|
||||
data class Urls(@SerializedName("streaming_api") val streamingApi: String)
|
||||
data class Accounts(@SerializedName("max_featured_tags") val maxFeaturedTags: Int)
|
||||
data class Statuses(
|
||||
@SerializedName("max_characters") val maxCharacters: Int,
|
||||
@SerializedName("max_media_attachments") val maxMediaAttachments: Int,
|
||||
@SerializedName("characters_reserved_per_url") val charactersReservedPerUrl: Int,
|
||||
@SerializedName("characters_reserved_per_url") val charactersReservedPerUrl: Int
|
||||
)
|
||||
data class MediaAttachments(
|
||||
// Warning: This is an array in mastodon and a dictionary in friendica
|
||||
|
|
@ -52,20 +52,20 @@ data class Instance(
|
|||
@SerializedName("image_matrix_limit") val imagePixelCountLimit: Long,
|
||||
@SerializedName("video_size_limit") val videoSizeLimitBytes: Long,
|
||||
@SerializedName("video_matrix_limit") val videoPixelCountLimit: Long,
|
||||
@SerializedName("video_frame_rate_limit") val videoFrameRateLimit: Int,
|
||||
@SerializedName("video_frame_rate_limit") val videoFrameRateLimit: Int
|
||||
)
|
||||
data class Polls(
|
||||
@SerializedName("max_options") val maxOptions: Int,
|
||||
@SerializedName("max_characters_per_option") val maxCharactersPerOption: Int,
|
||||
@SerializedName("min_expiration") val minExpirationSeconds: Int,
|
||||
@SerializedName("max_expiration") val maxExpirationSeconds: Int,
|
||||
@SerializedName("max_expiration") val maxExpirationSeconds: Int
|
||||
)
|
||||
data class Translation(val enabled: Boolean)
|
||||
}
|
||||
data class Registrations(
|
||||
val enabled: Boolean,
|
||||
@SerializedName("approval_required") val approvalRequired: Boolean,
|
||||
val message: String?,
|
||||
val message: String?
|
||||
)
|
||||
data class Contact(val email: String, val account: Account)
|
||||
data class Rule(val id: String, val text: String)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ data class MastoList(
|
|||
val id: String,
|
||||
val title: String,
|
||||
val exclusive: Boolean?,
|
||||
@SerializedName("replies_policy") val repliesPolicy: String?,
|
||||
@SerializedName("replies_policy") val repliesPolicy: String?
|
||||
) {
|
||||
enum class ReplyPolicy(val policy: String) {
|
||||
NONE("none"),
|
||||
|
|
@ -34,7 +34,8 @@ data class MastoList(
|
|||
FOLLOWED("followed");
|
||||
|
||||
companion object {
|
||||
fun from(policy: String?): ReplyPolicy = values().firstOrNull { it.policy == policy } ?: LIST
|
||||
fun from(policy: String?): ReplyPolicy =
|
||||
values().firstOrNull { it.policy == policy } ?: LIST
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ data class Notification(
|
|||
}
|
||||
|
||||
/** Notification types for UI display (omits UNKNOWN) */
|
||||
val visibleTypes = listOf(MENTION, REBLOG, FAVOURITE, FOLLOW, FOLLOW_REQUEST, POLL, STATUS, SIGN_UP, UPDATE, REPORT)
|
||||
val visibleTypes =
|
||||
listOf(MENTION, REBLOG, FAVOURITE, FOLLOW, FOLLOW_REQUEST, POLL, STATUS, SIGN_UP, UPDATE, REPORT)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
|
@ -117,8 +118,8 @@ data class Notification(
|
|||
fun rewriteToStatusTypeIfNeeded(accountId: String): Notification {
|
||||
if (type == Type.MENTION && status != null) {
|
||||
return if (status.mentions.any {
|
||||
it.id == accountId
|
||||
}
|
||||
it.id == accountId
|
||||
}
|
||||
) {
|
||||
this
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ data class Poll(
|
|||
val expired: Boolean,
|
||||
val multiple: Boolean,
|
||||
@SerializedName("votes_count") val votesCount: Int,
|
||||
@SerializedName("voters_count") val votersCount: Int?, // nullable for compatibility with Pleroma
|
||||
// nullable for compatibility with Pleroma
|
||||
@SerializedName("voters_count") val votersCount: Int?,
|
||||
val options: List<PollOption>,
|
||||
val voted: Boolean,
|
||||
@SerializedName("own_votes") val ownVotes: List<Int>?
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ data class Relationship(
|
|||
*/
|
||||
@JsonAdapter(GuardedBooleanAdapter::class) val subscribing: Boolean? = null,
|
||||
@SerializedName("domain_blocking") val blockingDomain: Boolean,
|
||||
val note: String?, // nullable for backward compatibility / feature detection
|
||||
val notifying: Boolean? // since 3.3.0rc
|
||||
// nullable for backward compatibility / feature detection
|
||||
val note: String?,
|
||||
// since 3.3.0rc
|
||||
val notifying: Boolean?
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ import java.util.Date
|
|||
|
||||
data class Status(
|
||||
val id: String,
|
||||
val url: String?, // not present if it's reblog
|
||||
// not present if it's reblog
|
||||
val url: String?,
|
||||
val account: TimelineAccount,
|
||||
@SerializedName("in_reply_to_id") val inReplyToId: String?,
|
||||
@SerializedName("in_reply_to_account_id") val inReplyToAccountId: String?,
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@ data class TimelineAccount(
|
|||
val id: String,
|
||||
@SerializedName("username") val localUsername: String,
|
||||
@SerializedName("acct") val username: String,
|
||||
@SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract
|
||||
// should never be null per Api definition, but some servers break the contract
|
||||
@SerializedName("display_name") val displayName: String?,
|
||||
val url: String,
|
||||
val avatar: String,
|
||||
val note: String,
|
||||
val bot: Boolean = false,
|
||||
val emojis: List<Emoji>? = emptyList() // nullable for backward compatibility
|
||||
// nullable for backward compatibility
|
||||
val emojis: List<Emoji>? = emptyList()
|
||||
) {
|
||||
|
||||
val name: String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue