Skip to content

fix(android): uppercase conversion in getEnumName() method#3311

Merged
mfazekas merged 4 commits intornmapbox:mainfrom
krystofcelba:feature/fix-#3255
Jan 12, 2024
Merged

fix(android): uppercase conversion in getEnumName() method#3311
mfazekas merged 4 commits intornmapbox:mainfrom
krystofcelba:feature/fix-#3255

Conversation

@krystofcelba
Copy link
Contributor

Description

Fixed a bug affecting locales such as
Turkish, where lowercase 'i' was incorrectly converted to 'İ' instead of 'I'. Now, the US locale is explicitly used for enum name conversion to ensure correct character mapping.

Fixes #3255

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Fixed a bug affecting locales such as
Turkish, where lowercase 'i' was incorrectly converted to 'İ'
instead of 'I'. Now, the US locale is explicitly used
for enum name conversion to ensure correct character mapping.
@krystofcelba krystofcelba changed the title fix: uppercase conversion in getEnumName() method fix(android): uppercase conversion in getEnumName() method Jan 10, 2024
@mfazekas
Copy link
Contributor

Amazing! Thanks much!

@krystofcelba
Copy link
Contributor Author

@mfazekas, could you please provide an estimated timeline for when you expect the merge to be completed?


fun getEnumName(): String {
return mPayload!!.getString("value")!!.toUpperCase().replace("-", "_")
return mPayload!!.getString("value")!!.uppercase(Locale.US).replace("-", "_")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ‘uppercase()’ without locale param should work.

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/uppercase.html

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right :). If you don't mind I have set up Kotlin unit testing in the project, I have added a unit test for that to be sure.

@mfazekas
Copy link
Contributor

@mfazekas, could you please provide an estimated timeline for when you expect the merge to be completed?

Let a note on the change, then it can be merged

@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@krystofcelba krystofcelba temporarily deployed to CI with Mapbox Tokens January 12, 2024 05:42 — with GitHub Actions Inactive
@mfazekas mfazekas merged commit 945bdcd into rnmapbox:main Jan 12, 2024
@Buthrakaur
Copy link
Contributor

Hi @mfazekas , when do you plan to create a release with this fix, please?

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.

[Bug]: IllegalArgumentException java.lang.Enum in valueOf

3 participants