xmtp / xmtp-ios

XMTP client SDK for iOS applications written in Swift.
MIT License
34 stars 24 forks source link

Add a way to decode a single message #31

Closed nmalzieu closed 1 year ago

nmalzieu commented 1 year ago

In the Javascript SDK, if we have a conversation instance and an encoded message, we can decode it using conversation.decodeMessage

Can we do the same with the SWIFT SDK? It would be useful to decode incoming notifications in an iOS Notification Extension

Bonus: if we can export / import keys (like https://github.com/xmtp/xmtp-ios/issues/30) it would also be amazing to be able to export / import saved conversations! And when importing conversations, being able to decode a notification without any access to the network, because sometimes if the connection is not good we still receive a notification, and the notification extension only has so much time to decode it

nakajima commented 1 year ago

There is not yet a way to do this, I think it makes sense to add though. I can look at introducing it after https://github.com/xmtp/xmtp-ios/pull/26 lands.

nmalzieu commented 1 year ago

Thanks @nakajima ! Can't wait to have this for Converse. I think it is the only way to have "real notifications" in a native XMTP app

iOS Notification Extension are made exactly for this: decode encoded content from notifications. Background notifications that are supposed to wake up the app are not a good solution because it doesn't work if the user killed the app. Only iOS Notification Extensions work 100% of the time!

But they don't have a lot of time to do their work before being killed by the system Since we have the encoded message in the notification, being able to decode a single message makes sense!

nakajima commented 1 year ago

Now that https://github.com/xmtp/xmtp-ios/pull/41 has merged, can we close sthis?

nmalzieu commented 1 year ago

@nakajima this is not an issue anymore to me, you can close! Thank you for all the work!