fix(wallet): replace text-marker hack with proper raw event API (room.sendRaw + MsgLikeKind.Other)

- Add Timeline.sendRaw() to send custom Matrix events
- Add CustomEventContent type for receiving custom events
- Update TimelineEventContentMapper to handle MsgLikeKind.Other
- Update TimelineItemContentFactory to intercept payment events
- Rewrite DefaultPaymentEventSender to use sendRaw instead of text markers
- Update TimelineItemContentPaymentFactory to parse raw JSON
- Remove text-marker detection from TimelineItemContentMessageFactory
- Update tests to use raw event API
- Mark raw event SDK blocker as RESOLVED in BLOCKERS.md

Event type: co.sulkta.payment.request (reverse-domain format)
Status updates: co.sulkta.payment.status

Benefits:
- Proper Matrix protocol compliance
- No JSON embedded in text messages
- Events won't be indexed by search
- Clean separation from regular messages
This commit is contained in:
Kayos 2026-03-27 11:45:12 -07:00
parent adee67cf0d
commit f2b95d6b8a
10 changed files with 264 additions and 189 deletions

View file

@ -71,6 +71,18 @@ interface Timeline : AutoCloseable {
intentionalMentions: List<IntentionalMention>,
): Result<Unit>
/**
* Send a raw/custom event to the room.
*
* @param eventType The event type (e.g., "co.sulkta.payment.request")
* @param content The JSON content of the event
* @return Result indicating success or failure
*/
suspend fun sendRaw(
eventType: String,
content: String,
): Result<Unit>
suspend fun editMessage(
eventOrTransactionId: EventOrTransactionId,
body: String,

View file

@ -118,3 +118,14 @@ data object LegacyCallInviteContent : EventContent
data object CallNotifyContent : EventContent
data object UnknownContent : EventContent
/**
* Content for custom/unknown message-like events that we want to handle specially.
*
* @param eventType The Matrix event type (e.g., "co.sulkta.payment.request")
* @param rawJson The raw JSON content of the event, if available
*/
data class CustomEventContent(
val eventType: String,
val rawJson: String?,
) : EventContent