(Misskey)投稿画面の残り文字数をインスタンス情報から読む
This commit is contained in:
parent
788933cb11
commit
0284ed6bb3
|
@ -983,8 +983,6 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||||
when{
|
when{
|
||||||
account == null || account.isPseudo -> {}
|
account == null || account.isPseudo -> {}
|
||||||
|
|
||||||
account.isMisskey ->return 3000
|
|
||||||
|
|
||||||
else->{
|
else->{
|
||||||
val info = account.instance
|
val info = account.instance
|
||||||
|
|
||||||
|
@ -1000,7 +998,14 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||||
var newInfo : TootInstance? = null
|
var newInfo : TootInstance? = null
|
||||||
|
|
||||||
override fun background(client : TootApiClient) : TootApiResult? {
|
override fun background(client : TootApiClient) : TootApiResult? {
|
||||||
val result = client.request("/api/v1/instance")
|
val result = if( account.isMisskey){
|
||||||
|
client.request(
|
||||||
|
"/api/meta",
|
||||||
|
account.putMisskeyApiToken().toPostRequestBuilder()
|
||||||
|
)
|
||||||
|
}else{
|
||||||
|
client.request("/api/v1/instance")
|
||||||
|
}
|
||||||
newInfo = TootParser(this@ActPost, account).instance(result?.jsonObject)
|
newInfo = TootParser(this@ActPost, account).instance(result?.jsonObject)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -1095,6 +1100,7 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateTextCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun performAccountChooser() {
|
private fun performAccountChooser() {
|
||||||
|
@ -1177,6 +1183,7 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||||
}
|
}
|
||||||
showVisibility()
|
showVisibility()
|
||||||
showQuotedRenote()
|
showQuotedRenote()
|
||||||
|
updateTextCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
|
|
@ -61,7 +61,6 @@ class TootInstance(parser : TootParser, src : JSONObject) {
|
||||||
|
|
||||||
// インスタンスの種別
|
// インスタンスの種別
|
||||||
enum class InstanceType {
|
enum class InstanceType {
|
||||||
|
|
||||||
Mastodon,
|
Mastodon,
|
||||||
Pleroma,
|
Pleroma,
|
||||||
Misskey
|
Misskey
|
||||||
|
@ -87,9 +86,9 @@ class TootInstance(parser : TootParser, src : JSONObject) {
|
||||||
this.decoded_version = VersionString(version)
|
this.decoded_version = VersionString(version)
|
||||||
this.stats = null
|
this.stats = null
|
||||||
this.thumbnail = null
|
this.thumbnail = null
|
||||||
this.max_toot_chars = 1000
|
this.max_toot_chars = src.parseInt("maxNoteTextLength")
|
||||||
this.instanceType = InstanceType.Misskey
|
this.instanceType = InstanceType.Misskey
|
||||||
this.languages = ArrayList<String>().also{ it.add("?")}
|
this.languages = src.optJSONArray("langs")?.toStringArrayList() ?: ArrayList()
|
||||||
this.contact_account = null
|
this.contact_account = null
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
Loading…
Reference in New Issue