famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
49 stars 31 forks source link

Message status doesn't reflect sending status correctly #1826

Open PhantomRay opened 1 month ago

PhantomRay commented 1 month ago

Checklist

In which Project did the bug appear?

Other

If you selected \"Other\" as Project, please enter in which project the bug occurred.

No response

On which platform did the bug appear?

Android, iOS

SDK Version

0.29.x

Describe the problem caused by this bug

Before 0.29, after sending a message successfully, the statuses for events received are 0 and 1. After 0.29, the first event has a status of -1, then the subsequent events have 0, then 1.

Before 0.29, after sending a message unsuccessfully (e.g. turn off network), the statuses for events received are 0 and -1. After 0.29, the first event has a status of 0, then the subsequent event has -2.

According to the value, -2 means MessageStatus.removed, which doesn't make sense.

Steps To Reproduce

No response

Screenshots or Logs

Events after message successfully sent

{
    "type": "EventUpdateType.timeline",
    "roomId": "!crcyDnInTUsdakvAZX:myserver.com",
    "content": {
        "type": "m.room.message",
        "content": {
            "msgtype": "m.text",
            "body": "wer"
        },
        "sender": "@sz0vte84wzk:myserver.com",
        "event_id": "clientName-1-1716424404530",
        "origin_server_ts": 1716424404616,
        "unsigned": {
            "com.famedly.famedlysdk.message_sending_status": -1,
            "transaction_id": "clientName-1-1716424404530"
        },
        "status": -1
    }
}
{
    "type": "EventUpdateType.timeline",
    "roomId": "!crcyDnInTUsdakvAZX:myserver.com",
    "content": {
        "type": "m.room.message",
        "content": {
            "msgtype": "m.text",
            "body": "wer"
        },
        "sender": "@sz0vte84wzk:myserver.com",
        "event_id": "$Luk6_MRdCPmyeUobITjbGI7p_SeiXxuSC7ICXfixP_M",
        "origin_server_ts": 1716424404616,
        "unsigned": {
            "com.famedly.famedlysdk.message_sending_status": 0,
            "transaction_id": "clientName-1-1716424404530"
        },
        "status": 0
    }
}
{
    "type": "EventUpdateType.timeline",
    "roomId": "!crcyDnInTUsdakvAZX:myserver.com",
    "content": {
        "type": "m.room.message",
        "content": {
            "msgtype": "m.text",
            "body": "wer"
        },
        "sender": "@sz0vte84wzk:myserver.com",
        "event_id": "$Luk6_MRdCPmyeUobITjbGI7p_SeiXxuSC7ICXfixP_M",
        "origin_server_ts": 1716424405091,
        "unsigned": {
            "age": 136,
            "transaction_id": "clientName-1-1716424404530",
            "com.famedly.famedlysdk.message_sending_status": 1
        },
        "status": 1
    }
}

Events after message unsuccessfully sent

{
    "type": "EventUpdateType.timeline",
    "roomId": "!crcyDnInTUsdakvAZX:myserver.com",
    "content": {
        "type": "m.room.message",
        "content": {
            "msgtype": "m.text",
            "body": "feef"
        },
        "sender": "@sz0vte84wzk:myserver.com",
        "event_id": "clientName-2-1716424525638",
        "origin_server_ts": 1716424525663,
        "unsigned": {
            "com.famedly.famedlysdk.message_sending_status": -1,
            "transaction_id": "clientName-2-1716424525638"
        },
        "status": -1
    }
}
{
        "type": "EventUpdateType.timeline",
        "roomId": "!crcyDnInTUsdakvAZX:myserver.com",
        "content": {
            "type": "m.room.message",
            "content": {
                "msgtype": "m.text",
                "body": "feef"
            },
            "sender": "@sz0vte84wzk:myserver.com",
            "event_id": "clientName-2-1716424525638",
            "origin_server_ts": 1716424525663,
            "unsigned": {
                "com.famedly.famedlysdk.message_sending_status": -2,
                "transaction_id": "clientName-2-1716424525638"
            },
            "status": -2
        }
}

Security related

No response