mautrix / imessage

A Matrix-iMessage puppeting bridge
https://go.mau.fi/mautrix-imessage/
GNU Affero General Public License v3.0
341 stars 37 forks source link

Wait 60 seconds for file to be sent on iOS (same on MacOS) #43

Closed CarlAmbroselli closed 2 years ago

CarlAmbroselli commented 2 years ago

Fixes https://github.com/open-imcore/barcelona/issues/39. This is how it's done on the MacOS version here.

tulir commented 2 years ago

I thought barcelona is supposed to send the message before responding :thinking:

CarlAmbroselli commented 2 years ago

@tulir would this here not wipe it directly after telling Barcelona to do the send job? https://github.com/mautrix/imessage/blob/7bf7c23dbfd58408280e3b8e0bdecf3a022cfda6/portal.go#L883-L885

tulir commented 2 years ago

would this here not wipe it directly after telling Barcelona to do the send job?

No, SendFile waits for reply. The Mac connector has that sleep because there's no way to wait for the send with AppleScript, but Barcelona can wait.

CarlAmbroselli commented 2 years ago

Barcelona waits asynchronously for the send to complete and "returns" before that's done already (and doesn't do anything with the information that it's done other than logging errors, so definitely not telling the bridge): https://github.com/open-imcore/barcelona/blob/2875ea24a673028f49282154164842643410ed67/Beeper/BarcelonaMautrixIPC/IPCHandlers/CommandHandlers/SendMediaMessageCommand%2BHandler.swift#L40-L68

EricRabil commented 2 years ago

The Mac code does this because it has no choice (it does not have the luxury of using IMCore). This is a bug in Barcelona for iOS, so the appropriate fix should be made there.

The async handler you linked only pipes failures. There a specific spot in BLEventHandler that handles successfully sent messages of all types and informs mautrix-imessage