Skip to content

Introduce typed id value classes - #229

Open
m4pl wants to merge 12 commits into
GrapheneOS:mainfrom
m4pl:task/173/219-typed-value-classes
Open

Introduce typed id value classes#229
m4pl wants to merge 12 commits into
GrapheneOS:mainfrom
m4pl:task/173/219-typed-value-classes

Conversation

@m4pl

@m4pl m4pl commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Closes #219

Adds value classes ConversationId, MessageId, ParticipantId, SubId. Primitives stay at persistence and Java boundaries via .value / fromOrNull.

Behavior changes: ConversationMessageUiModelMapper.map returns null instead of a blank messageId, which previously became a duplicate LazyColumn key. Some isEmpty() checks became isBlank(), since the id types only expose blank checks.

@m4pl

This comment was marked as resolved.

@m4pl
m4pl force-pushed the task/173/219-typed-value-classes branch from 4cf3f83 to 941abc6 Compare August 3, 2026 20:20
@m4pl
m4pl requested review from RankoR, inthewaves and sdsantos August 3, 2026 20:22
@m4pl
m4pl marked this pull request as ready for review August 3, 2026 20:30
val messageId = data.messageId?.takeIf { it.isNotBlank() }
val conversationId = data.conversationId?.takeIf { it.isNotBlank() }

if (messageId == null || conversationId == null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe log it?

internal const val PARTICIPANT_ID_1 = "p1"
internal const val PARTICIPANT_ID_2 = "p2"
internal const val PARTICIPANT_ID_3 = "p3"
internal val PARTICIPANT_ID_1 = ParticipantId("p1")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be participantId1 as it's not const anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace raw String identifiers with typed value classes

2 participants