-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor OkHttp interceptors and turn them into Kotlin #32
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #32 +/- ##
=======================================
Coverage 72.66% 72.67%
=======================================
Files 305 305
Lines 9992 9990 -2
Branches 1440 1438 -2
=======================================
- Hits 7261 7260 -1
Misses 2162 2162
+ Partials 569 568 -1
|
* Return the canonical name of the cause of a [Throwable]. Handles null elements throughout, | ||
* including the throwable and its cause, in which case [defaultName] is returned | ||
*/ | ||
internal fun causeName(throwable: Throwable?, defaultName: String = ""): String { |
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.
These methods and their tests were moved from ThrowableUtils.kt
in the main module. They were only used here and its seems weird to have them in a different module, so I effectively inline it.
val realResponseBody = RealResponseBody( | ||
contentType, | ||
-1L, | ||
GzipSource(body.source()).buffer() |
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 was using a RealBufferedSource
before as that's what the internal OkHttp implementation did, but because that's an internal class, I changed the implementation to not depend on that. This is basically what the implementation did prior to my refactoring of it in 5.25, so this should be fine.
|
||
import io.embrace.android.embracesdk.InternalApi; | ||
|
||
@InternalApi | ||
public interface HttpPathOverrideRequest { | ||
|
||
@NonNull | ||
@Nullable |
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.
This should've been @Nullable
all along
@@ -132,6 +132,8 @@ | |||
* not change after the SDK has started. | |||
*/ | |||
public fun getSdkCurrentTime(): Long | |||
|
|||
public fun isInternalNetworkCaptureDisabled(): Boolean |
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.
This new method returns the value set on ApkToolsConfig
, which lives in the main module. Having a internal API method means I can cross the module bounds as well as mock this for a test
43a8af1
to
c2a10a6
Compare
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.
LGTM
Goal
Convert to Kotlin. I had to do a few things in order for this to work, and I'll point it out in the review via comments.
Testing
Existing tests passes