Misskeyのフォローリクエスト承認通知に対応。選択してコピーに「_fromStream」の情報を追加。AccountRefのキーにMisskeyの取得ホストが欠けていた問題を修正

This commit is contained in:
tateisu 2020-02-16 17:13:11 +09:00
parent 24a64054dd
commit 03115d796c
13 changed files with 144 additions and 101 deletions

View File

@ -1570,7 +1570,8 @@ class Column(
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_UNFOLLOW,
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> dont_show_follow
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> dont_show_follow
TootNotification.TYPE_MENTION,
TootNotification.TYPE_REPLY -> dont_show_reply
@ -1578,7 +1579,8 @@ class Column(
TootNotification.TYPE_REACTION -> dont_show_reaction
TootNotification.TYPE_VOTE,
TootNotification.TYPE_POLL -> dont_show_vote
TootNotification.TYPE_POLL,
TootNotification.TYPE_POLL_VOTE_MISSKEY -> dont_show_vote
else -> false
}
@ -1591,13 +1593,16 @@ class Column(
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_UNFOLLOW,
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> quick_filter != QUICK_FILTER_FOLLOW
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY ,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> quick_filter != QUICK_FILTER_FOLLOW
TootNotification.TYPE_MENTION,
TootNotification.TYPE_REPLY -> quick_filter != QUICK_FILTER_MENTION
TootNotification.TYPE_REACTION -> quick_filter != QUICK_FILTER_REACTION
TootNotification.TYPE_VOTE,
TootNotification.TYPE_POLL -> quick_filter != QUICK_FILTER_VOTE
TootNotification.TYPE_POLL,
TootNotification.TYPE_POLL_VOTE_MISSKEY -> quick_filter != QUICK_FILTER_VOTE
else -> true
}
}) {
@ -1630,10 +1635,10 @@ class Column(
TootNotification.TYPE_QUOTE,
TootNotification.TYPE_FAVOURITE,
TootNotification.TYPE_REACTION,
TootNotification.TYPE_VOTE,
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> {
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> {
val who = item.account
if(who != null && favMuteSet?.contains(access_info.getFullAcct(who)) == true) {
log.d("%s is in favMuteSet.", access_info.getFullAcct(who))

View File

@ -1706,7 +1706,8 @@ class ColumnViewHolder(
}
tvColumnName = textView {
// Kannada語の "ಸ್ಥಳೀಯ ಟೈಮ್ ಲೈನ್" の上下が途切れることがあるらしい
// GS10+では再現しなかった
}.lparams(dip(0), wrapContent) {
weight = 1f
}

View File

@ -575,7 +575,7 @@ internal class ItemViewHolder(
val whoRef = TootAccountRef(TootParser(activity, access_info), who)
this.status_account = whoRef
setAcct(tvAcct, access_info,who)
setAcct(tvAcct, access_info, who)
tvName.text = whoRef.decoded_display_name
name_invalidator.register(whoRef.decoded_display_name)
@ -927,7 +927,43 @@ internal class ItemViewHolder(
}
}
TootNotification.TYPE_VOTE -> {
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> {
val colorBg = Pref.ipEventBgColorFollowRequest(activity.pref)
if(n_account != null) {
showBoost(
n_accountRef,
n.time_created_at,
R.drawable.ic_follow_wait,
R.string.display_name_follow_request_by
)
if(colorBg != 0) this.viewRoot.backgroundColor = colorBg
boostedAction = {
activity.addColumn(
activity.nextPosition(column)
, access_info
, ColumnType.FOLLOW_REQUESTS
)
}
}
}
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> {
val colorBg = Pref.ipEventBgColorFollow(activity.pref)
if(n_account != null) {
showBoost(
n_accountRef,
n.time_created_at,
R.drawable.ic_follow_plus,
R.string.display_name_follow_request_accepted_by
)
showAccount(n_accountRef)
if(colorBg != 0) this.viewRoot.backgroundColor = colorBg
}
}
TootNotification.TYPE_VOTE,
TootNotification.TYPE_POLL_VOTE_MISSKEY -> {
val colorBg = Pref.ipEventBgColorVote(activity.pref)
if(n_account != null) showBoost(
n_accountRef,
@ -940,25 +976,6 @@ internal class ItemViewHolder(
}
}
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> {
val colorBg = Pref.ipEventBgColorFollowRequest(activity.pref)
if(n_account != null) showBoost(
n_accountRef,
n.time_created_at,
R.drawable.ic_follow_wait,
R.string.display_name_follow_request_by
)
viewRoot.backgroundColor = colorBg
boostedAction = {
activity.addColumn(
activity.nextPosition(column)
, access_info
, ColumnType.FOLLOW_REQUESTS
)
}
}
TootNotification.TYPE_POLL -> {
val colorBg = 0
if(n_account != null) showBoost(
@ -1089,7 +1106,7 @@ internal class ItemViewHolder(
private fun showReply(reply : TootStatus, accountId : EntityId) {
val name = if(accountId == reply.account.id) {
// 自己レスなら
AcctColor.getNicknameWithColor(access_info,reply.account)
AcctColor.getNicknameWithColor(access_info, reply.account)
} else {
val m = reply.mentions?.find { it.id == accountId }
if(m != null) {
@ -1117,13 +1134,9 @@ internal class ItemViewHolder(
boost_account = whoRef
val who = whoRef.get()
val text : Spannable = if(string_id == R.string.display_name_followed_by) {
// フォローの場合 decoded_display_name が2箇所で表示に使われるのを避ける必要がある
who.decodeDisplayName(activity)
} else {
// それ以外の場合は decoded_display_name を再利用して構わない
whoRef.decoded_display_name
}.intoStringResource(activity, string_id)
// フォローの場合 decoded_display_name が2箇所で表示に使われるのを避ける必要がある
val text : Spannable =who.decodeDisplayName(activity)
.intoStringResource(activity, string_id)
val emojiResource = misskeyReaction?.emojiResource
if(emojiResource != null) {
@ -1144,7 +1157,7 @@ internal class ItemViewHolder(
showStatusTime(activity, tvBoostedTime, who, time = time, status = boost_status)
tvBoosted.text = text
boost_invalidator.register(text)
setAcct(tvBoostedAcct, access_info,who)
setAcct(tvBoostedAcct, access_info, who)
}
private fun showAccount(whoRef : TootAccountRef) {
@ -1162,7 +1175,7 @@ internal class ItemViewHolder(
tvFollowerName.text = whoRef.decoded_display_name
follow_invalidator.register(whoRef.decoded_display_name)
setAcct(tvFollowerAcct, access_info,who)
setAcct(tvFollowerAcct, access_info, who)
who.setAccountExtra(access_info, tvLastStatusAt, lastActive_invalidator)
@ -1231,7 +1244,7 @@ internal class ItemViewHolder(
val who = whoRef.get()
this.status_account = whoRef
setAcct(tvAcct, access_info,who)
setAcct(tvAcct, access_info, who)
// if(who == null) {
// tvName.text = "?"
@ -1623,8 +1636,8 @@ internal class ItemViewHolder(
// }
// }
private fun setAcct(tv : TextView,accessInfo:SavedAccount,who:TootAccount) {
val ac = AcctColor.load(accessInfo,who)
private fun setAcct(tv : TextView, accessInfo : SavedAccount, who : TootAccount) {
val ac = AcctColor.load(accessInfo, who)
tv.text = when {
AcctColor.hasNickname(ac) -> ac.nickname
Pref.bpShortAcctLocalUser(App1.pref) -> "@${who.acct.pretty}"
@ -1767,10 +1780,10 @@ internal class ItemViewHolder(
when(v) {
btnHideMedia, btnCardImageHide -> {
fun hideViews(){
fun hideViews() {
llMedia.visibility = View.GONE
btnShowMedia.visibility = View.VISIBLE
llCardImage.visibility =View.GONE
llCardImage.visibility = View.GONE
btnCardImageShow.visibility = View.VISIBLE
}
status_showing?.let { status ->
@ -1784,10 +1797,10 @@ internal class ItemViewHolder(
}
btnShowMedia, btnCardImageShow -> {
fun showViews(){
fun showViews() {
llMedia.visibility = View.VISIBLE
btnShowMedia.visibility = View.GONE
llCardImage.visibility =View.VISIBLE
llCardImage.visibility = View.VISIBLE
btnCardImageShow.visibility = View.GONE
}
status_showing?.let { status ->
@ -1887,7 +1900,12 @@ internal class ItemViewHolder(
is TootDomainBlock -> {
AlertDialog.Builder(activity)
.setMessage(activity.getString(R.string.confirm_unblock_domain, item.domain.pretty))
.setMessage(
activity.getString(
R.string.confirm_unblock_domain,
item.domain.pretty
)
)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.ok) { _, _ ->
Action_Instance.blockDomain(
@ -1957,7 +1975,7 @@ internal class ItemViewHolder(
activity,
activity.getString(
R.string.follow_accept_confirm,
AcctColor.getNickname(access_info,who)
AcctColor.getNickname(access_info, who)
)
) {
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, true)
@ -1970,7 +1988,7 @@ internal class ItemViewHolder(
activity,
activity.getString(
R.string.follow_deny_confirm,
AcctColor.getNickname(access_info,who)
AcctColor.getNickname(access_info, who)
)
) {
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, false)
@ -2262,11 +2280,11 @@ internal class ItemViewHolder(
}
val image = card.image
if(flCardImage.vg(image?.isNotEmpty()==true) !=null) {
if(flCardImage.vg(image?.isNotEmpty() == true) != null) {
flCardImage.layoutParams.height = if(card.originalStatus!=null){
flCardImage.layoutParams.height = if(card.originalStatus != null) {
activity.avatarIconSize
}else{
} else {
activity.app_state.media_thumb_height
}
@ -2424,7 +2442,7 @@ internal class ItemViewHolder(
R.drawable.btn_bg_transparent_round6dp
)
// TODO 自分がリアクションしたやつは背景を変える
setTextColor(content_color)
setPadding(paddingH, paddingV, paddingH, paddingV)
setOnClickListener {
@ -3168,7 +3186,8 @@ internal class ItemViewHolder(
llFollow = linearLayout {
lparams(matchParent, wrapContent)
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
gravity = Gravity.CENTER_VERTICAL
ivFollow = myNetworkImageView {
@ -3208,7 +3227,10 @@ internal class ItemViewHolder(
btnFollow = imageButton {
background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
ContextCompat.getDrawable(
context,
R.drawable.btn_bg_transparent_round6dp
)
contentDescription = context.getString(R.string.follow)
scaleType = ImageView.ScaleType.CENTER
// tools:src="?attr/ic_follow_plus"
@ -3255,7 +3277,10 @@ internal class ItemViewHolder(
ivThumbnail = myNetworkImageView {
background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
ContextCompat.getDrawable(
context,
R.drawable.btn_bg_transparent_round6dp
)
contentDescription = context.getString(R.string.thumbnail)
scaleType = ImageView.ScaleType.CENTER_CROP
}.lparams(dip(48), dip(48)) {
@ -3708,7 +3733,8 @@ internal class ItemViewHolder(
lparams(matchParent, wrapContent)
gravity = Gravity.CENTER_VERTICAL
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
verticalLayout {
lparams(0, wrapContent) {

View File

@ -1569,15 +1569,16 @@ class PollingWorker private constructor(contextArg : Context) {
TootNotification.TYPE_REACTION ->
"- " + context.getString(R.string.display_name_reaction_by, name)
TootNotification.TYPE_VOTE ->
TootNotification.TYPE_VOTE,
TootNotification.TYPE_POLL_VOTE_MISSKEY ->
"- " + context.getString(R.string.display_name_voted_by, name)
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY ->
"- " + context.getString(
R.string.display_name_follow_request_by,
name
)
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY->
"- " + context.getString( R.string.display_name_follow_request_by, name )
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY ->
"- " + context.getString( R.string.display_name_follow_request_accepted_by, name )
TootNotification.TYPE_POLL ->
"- " + context.getString(R.string.end_of_polling_from, name)

View File

@ -55,8 +55,7 @@ internal class StreamReader(
internal val bListening = AtomicBoolean()
internal val socket = AtomicReference<WebSocket>(null)
internal val callback_list = LinkedList<StreamCallback>()
internal val parser : TootParser =
TootParser(context, access_info, highlightTrie = highlight_trie)
internal val parser : TootParser = TootParser(context, access_info, highlightTrie = highlight_trie,fromStream=true)
internal fun dispose() {
bDisposed.set(true)
@ -184,13 +183,15 @@ internal class StreamReader(
private fun handleMisskeyMessage(obj : JsonObject, channelId : String? = null) {
val type = obj.string("type")
if(type?.isEmpty() != false) {
log.d("handleMisskeyMessage: missing type parameter")
return
}
when(type) {
when( type){
null,"" -> {
log.d("handleMisskeyMessage: missing type parameter")
return
}
"channel" -> {
// ストリーミングのchannelイベントにチャネルIDが含まれない場合がある
// https://github.com/syuilo/misskey/issues/4801
val body = obj.jsonObject("body")
if(body == null) {
log.e("handleMisskeyMessage: channel body is null")
@ -200,31 +201,22 @@ internal class StreamReader(
// ストリーミングのchannelイベントにチャネルIDが含まれない場合がある
// https://github.com/syuilo/misskey/issues/4801
handleMisskeyMessage(body, id)
return
}
"readAllNotifications" -> {
// nothing to do
}
// Misskey 11ではこれらのメッセージの形式が違う
"followed", "renote", "mention", "meUpdated", "follow", "unfollow" -> {
// 通知IDも日時もないイベントを受け取っても通知TLに反映させられないから無視するしかない
// https://github.com/syuilo/misskey/issues/4802
"followed", "renote", "mention", "meUpdated", "follow", "unfollow"-> return
// {"id":"15","type":"followed","body":{"id":"7rm8yhnvzd","name":null,"username":"tateisu_test2","host":null,"avatarUrl":"https:\/\/misskey.io\/avatar\/7rm8yhnvzd","avatarColor":null,"emojis":[]}}
// {"id":"15","type":"renote","body":{"id":"7s063vasr4","createdAt":"2019-04-25T12:08:32.308Z","userId":"7rm8yhnvzd","user":{"id":"7rm8yhnvzd","name":null,"username":"tateisu_test2","host":null,"avatarUrl":"https://misskey.io/avatar/7rm8yhnvzd","avatarColor":null,"emojis":[]},"text":null,"cw":null,"visibility":"home","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":"7s04q1lagw","renote":{"id":"7s04q1lagw","createdAt":"2019-04-25T11:29:47.662Z","userId":"7rm6y6thc1","user":{"id":"7rm6y6thc1","name":null,"username":"tateisu","host":null,"avatarUrl":"https://pdg1.arkjp.net/misskey/drive/19c55428-7e2d-4050-86c4-39aa20bef593.jpg","avatarColor":"rgba(203,205,189,0)","emojis":[]},"text":"リストTLやタグTLのストリーミングチャネルはないんだろうか #MisskeyApi","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null}}}}
// {"id":"15","type":"mention","body":{"id":"7s067jr5jq","createdAt":"2019-04-25T12:11:23.969Z","userId":"7rm8yhnvzd","user":{"id":"7rm8yhnvzd","name":null,"username":"tateisu_test2","host":null,"avatarUrl":"https://misskey.io/avatar/7rm8yhnvzd","avatarColor":null,"emojis":[]},"text":"test","cw":null,"visibility":"home","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":"7s04q1lagw","renoteId":null,"mentions":["7rm6y6thc1"],"reply":{"id":"7s04q1lagw","createdAt":"2019-04-25T11:29:47.662Z","userId":"7rm6y6thc1","user":{"id":"7rm6y6thc1","name":null,"username":"tateisu","host":null,"avatarUrl":"https://pdg1.arkjp.net/misskey/drive/19c55428-7e2d-4050-86c4-39aa20bef593.jpg","avatarColor":"rgba(203,205,189,0)","emojis":[]},"text":"リストTLやタグTLのストリーミングチャネルはないんだろうか #MisskeyApi","cw":null,"visibility":"public","renoteCount":1,"repliesCount":1,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null}}}}
//
// {"type":"channel","body":{"id":"15","type":"mention","body":{"id":"7s067jr5jq","createdAt":"2019-04-25T12:11:23.969Z","userId":"7rm8yhnvzd","user":{"id":"7rm8yhnvzd","name":null,"username":"tateisu_test2","host":null,"avatarUrl":"https:\/\/misskey.io\/avatar\/7rm8yhnvzd","avatarColor":null,"emojis":[]},"text":"test","cw":null,"visibility":"home","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":"7s04q1lagw","renoteId":null,"mentions":["7rm6y6thc1"],"reply":{"id":"7s04q1lagw","createdAt":"2019-04-25T11:29:47.662Z","userId":"7rm6y6thc1","user":{"id":"7rm6y6thc1","name":null,"username":"tateisu","host":null,"avatarUrl":"https:\/\/pdg1.arkjp.net\/misskey\/drive\/19c55428-7e2d-4050-86c4-39aa20bef593.jpg","avatarColor":"rgba(203,205,189,0)","emojis":[]},"text":"リストTLやタグTLのストリーミングチャネルはないんだろうか #MisskeyApi","cw":null,"visibility":"public","renoteCount":1,"repliesCount":1,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null}}}}
// {"type":"channel","body":{"id":"15","type":"meUpdated","body":{"id":"7rm6y6thc1","name":null,"username":"tateisu","host":null,"avatarUrl":"https://pdg1.arkjp.net/misskey/drive/19c55428-7e2d-4050-86c4-39aa20bef593.jpg","avatarColor":"rgba(203,205,189,0)","isAdmin":false,"isBot":false,"isCat":false,"isVerified":false,"emojis":[],"url":null,"createdAt":"2019-04-15T17:23:20.453Z","updatedAt":"2019-04-25T12:07:41.334Z","bannerUrl":null,"bannerColor":null,"isLocked":false,"isModerator":false,"description":"がうがう","location":null,"birthday":null,"followersCount":14,"followingCount":10,"notesCount":65,"pinnedNoteIds":[],"pinnedNotes":[],"avatarId":"7rm8fefuft","bannerId":null,"autoWatch":false,"alwaysMarkNsfw":false,"carefulBot":false,"twoFactorEnabled":false,"hasUnreadMessagingMessage":false,"hasUnreadNotification":false,"pendingReceivedFollowRequestsCount":0,"clientData":{},"email":null,"emailVerified":false}}}
// {"type":"channel","body":{"id":"15","type":"unfollow","body":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isAdmin":false,"isBot":true,"isCat":false,"isVerified":false,"emojis":[],"url":"https://friends.nico/@vandojpn","createdAt":"2019-04-15T11:44:21.907Z","updatedAt":"2019-04-25T12:13:59.839Z","bannerUrl":"https://pdg1.arkjp.net/misskey/drive/a091e3ef-e1b8-4460-bdd9-f47ea2e9f9f2.jpeg","bannerColor":"rgba(135,128,127,0)","isLocked":false,"isModerator":false,"description":"居場所亡くなったので\n移住先候補\n@vandojpn@mstdn.jp\n@vando@misskey.io","location":null,"birthday":null,"followersCount":2,"followingCount":0,"notesCount":353,"pinnedNoteIds":["7il4rez4b9","7qw3bj7kb0","7qw3cvtkbr","7qxtyp609n","7qyuxfswax"],"pinnedNotes":[{"id":"7il4rez4b9","createdAt":"2018-08-31T05:36:58.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"†┏┛:@vandojpn:┗┓†","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/100643230103007331"},{"id":"7qw3bj7kb0","createdAt":"2019-03-28T10:59:44.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"まさらっき、ハト先生、2年間お疲れ様。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827922107489261"},{"id":"7qw3cvtkbr","createdAt":"2019-03-28T11:00:47.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"引越し先はこちらです。みんなフォロしてね!\n\nhttps://misskey.xyz/@vando","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827926245185143"},{"id":"7qxtyp609n","createdAt":"2019-03-29T16:13:21.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"Thank you and Good bye friends.nico for 2 years.\nfriends.nico はみんなの心の中に。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101834817646842776"},{"id":"7qyuxfswax","createdAt":"2019-03-30T09:28:08.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"二コフレ終了の移住先候補\n\nhttps://misskey.xyz/@vando\n\nhttps://mstdn.jp/@vandojpn\n\n艦これ https://kancolle.social/@vando\n\nTwitter https://twitter.com/vajpn\n\n#theboss_tech \n#クロス\n#friends_nico","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101838886557246239"}],"isFollowing":true,"isFollowed":false,"hasPendingFollowRequestFromYou":false,"hasPendingFollowRequestToYou":false,"isBlocking":false,"isBlocked":false,"isMuted":false}}}
// {"type":"channel","body":{"id":"15","type":"follow","body":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isAdmin":false,"isBot":true,"isCat":false,"isVerified":false,"emojis":[],"url":"https://friends.nico/@vandojpn","createdAt":"2019-04-15T11:44:21.907Z","updatedAt":"2019-04-25T12:13:59.839Z","bannerUrl":"https://pdg1.arkjp.net/misskey/drive/a091e3ef-e1b8-4460-bdd9-f47ea2e9f9f2.jpeg","bannerColor":"rgba(135,128,127,0)","isLocked":false,"isModerator":false,"description":"居場所亡くなったので\n移住先候補\n@vandojpn@mstdn.jp\n@vando@misskey.io","location":null,"birthday":null,"followersCount":1,"followingCount":0,"notesCount":353,"pinnedNoteIds":["7il4rez4b9","7qw3bj7kb0","7qw3cvtkbr","7qxtyp609n","7qyuxfswax"],"pinnedNotes":[{"id":"7il4rez4b9","createdAt":"2018-08-31T05:36:58.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"†┏┛:@vandojpn:┗┓†","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/100643230103007331"},{"id":"7qw3bj7kb0","createdAt":"2019-03-28T10:59:44.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"まさらっき、ハト先生、2年間お疲れ様。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827922107489261"},{"id":"7qw3cvtkbr","createdAt":"2019-03-28T11:00:47.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"引越し先はこちらです。みんなフォロしてね!\n\nhttps://misskey.xyz/@vando","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827926245185143"},{"id":"7qxtyp609n","createdAt":"2019-03-29T16:13:21.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"Thank you and Good bye friends.nico for 2 years.\nfriends.nico はみんなの心の中に。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101834817646842776"},{"id":"7qyuxfswax","createdAt":"2019-03-30T09:28:08.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"二コフレ終了の移住先候補\n\nhttps://misskey.xyz/@vando\n\nhttps://mstdn.jp/@vandojpn\n\n艦これ https://kancolle.social/@vando\n\nTwitter https://twitter.com/vajpn\n\n#theboss_tech \n#クロス\n#friends_nico","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101838886557246239"}],"isFollowing":true,"isFollowed":false,"hasPendingFollowRequestFromYou":false,"hasPendingFollowRequestToYou":false,"isBlocking":false,"isBlocked":false,"isMuted":false}}}
//
// {"type":"channel","body":{"id":"15","type":"follow","body":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isAdmin":false,"isBot":true,"isCat":false,"isVerified":false,"emojis":[],"url":"https://friends.nico/@vandojpn","createdAt":"2019-04-15T11:44:21.907Z","updatedAt":"2019-04-25T12:13:59.839Z","bannerUrl":"https://pdg1.arkjp.net/misskey/drive/a091e3ef-e1b8-4460-bdd9-f47ea2e9f9f2.jpeg","bannerColor":"rgba(135,128,127,0)","isLocked":false,"isModerator":false,"description":"居場所亡くなったので\n移住先候補\n@vandojpn@mstdn.jp\n@vando@misskey.io","location":null,"birthday":null,"followersCount":1,"followingCount":0,"notesCount":353,"pinnedNoteIds":["7il4rez4b9","7qw3bj7kb0","7qw3cvtkbr","7qxtyp609n","7qyuxfswax"],"pinnedNotes":[{"id":"7il4rez4b9","createdAt":"2018-08-31T05:36:58.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"†┏┛:@vandojpn:┗┓†","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/100643230103007331"},{"id":"7qw3bj7kb0","createdAt":"2019-03-28T10:59:44.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"まさらっき、ハト先生、2年間お疲れ様。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827922107489261"},{"id":"7qw3cvtkbr","createdAt":"2019-03-28T11:00:47.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"引越し先はこちらです。みんなフォロしてね!\n\nhttps://misskey.xyz/@vando","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101827926245185143"},{"id":"7qxtyp609n","createdAt":"2019-03-29T16:13:21.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"Thank you and Good bye friends.nico for 2 years.\nfriends.nico はみんなの心の中に。","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101834817646842776"},{"id":"7qyuxfswax","createdAt":"2019-03-30T09:28:08.000Z","userId":"7rluu9hv8h","user":{"id":"7rluu9hv8h","name":"(しむ)‮しむしむ","username":"vandojpn","host":"friends.nico","avatarUrl":"https://pdg1.arkjp.net/misskey/drive/98d731b3-ce32-48d4-b348-befd75106224.jpeg","avatarColor":"rgba(118,88,69,0)","isBot":true,"emojis":[]},"text":"二コフレ終了の移住先候補\n\nhttps://misskey.xyz/@vando\n\nhttps://mstdn.jp/@vandojpn\n\n艦これ https://kancolle.social/@vando\n\nTwitter https://twitter.com/vajpn\n\n#theboss_tech \n#クロス\n#friends_nico","cw":null,"visibility":"public","renoteCount":0,"repliesCount":0,"reactions":{},"emojis":[],"fileIds":[],"files":[],"replyId":null,"renoteId":null,"uri":"https://friends.nico/users/vandojpn/statuses/101838886557246239"}],"isFollowing":true,"isFollowed":false,"hasPendingFollowRequestFromYou":false,"hasPendingFollowRequestToYou":false,"isBlocking":false,"isBlocked":false,"isMuted":false}}}
// {"type":"noteUpdated","body":{"id":"7s06kfbynh","type":"reacted","body":{"reaction":"pudding","userId":"7rm8yhnvzd"}}}
// 通知IDも日時もないイベントを受け取っても通知TLに反映させられないから無視するしかない
// https://github.com/syuilo/misskey/issues/4802
}
// 特にすることはない
"readAllNotifications",
"readAllUnreadMentions",
"readAllUnreadSpecifiedNotes" -> return
}
when(type) {
"note" -> {
val body = obj.jsonObject("body")
fireTimelineItem(parser.status(body), channelId)
@ -245,6 +237,7 @@ internal class StreamReader(
log.e("handleMisskeyMessage: notification body is null")
return
}
log.d("misskey notification: ${parser.accessHost} ${body}")
fireTimelineItem(parser.notification(body), channelId)
}

View File

@ -4,6 +4,7 @@ import jp.juggler.subwaytooter.api.entity.Acct
import jp.juggler.subwaytooter.api.entity.ServiceType
import jp.juggler.subwaytooter.api.entity.TootAccount
import jp.juggler.subwaytooter.api.entity.TootAccountRef
import jp.juggler.util.notZero
import java.util.concurrent.ConcurrentHashMap
object TootAccountMap{
@ -17,9 +18,9 @@ object TootAccountMap{
this.watcher =when(parser.serviceType){
ServiceType.MASTODON -> requireNotNull(parser.accessHost?.ascii)
ServiceType.MISSKEY -> requireNotNull(parser.accessHost?.ascii)
ServiceType.TOOTSEARCH -> "?tootsearch"
ServiceType.MSP -> "?msp"
ServiceType.MISSKEY -> "?misskey"
}
}
@ -33,13 +34,11 @@ object TootAccountMap{
}
override fun compareTo(other : AccountUniqueKey) : Int {
val i1 = acct.compareTo(other.acct)
if(i1 != 0) return i1
return watcher.compareTo(other.watcher)
return acct.compareTo(other.acct).notZero() ?: watcher.compareTo(other.watcher)
}
override fun hashCode() : Int {
val x = 961L + acct.hashCode().toLong() * 31L + watcher.hashCode()
val x = acct.hashCode().toLong() * 31L + watcher.hashCode().toLong() + 961L
return (x and 0x7fffffffL).toInt()
}
}

View File

@ -16,7 +16,8 @@ class TootParser(
var pinned : Boolean = false, // プロフィールカラムからpinned TL を読んだ時だけ真
var highlightTrie : WordTrieTree? = null,
var serviceType : ServiceType = ServiceType.MASTODON,
var misskeyDecodeProfilePin : Boolean = false
var misskeyDecodeProfilePin : Boolean = false,
var fromStream : Boolean = false
) {
val misskeyUserRelationMap = HashMap<EntityId, UserRelation>()

View File

@ -123,6 +123,7 @@ open class TootAccount(parser : TootParser, src : JsonObject) {
init {
this.json = src
src.put("_fromStream",parser.fromStream)
if(parser.serviceType == ServiceType.MISSKEY) {

View File

@ -29,6 +29,9 @@ class TootNotification(parser : TootParser, src : JsonObject) : TimelineItem() {
const val TYPE_FOLLOW_REQUEST = "follow_request"
const val TYPE_FOLLOW_REQUEST_MISSKEY = "receiveFollowRequest"
const val TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY = "followRequestAccepted"
const val TYPE_POLL_VOTE_MISSKEY = "pollVote"
// 投票
const val TYPE_VOTE = "poll_vote"
@ -62,8 +65,15 @@ class TootNotification(parser : TootParser, src : JsonObject) : TimelineItem() {
created_at = src.string("createdAt")
time_created_at = TootStatus.parseTime(created_at)
accountRef = TootAccountRef.mayNull(parser, parser.account(src.jsonObject("user")))
status = parser.status(src.jsonObject("note"))
accountRef = TootAccountRef.mayNull(
parser,
parser.account(
src.jsonObject("user")
)
)
status = parser.status(
src.jsonObject("note")
)
reaction = src.string("reaction")

View File

@ -195,6 +195,7 @@ class TootStatus(parser : TootParser, src : JsonObject) : TimelineItem() {
init {
this.json = src
this.serviceType = parser.serviceType
src.put("_fromStream",parser.fromStream)
if(parser.serviceType == ServiceType.MISSKEY) {
val instance = parser.accessHost

View File

@ -973,11 +973,14 @@ class SavedAccount(
TootNotification.TYPE_UNFOLLOW -> notification_follow
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY -> notification_follow_request
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY -> notification_follow_request
TootNotification.TYPE_REACTION -> notification_reaction
TootNotification.TYPE_VOTE, TootNotification.TYPE_POLL -> notification_vote
TootNotification.TYPE_VOTE,
TootNotification.TYPE_POLL,
TootNotification.TYPE_POLL_VOTE_MISSKEY -> notification_vote
else -> false
}

View File

@ -203,6 +203,7 @@
<string name="display_name_boosted_by">%1$sがブーストしました</string>
<string name="display_name_favourited_by">%1$sがお気に入りに追加しました</string>
<string name="display_name_follow_request_by">%1$sがフォローリクエストを申請しました</string>
<string name="display_name_follow_request_accepted_by">%1$sがあなたのフォローリクエストを承認しました</string>
<string name="display_name_followed_by">%1$sにフォローされました</string>
<string name="display_name_quoted_by">%1$sが引用しました</string>
<string name="display_name_reaction_by">%1$sがリアクション</string>
@ -352,7 +353,7 @@
<string name="hide_media_default">全ての画像を隠す</string>
<string name="highlight_desc">フリックで削除。登録内容を反映するにはカラムのリロードが必要です</string>
<string name="highlight_word">強調表示する単語</string>
<string name="home">ホーム</string>
<string name="home">ホーム</string><!-- ಸ್ಥಳೀಯ ಟೈಮ್ ಲೈನ್ -->
<string name="ignore_suggestion">提案を無視</string>
<string name="image">画像</string>
<string name="image_alpha">画像の不透明度</string>

View File

@ -88,6 +88,7 @@
<string name="display_name_mentioned_by">%1$s mentioned</string>
<string name="display_name_voted_by">%1$s voted</string>
<string name="display_name_follow_request_by">%1$s sent follow request</string>
<string name="display_name_follow_request_accepted_by">%1$s accepted your follow request</string>
<string name="display_name_quoted_by">%1$s quoted</string>
<string name="display_name_reaction_by">%1$s reactioned</string>
<string name="display_name_followed_by">%1$s is following you</string>