Entitlement verification: Return updated request time from header in CustomerInfo in 304 responses#848
Conversation
There was a problem hiding this comment.
This was a bit awkward... We could make it so if the response is missing the request time header, we fail but I thought I would copy what iOS is doing and just fallback to the request date in the body. Happy to discuss this though.
There was a problem hiding this comment.
I think this makes sense.
There was a problem hiding this comment.
I gave it this name since there is already a request_date which is part of the body of the response. When caching it, I didn't want to override that value, so I serialize it as this key.
Codecov Report
@@ Coverage Diff @@
## toniricodiez/sdk-2896-invalidate-devicecache-cache-if #848 +/- ##
========================================================================================
Coverage ? 82.70%
========================================================================================
Files ? 137
Lines ? 4532
Branches ? 596
========================================================================================
Hits ? 3748
Misses ? 562
Partials ? 222 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
It would be nice to finish renaming all these to "customer info". Purchaser info was the old name
There was a problem hiding this comment.
Agreed... Will only rename the ones I'm touching in this PR, but we definitely should finish the rename
…d cached customer info is NOT_REQUESTED
4b42115 to
fdb918a
Compare
44c9010 to
60859d1
Compare
There was a problem hiding this comment.
I think this makes sense.
| .setResponseCode(expectedResult.responseCode) | ||
| .apply { | ||
| if (requestDateHeader != null) { | ||
| setHeader(HTTPResult.REQUEST_TIME_HEADER_NAME, requestDateHeader.time) |
There was a problem hiding this comment.
Yup, that's the official way to get milliseconds from a Date... I guess I could add a Date.epochMilliseconds extension or something like that to make it clearer, but it seems weird considering that's what this official API does.
There was a problem hiding this comment.
No it's fine, just making sure!
…CustomerInfo in 304 responses (#848) ### Description Completes [SDK-2897](https://linear.app/revenuecat/issue/SDK-2897/requestdate-not-returning-updated-value) With this PR, we will update `CustomerInfo`'s `requestDate` with the latest value even when a 304 response is received.
Description
Completes SDK-2897
With this PR, we will update
CustomerInfo'srequestDatewith the latest value even when a 304 response is received.