mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-30 18:44:52 +01:00
(Misskey)投稿画面の残り文字数をインスタンス情報から読む
This commit is contained in:
parent
788933cb11
commit
0284ed6bb3
@ -983,8 +983,6 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||
when{
|
||||
account == null || account.isPseudo -> {}
|
||||
|
||||
account.isMisskey ->return 3000
|
||||
|
||||
else->{
|
||||
val info = account.instance
|
||||
|
||||
@ -1000,7 +998,14 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||
var newInfo : TootInstance? = null
|
||||
|
||||
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)
|
||||
return result
|
||||
}
|
||||
@ -1095,6 +1100,7 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||
)
|
||||
}
|
||||
}
|
||||
updateTextCount()
|
||||
}
|
||||
|
||||
private fun performAccountChooser() {
|
||||
@ -1177,6 +1183,7 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
|
||||
}
|
||||
showVisibility()
|
||||
showQuotedRenote()
|
||||
updateTextCount()
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
@ -61,7 +61,6 @@ class TootInstance(parser : TootParser, src : JSONObject) {
|
||||
|
||||
// インスタンスの種別
|
||||
enum class InstanceType {
|
||||
|
||||
Mastodon,
|
||||
Pleroma,
|
||||
Misskey
|
||||
@ -87,9 +86,9 @@ class TootInstance(parser : TootParser, src : JSONObject) {
|
||||
this.decoded_version = VersionString(version)
|
||||
this.stats = null
|
||||
this.thumbnail = null
|
||||
this.max_toot_chars = 1000
|
||||
this.max_toot_chars = src.parseInt("maxNoteTextLength")
|
||||
this.instanceType = InstanceType.Misskey
|
||||
this.languages = ArrayList<String>().also{ it.add("?")}
|
||||
this.languages = src.optJSONArray("langs")?.toStringArrayList() ?: ArrayList()
|
||||
this.contact_account = null
|
||||
|
||||
}else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user