Skip to content

refactor: Migrate Internal ProviderPersistence class to kotlin #533

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

Merged

Conversation

Mansi-mParticle
Copy link
Collaborator

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

  • Migrate internal package’s ProviderPersistence classe to Kotlin.

Testing Plan

  • Was this tested locally? If not, explain why.
  • Tested with sample application and ran the unit test cases

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

Copy link
Contributor

@einsteinx2 einsteinx2 left a comment

Choose a reason for hiding this comment

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

Just those questions about locale, otherwise looks good to me.

private fun applyMacro(defaultString: String): String {
var defaultString = defaultString
if (!isEmpty(defaultString) && defaultString.startsWith("%")) {
defaultString = defaultString.lowercase(Locale.getDefault())
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure we want to use the default locale here? I'm not saying we don't, but is this different in any way from the toLowerCase() function in Java? Does getDefault() get the current system default or some universal default? I've been bitten by locale bugs in the past, so I want to make sure we're 100% certain here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so here Locale.getDefault() will return the default language for system. languages where case rules vary (e.g., Turkish).

@Mansi-mParticle Mansi-mParticle force-pushed the refactor/SQDSDKS-6978-ProviderPersistence-class branch from f540bd1 to d006811 Compare February 5, 2025 21:27
Comment on lines 32 to 34
val type = fileObjects.getJSONObject(keyIndex).getInt(KEY_PERSISTENCE_TYPE)
val key = fileObjects.getJSONObject(keyIndex).getString(KEY_PERSISTENCE_KEY)
val mpKey = fileObjects.getJSONObject(keyIndex).getString(KEY_PERSISTENCE_MPVAR)
Copy link
Member

Choose a reason for hiding this comment

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

i suggest turn fileObjects.getJSONObject(keyIndex) into a variable for readability

@Mansi-mParticle Mansi-mParticle requested a review from rmi22186 March 3, 2025 17:42
Copy link
Member

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

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

LGTM. can you make sure the tests are passing though? might just need a rebase

@Mansi-mParticle Mansi-mParticle merged commit 22d4042 into blackout-2024 Mar 5, 2025
20 of 23 checks passed
@Mansi-mParticle Mansi-mParticle deleted the refactor/SQDSDKS-6978-ProviderPersistence-class branch March 5, 2025 15:07
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.

3 participants