-
Notifications
You must be signed in to change notification settings - Fork 32
prevent using jvm initializer in android and address violation of retrieving unsettable device id #67
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
prevent using jvm initializer in android and address violation of retrieving unsettable device id #67
Conversation
Codecov Report
@@ Coverage Diff @@
## main #67 +/- ##
============================================
+ Coverage 57.71% 57.73% +0.02%
- Complexity 418 420 +2
============================================
Files 66 67 +1
Lines 7137 7174 +37
Branches 690 693 +3
============================================
+ Hits 4119 4142 +23
- Misses 2506 2519 +13
- Partials 512 513 +1
Continue to review full report at Codecov.
|
…into wenxi/prevent-using-jvm-initializer-in-android � Conflicts: � core/src/test/kotlin/com/segment/analytics/kotlin/core/AnalyticsTests.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. couple comments
*/ | ||
fun getUniqueID(): String? { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that we support api 16+ we should have some fallback logic here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. the getDeviceId
method does a null check and returns random uuid as fallback.
internal class AndroidAnalyticsKtTest { | ||
@Test | ||
fun `jvm initializer in android platform should failed`() { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the new junit has a way to expect exceptions instead of doing this pattern. if u wanna try that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me try that
Summary
Additional Changes