Skip to content

Commit

Permalink
(Mastodon 2.8.0)blocked_byの表示。(Misskey)svgカスタム絵文字のエラー処理を改善。
Browse files Browse the repository at this point in the history
  • Loading branch information
tateisu committed Mar 26, 2019
1 parent 6b9bba8 commit 8ec02c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -330,14 +331,19 @@ 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
val dst_h : Float
if(aspect >= 1f) {
dst_w = pixelMax
dst_h = pixelMax / aspect
} else {
}else {
dst_h = pixelMax
dst_w = pixelMax * aspect
}
Expand Down

0 comments on commit 8ec02c8

Please sign in to comment.