-
Notifications
You must be signed in to change notification settings - Fork 32
Remove Desugaring Requirement By Removing Instant.now() #154
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
Changes from 5 commits
c4d1324
6c80bd9
64d142d
7dca34c
fd91bd2
1d54abd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,7 @@ open class Analytics protected constructor( | |
Analytics.segmentLog( | ||
"Caught Exception in Analytics Scope: ${t}" | ||
) | ||
t.printStackTrace() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm....No. I will add that and probably more like it in a follow up PR. It's a nice to have. |
||
} | ||
override val analyticsScope = CoroutineScope(SupervisorJob() + exceptionHandler) | ||
override val analyticsDispatcher : CloseableCoroutineDispatcher = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.segment.analytics.kotlin.core.utilities | ||
|
||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
/** | ||
* This function is a replacement for Instant.now().toString(). It produces strings in a | ||
* compatible format. | ||
* | ||
* Ex: | ||
* Instant.now(): 2023-04-19T04:03:46.880969Z | ||
* dateTimeNowString(): 2023-04-19T04:03:46.880Z | ||
*/ | ||
fun dateTimeNowString(): String { | ||
val sdf = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'Szzz") | ||
val utc = TimeZone.getTimeZone("UTC"); | ||
sdf.timeZone = utc; | ||
return sdf.format(Date()).replace("UTC", "Z") | ||
} |
This file was deleted.
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.
do we need to replace
toInstant
too? looks like it's returning anInstant
value. would that require desugaring?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.
Not in our tests. I let all of those keep the use of the Instant classes. Instant was only removed from code that runs on the device.
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.
hmm. I wonder if it's still available after we removed all the desugaring setup and the dependency
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.
Yes. It is still available because the test run locally using java 11. I have updated the code to remove desugaring from the android build.gradle and re-run the test and they still all pass.