pantasystem / Milktea

Misskey, MastodonのAndroidクライアント「Milktea」のソースコード
GNU General Public License v3.0
249 stars 22 forks source link

複数リアクション可能なデータ構造にする #1580

Closed pantasystem closed 1 year ago

pantasystem commented 1 year ago

概要

kmy.blueやPleromaは複数リアクションが可能な形式になっているので データ構造を複数リアクション可能な構造に変更したい。 また変更した際にMisskeyのノートキャプチャーと組み合わせた際の 挙動の変化などを調査していないので確認する必要性がある。

pantasystem commented 1 year ago

fedibird, kmy.blueは絵文字リアクション可能な件数は api/v1/instanceの configuration.emoji_reactions.max_reactions_per_accountを見れば良いようになっている

pantasystem commented 1 year ago

Pleromaの場合はよく分からない

pantasystem commented 1 year ago

Fedibird

{
    "id": "110111063880163483",
    "created_at": "2023-03-30T07:31:35.843Z",
    "in_reply_to_id": null,
    "in_reply_to_account_id": null,
    "sensitive": false,
    "spoiler_text": "",
    "visibility": "public",
    "language": "ja",
    "uri": "https://misskey.usbharu.dev/notes/9cyd34mbty",
    "url": "https://misskey.usbharu.dev/notes/9cyd34mbty",
    "replies_count": 0,
    "reblogs_count": 0,
    "favourites_count": 0,
    "emoji_reactions": [
        {
            "name": "blobcatpuffyfearful",
            "count": 1,
            "url": "https://s3.fedibird.com/custom_emojis/images/000/151/991/original/f4ed8a8ec6f21b9a.png",
            "static_url": "https://s3.fedibird.com/custom_emojis/images/000/151/991/static/f4ed8a8ec6f21b9a.png",
            "domain": null,
            "width": 128,
            "height": 128,
            "account_ids": [
                "106243276260829420"
            ],
            "me": true
        }
    ],
    "emoji_reactions_count": 1,
    "status_reference_ids": [],
    "status_references_count": 0,
    "status_referred_by_count": 0,
    "searchability": "direct",
    "favourited": false,
    "reblogged": false,
    "muted": false,
    "bookmarked": false,
    "emoji_reactioned": true,
    "content": "<p><span>ちくちく言葉判定AIの反乱</span></p>",
    "account": {
        "id": "109391735277996463",
        "username": "usbharu",
        "acct": "usbharu@misskey.usbharu.dev",
        "display_name": "usbharu",
        "locked": false,
        "bot": false,
        "cat": false,
        "discoverable": true,
        "group": false,
        "created_at": "2022-11-23T00:00:00.000Z",
        "note": "<p><span>JavaとKotlinとTypeScriptを完全に理解したい。<br><br>アイコンは自分で書いた東方Projectの古明地こいし<br><br></span><a href=\"https://misskey.usbharu.dev/tags/ガルパンはいいぞ\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">#ガルパンはいいぞ</a><span> 7</span></p>",
        "url": "https://misskey.usbharu.dev/@usbharu",
        "avatar": "https://s3.fedibird.com/cache/accounts/avatars/109/391/735/277/996/463/original/________2________2.png",
        "avatar_static": "https://s3.fedibird.com/cache/accounts/avatars/109/391/735/277/996/463/original/________2________2.png",
        "header": "https://fedibird.com/headers/original/missing.png",
        "header_static": "https://fedibird.com/headers/original/missing.png",
        "searchability": "direct",
        "followers_count": 26,
        "following_count": 34,
        "subscribing_count": 0,
        "statuses_count": 10119,
        "last_status_at": "2023-03-30",
        "emojis": [],
        "fields": [
            {
                "name": "Misskeyクライアントを作っています。",
                "value": "<a href=\"https://github.com/multim-dev/multim\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https://github.com/multim-dev/multim</a>",
                "verified_at": null
            }
        ],
        "other_settings": {
            "birthday": "2005-06-01",
            "location": "Shiga,Japan",
            "cat_ears_color": "#c1e1bd"
        }
    },
    "reblog": null,
    "quote": null,
    "application": {
        "name": "",
        "website": ""
    },
    "media_attachments": [],
    "mentions": [],
    "tags": [],
    "emojis": [],
    "card": null,
    "poll": null
}

Pleroma

{
    "created_at": "2023-03-30T07:28:17.000Z",
    "in_reply_to_account_id": null,
    "quote": null,
    "pinned": false,
    "media_attachments": [],
    "reblog": null,
    "url": "https://blob.cat/notice/AU8NdAHgnxfIb94rUO",
    "replies_count": 0,
    "sensitive": false,
    "id": "AU8NdAHgnxfIb94rUO",
    "language": null,
    "akkoma": {
        "source": {
            "content": "> framework laptops fucked up the motherboard clocl and wont fix it\r\n\r\n:ablobcatblink: a shitshow my favorite",
            "mediaType": "text/plain"
        }
    },
    "spoiler_text": "",
    "emoji_reactions": [
        {
            "account_ids": [
                "ASJA6gNzOgN2mDulg8"
            ],
            "count": 1,
            "me": true,
            "name": "ablobcatbongo",
            "url": "https://blob.cat/emoji/custom/blobcats/ablobcatbongo.png"
        },
        {
            "account_ids": [
                "ASJA6gNzOgN2mDulg8"
            ],
            "count": 1,
            "me": true,
            "name": "ablobcatattentionreverse",
            "url": "https://blob.cat/emoji/custom/blobcats/ablobcatattentionreverse.png"
        }
    ],
    "uri": "https://blob.cat/objects/0d549cef-657d-4916-9d2b-264903623770",
    "application": null,
    "poll": null,
    "tags": [],
    "quote_id": null,
    "reblogged": false,
    "in_reply_to_id": null,
    "edited_at": null,
    "reblogs_count": 0,
    "favourites_count": 1,
    "content": "&gt; framework laptops fucked up the motherboard clocl and wont fix it<br/><br/>:ablobcatblink: a shitshow my favorite",
    "bookmarked": false,
    "muted": false,
    "pleroma": {
        "content": {
            "text/plain": "> framework laptops fucked up the motherboard clocl and wont fix it:ablobcatblink: a shitshow my favorite"
        },
        "context": "https://blob.cat/contexts/a8b51d10-8d2e-4de7-8f02-f7d559d6a749",
        "conversation_id": 1857611836,
        "direct_conversation_id": null,
        "emoji_reactions": [
            {
                "account_ids": [
                    "ASJA6gNzOgN2mDulg8"
                ],
                "count": 1,
                "me": true,
                "name": "ablobcatbongo",
                "url": "https://blob.cat/emoji/custom/blobcats/ablobcatbongo.png"
            },
            {
                "account_ids": [
                    "ASJA6gNzOgN2mDulg8"
                ],
                "count": 1,
                "me": true,
                "name": "ablobcatattentionreverse",
                "url": "https://blob.cat/emoji/custom/blobcats/ablobcatattentionreverse.png"
            }
        ],
        "expires_at": null,
        "in_reply_to_account_acct": null,
        "local": true,
        "parent_visible": false,
        "pinned_at": null,
        "spoiler_text": {
            "text/plain": ""
        },
        "thread_muted": false
    },
    "text": null,
    "emojis": [
        {
            "shortcode": "ablobcatblink",
            "static_url": "https://blob.cat/emoji/custom/blobcats/ablobcatblink.png",
            "url": "https://blob.cat/emoji/custom/blobcats/ablobcatblink.png",
            "visible_in_picker": false
        }
    ],
    "card": null,
    "mentions": [],
    "visibility": "public",
    "favourited": false,
    "account": {
        "acct": "icedquinn",
        "avatar": "https://blob.cat/media/29281c2f555bd0d67d6e535cd5b3247ef2e84b2336505126b6e74c577c5810e4.png?name=blobcatquinn.png",
        "avatar_static": "https://blob.cat/media/29281c2f555bd0d67d6e535cd5b3247ef2e84b2336505126b6e74c577c5810e4.png?name=blobcatquinn.png",
        "bot": false,
        "created_at": "2019-12-31T00:49:49.000Z",
        "display_name": "<iced-quinn/>",
        "emojis": [],
        "fields": [
            {
                "name": "retrospring",
                "value": "<a href=\"https://retrospring.net/@IcedQuinn\" rel=\"ugc\">https://retrospring.net/@IcedQuinn</a>"
            },
            {
                "name": "e-mail & XMPP",
                "value": "icedquinn@iceworks.cc"
            },
            {
                "name": "gemini",
                "value": "gemini://iceworks.cc/z/"
            },
            {
                "name": "spare quinn",
                "value": "<a href=\"https://shitposter.club/users/icedquinn\" rel=\"ugc\">@icedquinn@shitposter.club</a>"
            },
            {
                "name": "crash pigeon",
                "value": "@icedquinn@fedi.absturtzau.be "
            },
            {
                "name": "OMEMO",
                "value": "C6CF13EC 762195C3 34536010 307C3F69 4371BF48 22CCC33D 2A3E37B6 F4C83620"
            }
        ],
        "followers_count": 1236,
        "following_count": 1079,
        "fqn": "icedquinn@blob.cat",
        "header": "https://blob.cat/media/11f7b522d142e7c7a2a647a080521827d1b451068c4439b177e64e4508882779.jpg?name=firefox_wp1jBI3lat.jpg",
        "header_static": "https://blob.cat/media/11f7b522d142e7c7a2a647a080521827d1b451068c4439b177e64e4508882779.jpg?name=firefox_wp1jBI3lat.jpg",
        "id": "9qVXCSdXLen6kEH4kq",
        "last_status_at": "2023-03-30T07:28:18",
        "locked": true,
        "note": "Read your fedi timeline in mutt: <a href=\"https://git.sr.ht/~icedquinn/pleromabox\">https://git.sr.ht/~icedquinn/pleromabox</a><br/><br/>local Nim stan. post-human. ploopy trackball enjoyer (thanks <span class=\"h-card\"><a class=\"u-url mention\" data-user=\"A9yRQV6ukbOcpbOAoC\" href=\"https://movsw.0x0.st/@mia\" rel=\"ugc\">@<span>mia@movsw.0x0.st</span></a></span>)<br/><br/>The ginger elf with the cold, dead heart.",
        "pleroma": {
            "also_known_as": [],
            "ap_id": "https://blob.cat/users/icedquinn",
            "background_image": null,
            "favicon": null,
            "hide_favorites": true,
            "hide_followers": true,
            "hide_followers_count": false,
            "hide_follows": true,
            "hide_follows_count": false,
            "is_admin": false,
            "is_confirmed": true,
            "is_moderator": false,
            "is_suggested": false,
            "relationship": {},
            "skip_thread_containment": false,
            "tags": []
        },
        "source": {
            "fields": [
                {
                    "name": "retrospring",
                    "value": "https://retrospring.net/@IcedQuinn"
                },
                {
                    "name": "e-mail & XMPP",
                    "value": "icedquinn@iceworks.cc"
                },
                {
                    "name": "gemini",
                    "value": "gemini://iceworks.cc/z/"
                },
                {
                    "name": "spare quinn",
                    "value": "@icedquinn@shitposter.club"
                },
                {
                    "name": "crash pigeon",
                    "value": "@icedquinn@fedi.absturtzau.be "
                },
                {
                    "name": "OMEMO",
                    "value": "C6CF13EC 762195C3 34536010 307C3F69 4371BF48 22CCC33D 2A3E37B6 F4C83620"
                }
            ],
            "note": "Read your fedi timeline in mutt: https://git.sr.ht/~icedquinn/pleromabox\n\nlocal Nim stan. post-human. ploopy trackball enjoyer (thanks @mia@movsw.0x0.st)\n\nThe ginger elf with the cold, dead heart.",
            "pleroma": {
                "actor_type": "Person",
                "discoverable": true
            },
            "sensitive": false
        },
        "statuses_count": 121208,
        "url": "https://blob.cat/users/icedquinn",
        "username": "icedquinn"
    }
}
pantasystem commented 1 year ago

基本的なStatusの構造は同じっぽいが送信時のフォーマットが違う模様

Fedibird

https://fedibird.com/api/v1/statuses/110111063880163483/emoji_reactions/blobcatpuffyfearful

Pleroma

https://blob.cat/api/v1/pleroma/statuses/AU8NdAHgnxfIb94rUO/reactions/:ablobcatattentionreverse:

pantasystem commented 1 year ago

複数リアクションのサポートをするようにしたものの リアクション追加ボタンの表示状態をどうすれば良いのかという問題がある

pantasystem commented 1 year ago

複数リアクションをサポートしてるケースの方が稀なので、 複数リアクションをサポートしているPleromaのサポートをする時に 一緒に対応してしまっても良いような気がする