(Mastodon 2.8.0)blocked_byの表示。(Misskey)svgカスタム絵文字のエラー処理を改善。

This commit is contained in:
tateisu 2019-03-26 10:50:37 +09:00
parent 6b9bba8e3c
commit 8ec02c8a1d
3 changed files with 13 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class TootRelationShip(parser:TootParser,src : JSONObject) {
// Whether the authorized user is currently blocking the target account.
val blocking : Boolean
// misskey
// misskeyとMastodon 2.8.0以降
val blocked_by : Boolean
// Whether the authorized user is currently muting the target account.
@ -94,7 +94,10 @@ class TootRelationShip(parser:TootParser,src : JSONObject) {
this.requested = src.optBoolean("requested")
this.endorsed = src.optBoolean("endorsed")
blocked_by = false
// https://github.com/tootsuite/mastodon/commit/9745de883b198375ba23f7fde879f6d75ce2df0f
// Mastodon 2.8.0から
this.blocked_by = src.optBoolean("blocked_by")
requested_by = false
}

View File

@ -205,6 +205,7 @@ class UserRelation {
cv.put(COL_FOLLOWING, src.following.b2i())
cv.put(COL_FOLLOWED_BY, src.followed_by.b2i())
cv.put(COL_BLOCKING, src.blocking.b2i())
cv.put(COL_BLOCKED_BY, src.blocked_by.b2i())
cv.put(COL_MUTING, src.muting.b2i())
cv.put(COL_REQUESTED, src.requested.b2i())
cv.put(COL_FOLLOWING_REBLOGS, src.showing_reblogs)

View File

@ -17,6 +17,7 @@ import jp.juggler.subwaytooter.span.NetworkEmojiSpan
import jp.juggler.apng.ApngFrames
import jp.juggler.util.LogCategory
import kotlin.math.ceil
import kotlin.math.max
class CustomEmojiCache(internal val context : Context) {
@ -330,6 +331,11 @@ class CustomEmojiCache(internal val context : Context) {
val svg = SVG.getFromInputStream(ByteArrayInputStream(data))
val src_w = svg.documentWidth
val src_h = svg.documentHeight
// http://bigbadaboom.github.io/androidsvg/
// ロード失敗時に-1を返す例があるらしい
if( src_w <= 0f || src_h <=0f) return null
val aspect = src_w / src_h
val dst_w : Float
@ -337,7 +343,7 @@ class CustomEmojiCache(internal val context : Context) {
if(aspect >= 1f) {
dst_w = pixelMax
dst_h = pixelMax / aspect
} else {
}else {
dst_h = pixelMax
dst_w = pixelMax * aspect
}