Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
dessalines merged 6 commits into
mainfrom
metadata_card_title
Feb 11, 2024
Merged

Dont show metadata title if it matches the post title.#1370
dessalines merged 6 commits into
mainfrom
metadata_card_title

Conversation

@dessalines

Copy link
Copy Markdown
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) {

@MV-GH MV-GH Feb 11, 2024

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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
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