Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont show metadata title if it matches the post title. #1370

Merged
merged 6 commits into from
Feb 11, 2024

Conversation

dessalines
Copy link
Member

No description provided.

@dessalines dessalines changed the title Metadata card title Dont show metadata title if it matches the post title. Feb 10, 2024
text = post.embed_title!!,
style = MaterialTheme.typography.titleLarge,
)
if (post.name !== post.embed_title) {
Copy link
Collaborator

@MV-GH MV-GH Feb 11, 2024

Choose a reason for hiding this comment

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

Isn't triple equals direct reference comparison? Isn't this not guaranteed to be true for strings? (Two the dame strings can have different references) Or did they change this behaviour with Kotlin? Either way I would do !=

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Didn't know that made a difference for strings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In Java each (string) object has its own unique ref, == is a direct reference comparison and equals is the overloaded logical comparison. But Java caches Strings and thus returns sometimes the same ref for the same string. So it works for some cases but not all. In Kotlin == is logical comparison (the equals) and === is the reference comparison

@dessalines dessalines enabled auto-merge (squash) February 11, 2024 15:48
@dessalines dessalines merged commit c7f3f9a into main Feb 11, 2024
2 checks passed
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.

2 participants