GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.1k stars 254 forks source link

Sent SMS messages from phone appear twice #950

Open samhed opened 3 years ago

samhed commented 3 years ago

ATTENTION: GSConnect only supports the latest, stable version of GNOME. We are no longer accepting bug reports for previous versions.

Describe the bug

When I send a text message using my phone while connected to GSConnect, the text I sent appear twice in the GSConnect Messaging window. If I'm using GSConnect's Messaging to send the message, the message appears only once as expected.

Steps To Reproduce:

  1. Connect your Android phone using KDE Connect
  2. Send a text message using your phone
  3. Open GSConnect Messaging
  4. Notice that your sent message is displayed twice

Expected behavior

I expect the messages to be displayed only once.

Screenshots gsconnect_duplicate_texts

Support Log

GSConnect Version: 41
GSConnect Install: user
GJS: 16404
XDG_SESSION_TYPE: wayland
GDMSESSION: gnome
--------------------------------------------------------------------------------
Hint: You are currently not seeing messages from other users and the system.
      Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages.
      Pass -q to turn off this notice.
-- Logs begin at Tue 2020-05-26 02:22:26 CEST, end at Tue 2020-09-15 13:55:28 CEST. --
sep 15 13:54:09 systemd[2473]: dbus-:1.1-org.gnome.gedit@1.service: Succeeded.
sep 15 13:54:09 systemd[2473]: dbus-:1.1-org.gnome.gedit@1.service: Consumed 55.459s CPU time.
sep 15 13:54:42 gnome-shell[71476]: libinput error: client bug: timer event6 debounce: scheduled expiry is in the past (-8ms), your system is too slow
sep 15 13:54:42 gnome-shell[71476]: libinput error: client bug: timer event6 debounce short: scheduled expiry is in the past (-21ms), your system is too slow
sep 15 13:54:45 gnome-shell[71476]: ../clutter/clutter/clutter-actor.c:10556: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
sep 15 13:54:46 gnome-shell[71476]: ../clutter/clutter/clutter-actor.c:10556: The clutter_actor_set_allocation() function can only be called from within the implementation of the ClutterActor::allocate() virtual function.
sep 15 13:54:56 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:sendPacket:476]: Galaxy S10: {
                                                                "id": 1600170896380,
                                                                "type": "kdeconnect.contacts.request_all_uids_timestamps",
                                                                "body": {}
                                                              }
sep 15 13:54:56 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:sendPacket:476]: Galaxy S10: {
                                                                "id": 1600170896414,
                                                                "type": "kdeconnect.sms.request_conversations",
                                                                "body": {}
                                                              }
sep 15 13:54:56 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170895726,
                                                                "type": "kdeconnect.contacts.response_uids_timestamps",
                                                                "body": {
------------------------------------------------------- REMOVED CONTACTS ------------------------------------------------------------------
                                                                }
                                                              }
sep 15 13:54:57 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170896245,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
------------------------------------------------------- REMOVED SMS MESSAGES --------------------------------------------------------------
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:00 slack.desktop[71865]: [09/15/20, 13:55:00:766] info: [DND] (T06UU7DNW) Checking for changes in DND status for the following members: U0PLUFVJA,U2YGB077V,U0P17KJ0G,UHHLC4CCV,U0P0Z64H4,UKW4TGK46,UMV6G9SKW,U0P1TKQ30
sep 15 13:55:00 slack.desktop[71865]: [09/15/20, 13:55:00:768] info: [DND] (T06UU7DNW) Will check for changes in DND status again in 5 minutes
sep 15 13:55:09 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:sendPacket:476]: Galaxy S10: {
                                                                "id": 1600170909925,
                                                                "type": "kdeconnect.sms.request",
                                                                "body": {
                                                                  "sendSms": true,
                                                                  "phoneNumber": "+46707260865",
                                                                  "messageBody": "test send from GSConnect"
                                                                }
                                                              }
sep 15 13:55:11 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170910953,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:11 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170911146,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:12 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170911366,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:12 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170911574,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:12 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170911863,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:12 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170912222,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from GSConnect",
                                                                      "date": 1600170910639,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15592,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:13 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/protocol/lan.js:_onIdentity:342]: {
                                                                "id": 1600170913024,
                                                                "type": "kdeconnect.identity",
                                                                "body": {
                                                                  "deviceId": "c2f5d325cff25106",
                                                                  "deviceName": "Galaxy S10",
                                                                  "protocolVersion": 7,
                                                                  "deviceType": "phone",
                                                                  "incomingCapabilities": [
                                                                    "kdeconnect.telephony.request_mute",
                                                                    "kdeconnect.notification",
                                                                    "kdeconnect.ping",
                                                                    "kdeconnect.notification.reply",
                                                                    "kdeconnect.notification.action",
                                                                    "kdeconnect.share.request",
                                                                    "kdeconnect.clipboard.connect",
                                                                    "kdeconnect.runcommand",
                                                                    "kdeconnect.contacts.request_all_uids_timestamps",
                                                                    "kdeconnect.sms.request_conversations",
                                                                    "kdeconnect.telephony.request",
                                                                    "kdeconnect.mpris",
                                                                    "kdeconnect.sms.request_conversation",
                                                                    "kdeconnect.findmyphone.request",
                                                                    "kdeconnect.systemvolume",
                                                                    "kdeconnect.mousepad.keyboardstate",
                                                                    "kdeconnect.sftp.request",
                                                                    "kdeconnect.share.request.update",
                                                                    "kdeconnect.notification.request",
                                                                    "kdeconnect.mousepad.request",
                                                                    "kdeconnect.photo.request",
                                                                    "kdeconnect.sms.request",
                                                                    "kdeconnect.contacts.request_vcards_by_uid",
                                                                    "kdeconnect.mpris.request",
                                                                    "kdeconnect.battery.request",
                                                                    "kdeconnect.clipboard"
                                                                  ],
                                                                  "outgoingCapabilities": [
                                                                    "kdeconnect.sms.messages",
                                                                    "kdeconnect.telephony",
                                                                    "kdeconnect.mpris",
                                                                    "kdeconnect.notification",
                                                                    "kdeconnect.contacts.response_uids_timestamps",
                                                                    "kdeconnect.findmyphone.request",
                                                                    "kdeconnect.ping",
                                                                    "kdeconnect.mousepad.keyboardstate",
                                                                    "kdeconnect.share.request",
                                                                    "kdeconnect.contacts.response_vcards",
                                                                    "kdeconnect.notification.request",
                                                                    "kdeconnect.mousepad.echo",
                                                                    "kdeconnect.clipboard.connect",
                                                                    "kdeconnect.mousepad.request",
                                                                    "kdeconnect.presenter",
                                                                    "kdeconnect.sftp",
                                                                    "kdeconnect.photo",
                                                                    "kdeconnect.runcommand.request",
                                                                    "kdeconnect.mpris.request",
                                                                    "kdeconnect.systemvolume.request",
                                                                    "kdeconnect.battery",
                                                                    "kdeconnect.clipboard"
                                                                  ],
                                                                  "tcpPort": 1716,
                                                                  "tcpHost": "10.48.0.164"
                                                                }
                                                              }
sep 15 13:55:23 slack.desktop[71865]: [09/15/20, 13:55:23:385] info: Store: SET_SYSTEM_IDLE idle_taskbar
sep 15 13:55:23 slack.desktop[71865]: [09/15/20, 13:55:23:389] info: [DESKTOP-SIDE-EFFECT] Update from desktop for keys  ["app"]
sep 15 13:55:26 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170925508,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925223,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:26 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170925694,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925223,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:26 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170925872,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:26 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170926048,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:27 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170926286,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:27 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170926504,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:27 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170927235,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:28 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170927454,
                                                                "type": "kdeconnect.sms.messages",
                                                                "body": {
                                                                  "messages": [
                                                                    {
                                                                      "addresses": [
                                                                        {
                                                                          "address": "+46707260865"
                                                                        }
                                                                      ],
                                                                      "body": "test send from phone ",
                                                                      "date": 1600170925532,
                                                                      "type": 2,
                                                                      "read": 1,
                                                                      "thread_id": "830",
                                                                      "_id": 15593,
                                                                      "sub_id": 1,
                                                                      "event": 1
                                                                    }
                                                                  ],
                                                                  "version": 2
                                                                }
                                                              }
sep 15 13:55:28 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170927648,
                                                                "type": "kdeconnect.notification",
                                                                "body": {
                                                                  "id": "-1|android|8|null|1000",
                                                                  "isCancel": true
                                                                }
                                                              }
sep 15 13:55:28 org.gnome.Shell.Extensions.GSConnect[192166]: [/service/device.js:_readLoop:361]: Galaxy S10: {
                                                                "id": 1600170927649,
                                                                "type": "kdeconnect.notification",
                                                                "body": {
                                                                  "id": "-1|android|8|null|1000",
                                                                  "isCancel": true
                                                                }
                                                              }

System Details (please complete the following information):

GSConnect environment (if applicable):

Additional Notes:

andyholmes commented 3 years ago

This is a known bug, but pretty hard to fix in GSConnect. Since the message _id field is not unique, we determine uniqueness by date. The date timestamp should be unique, but kdeconnect-android seems to send several versions of the same message with different timestamps:

[/service/device.js:_readLoop:361]: Galaxy S10: {
    "id": 1600170925694,
    "type": "kdeconnect.sms.messages",
    "body": {
      "messages": [
        {
          "addresses": [
            {
              "address": "+46707260865"
            }
          ],
          "body": "test send from phone ",
          "date": 1600170925223, // <= 223ms
          "type": 2,
          "read": 1,
          "thread_id": "830",
          "_id": 15593,
          "sub_id": 1,
          "event": 1
        }
      ],
      "version": 2
    }
  }
[/service/device.js:_readLoop:361]: Galaxy S10: {
    "id": 1600170925872,
    "type": "kdeconnect.sms.messages",
    "body": {
      "messages": [
        {
          "addresses": [
            {
              "address": "+46707260865"
            }
          ],
          "body": "test send from phone ",
          "date": 1600170925532, // <= 532ms
          "type": 2,
          "read": 1,
          "thread_id": "830",
          "_id": 15593,
          "sub_id": 1,
          "event": 1
        }
      ],
      "version": 2
    }
  }

It's possible this may be improved in an upcoming release of kdeconnect-android, but without some complicated heuristics I'm not sure how to deal with this one.

samhed commented 3 years ago

Thanks for your response. I understand.

Is it a known bug for the kdeconnect-android folks as well? Or should I report it somewhere?

andyholmes commented 3 years ago

Is it a known bug for the kdeconnect-android folks as well? Or should I report it somewhere?

I think I mentioned it once to the developers, but I've never opened a report for it.

Basically the Android app watches a content provider that triggers when a message is received (or something else). Android has several "boxes" (inbox, drafts, outbox, sent, etc), so my best guess is that when a message is "received" it's bouncing through a few "boxes" which is why we get sent several events for the same message at very close intervals.

@sredman or @aniket786 might know better if this is the case (if they have time to chime in :wink:). The reason this probably doesn't affect KDE Connect is that they don't really cache messages like we do.

Ashtray-III commented 3 years ago

If terminal notifications are enabled, then you will duplicate notifications. One notification will be from kdeconnect, the other notification will be from the terminal window that's running in the background.

This was the problem for me anyway.

andyholmes commented 3 years ago

If terminal notifications are enabled, then you will duplicate notifications.

This sounds like an unrelated bug to SMS. Probably you should open a separate issue for this.

Ashtray-III commented 3 years ago

If terminal notifications are enabled, then you will duplicate notifications.

This sounds like an unrelated bug to SMS. Probably you should open a separate issue for this.

I wouldn't call it a bug. Terminal notifications could be really useful for a lot things.

I would suggest the OP run down the list of desktop applications with notifications enabled and uncheck boxes to see if that's where the problem lays.

andyholmes commented 3 years ago

The bug he's reporting is unrelated to notifications. It's a known bug that results in duplicate SMS messages in the message cache when kdeconnect-android sends the same message twice with different timestamps.

jmfergeau commented 8 months ago

having the same problem. Any news about it being reported and investigated yet?