improve #239, replace short_description, read thumbnail.url
This commit is contained in:
parent
8494bcf0d9
commit
ced96e983b
|
@ -150,11 +150,11 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
|||
// A description for the instance
|
||||
// (HTML)
|
||||
// (Mastodon: 3.0.0より後のWebUIでは全く使われなくなる見込み。 https://github.com/tootsuite/mastodon/pull/12119)
|
||||
val description: String?
|
||||
val descriptionOld: String?
|
||||
|
||||
// (Mastodon 3.0.0以降)
|
||||
// (HTML)
|
||||
val short_description: String?
|
||||
val description: String?
|
||||
|
||||
// An email address which can be used to contact the instance administrator
|
||||
// misskeyの場合はURLらしい
|
||||
|
@ -223,7 +223,7 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
|||
this.contact_account = null
|
||||
|
||||
this.description = src.string("description")
|
||||
this.short_description = null
|
||||
this.descriptionOld = null
|
||||
this.approval_required = false
|
||||
|
||||
this.feature_quote = true
|
||||
|
@ -246,7 +246,15 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
|||
this.version = src.string("version")
|
||||
this.decoded_version = VersionString(version)
|
||||
this.stats = parseItem(src.jsonObject("stats")) { Stats(it) }
|
||||
this.thumbnail = src.string("thumbnail")
|
||||
this.thumbnail =
|
||||
// mastodon /api/v2/instance
|
||||
src.jsonObject("thumbnail")
|
||||
?.jsonObject("versions")?.string("@2x")
|
||||
// mastodon /api/v2/instance
|
||||
?: src.jsonObject("thumbnail")
|
||||
?.string("url")
|
||||
// mastodon /api/v1/instance
|
||||
?: src.string("thumbnail")
|
||||
|
||||
this.max_toot_chars = src.int("max_toot_chars")
|
||||
|
||||
|
@ -277,8 +285,19 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
|||
)
|
||||
}
|
||||
|
||||
this.description = src.string("description")
|
||||
this.short_description = src.string("short_description")
|
||||
when (val shortDesc = src.string("short_description")) {
|
||||
// /api/v2/instance
|
||||
null -> {
|
||||
this.descriptionOld = null
|
||||
this.description = src.string("description")
|
||||
}
|
||||
// /api/v1/instance
|
||||
else -> {
|
||||
this.descriptionOld = src.string("description")
|
||||
this.description = shortDesc
|
||||
}
|
||||
}
|
||||
|
||||
this.approval_required =
|
||||
// mastodon /api/v2/instance
|
||||
src.jsonObject("registrations")?.boolean("approval_required")
|
||||
|
@ -289,7 +308,10 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
|||
|
||||
this.feature_quote = src.boolean("feature_quote") ?: false
|
||||
|
||||
this.invites_enabled = src.boolean("invites_enabled")
|
||||
this.invites_enabled =
|
||||
// removed on /api/v2/instance
|
||||
// mastodon /api/v1/instance 3.1.4
|
||||
src.boolean("invites_enabled")
|
||||
|
||||
this.fedibirdCapabilities =
|
||||
src.jsonArray("fedibird_capabilities")?.stringList()?.toSet()
|
||||
|
|
|
@ -61,7 +61,7 @@ internal class ViewHolderHeaderInstance(
|
|||
}
|
||||
|
||||
views.tvDescription.movementMethod = MyLinkMovementMethod
|
||||
views.tvShortDescription.movementMethod = MyLinkMovementMethod
|
||||
views.tvDescriptionLong.movementMethod = MyLinkMovementMethod
|
||||
}
|
||||
|
||||
override fun showColor() {
|
||||
|
@ -81,7 +81,7 @@ internal class ViewHolderHeaderInstance(
|
|||
btnEmail.text = "?"
|
||||
btnEmail.isEnabledAlpha = false
|
||||
tvDescription.text = "?"
|
||||
tvShortDescription.text = "?"
|
||||
tvDescriptionLong.text = "?"
|
||||
ivThumbnail.setImageUrl(0f, null)
|
||||
tvLanguages.text = "?"
|
||||
tvInvitesEnabled.text = "?"
|
||||
|
@ -133,14 +133,14 @@ internal class ViewHolderHeaderInstance(
|
|||
emojiSizeMode = accessInfo.emojiSizeMode(),
|
||||
)
|
||||
|
||||
tvShortDescription.text = options
|
||||
.decodeHTML("<p>${instance.short_description ?: ""}</p>")
|
||||
.neatSpaces()
|
||||
|
||||
tvDescription.text = options
|
||||
.decodeHTML("<p>${instance.description ?: ""}</p>")
|
||||
.neatSpaces()
|
||||
|
||||
tvDescriptionLong.text = options
|
||||
.decodeHTML("<p>${instance.descriptionOld ?: ""}</p>")
|
||||
.neatSpaces()
|
||||
|
||||
val stats = instance.stats
|
||||
if (stats == null) {
|
||||
tvUserCount.setText(R.string.not_provided_mastodon_under_1_6)
|
||||
|
|
|
@ -71,8 +71,8 @@ class DlgCreateAccount(
|
|||
misskeyVersion = instanceInfo?.misskeyVersionMajor ?: 0
|
||||
),
|
||||
).decodeHTML(
|
||||
instanceInfo?.short_description?.notBlank()
|
||||
?: instanceInfo?.description?.notBlank()
|
||||
instanceInfo?.description?.notBlank()
|
||||
?: instanceInfo?.descriptionOld?.notBlank()
|
||||
?: TootInstance.DESCRIPTION_DEFAULT
|
||||
).neatSpaces()
|
||||
|
||||
|
|
|
@ -271,8 +271,8 @@ class LoginForm(
|
|||
|
||||
else -> {
|
||||
textColor = attrColor(R.attr.colorTextContent)
|
||||
text = (tootInstance.short_description.notBlank()
|
||||
?: tootInstance.description.notBlank()
|
||||
text = (tootInstance.description.notBlank()
|
||||
?: tootInstance.descriptionOld.notBlank()
|
||||
?: "(empty server description)"
|
||||
).let {
|
||||
DecodeOptions(
|
||||
|
|
|
@ -160,20 +160,20 @@
|
|||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/short_description" />
|
||||
android:text="@string/description" />
|
||||
|
||||
<jp.juggler.subwaytooter.view.MyTextView
|
||||
android:id="@+id/tvShortDescription"
|
||||
android:id="@+id/tvDescription"
|
||||
style="@style/setting_row_form" />
|
||||
|
||||
<View style="@style/setting_divider" />
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/description" />
|
||||
android:text="@string/description_long" />
|
||||
|
||||
<jp.juggler.subwaytooter.view.MyTextView
|
||||
android:id="@+id/tvDescription"
|
||||
android:id="@+id/tvDescriptionLong"
|
||||
style="@style/setting_row_form" />
|
||||
|
||||
<View style="@style/setting_divider" />
|
||||
|
|
|
@ -490,7 +490,6 @@
|
|||
<string name="domain_count">عدد النطاقات المتصلة</string>
|
||||
<string name="dont_show_timeout">لا تُظهر إشعار \"انتهاء مهلة الخادم\"</string>
|
||||
<string name="default_">افتراضي</string>
|
||||
<string name="short_description">وصف قصير</string>
|
||||
<string name="acct_sample">(مثال) username@server</string>
|
||||
<string name="background_image_alpha">شفافية صورة الخلفية</string>
|
||||
<string name="dont_show_follow">إخفاء المتابِعين</string>
|
||||
|
|
|
@ -466,7 +466,6 @@
|
|||
<string name="title">Títol</string>
|
||||
<string name="email">Correu-e</string>
|
||||
<string name="description">Descripció</string>
|
||||
<string name="short_description">Descripció curta</string>
|
||||
<string name="version">Versió</string>
|
||||
<string name="instance_information_of">Informació al servidor de \"%1$s\"</string>
|
||||
<string name="instance_information">Informació del servidor</string>
|
||||
|
|
|
@ -950,7 +950,6 @@
|
|||
<string name="instance_information">Serverinformation</string>
|
||||
<string name="instance_information_of">Serverinformation von \"%1$s\"</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="short_description">Kurzbeschreibung</string>
|
||||
<string name="description">Beschreibung</string>
|
||||
<string name="email">E-Mail</string>
|
||||
<string name="title">Titel</string>
|
||||
|
|
|
@ -939,7 +939,6 @@
|
|||
<string name="around_this_toot">Autour de ce message</string>
|
||||
<string name="your_toot">Votre message</string>
|
||||
<string name="block_domain">Bloquer tout le domaine</string>
|
||||
<string name="short_description">Courte description</string>
|
||||
<string name="media_attachment_max_byte_size_pixelfed">Taille limite de la pièce jointe (PixelFed) (Unité : Mo. Par défaut 15)</string>
|
||||
<string name="resize_square_pixels">Redimensionner en %1$d pixels carrés (équivalent %2$dx%2$d)</string>
|
||||
<string name="status_bar_color">Couleur de la barre d’état (redémarrage de l\'app requis. pre-Android 6 ne peut pas ajuster l’icône et la couleur du texte)</string>
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
<string name="delete_this_notification">この通知を削除</string>
|
||||
<string name="deleted_at">%1$sに削除されました</string>
|
||||
<string name="description">説明</string>
|
||||
<string name="short_description">短い説明</string>
|
||||
<string name="description_long">長い説明 (old Mastodon)</string>
|
||||
<string name="description_empty">説明文が指定されてません</string>
|
||||
<string name="developer">開発者</string>
|
||||
<string name="direct_messages">ダイレクトメッセージ</string>
|
||||
|
|
|
@ -1015,7 +1015,6 @@
|
|||
<string name="instance_information">实例信息</string>
|
||||
<string name="instance_information_of">“%1$s”的实例信息</string>
|
||||
<string name="version">版本</string>
|
||||
<string name="short_description">简要描述</string>
|
||||
<string name="description">描述</string>
|
||||
<string name="email">电子邮件</string>
|
||||
<string name="read_more_hashtag">读取更多标签</string>
|
||||
|
|
|
@ -465,7 +465,7 @@
|
|||
<string name="title">Title</string>
|
||||
<string name="email">E-mail</string>
|
||||
<string name="description">Description</string>
|
||||
<string name="short_description">Short description</string>
|
||||
<string name="description_long">Description (old Mastodon)</string>
|
||||
<string name="version">Version</string>
|
||||
<string name="instance_information_of">Server information of \"%1$s\"</string>
|
||||
<string name="instance_information">Server information</string>
|
||||
|
|
Loading…
Reference in New Issue