Repository navigation
add FileSource pause/resume - #9977
Conversation
9222e23 to
21d6313
Compare
|
This PR has been tested for offline integration and showing multiple maps on screen. |
ivovandongen
left a comment
There was a problem hiding this comment.
Looks good, besides the one comment.
| initialize(Mapbox.getAccessToken(), cachePath, assetManager); | ||
| } | ||
|
|
||
| public void activate() { |
There was a problem hiding this comment.
I would opt to make redundant calls possible instead of doing counting here. I suggested a patch to do so here: 034551f
This will also subtly break if the file source would be paused/resumed from another place in the future.
cc @jfirebaugh
There was a problem hiding this comment.
@jfirebaugh could you add your preference on who is responsible for ref counting? the binding or core?
There was a problem hiding this comment.
As noted in #10174 (review), my preference is to keep pause/resume as strict as possible -- in particular callable only by the creating thread -- because they otherwise get very difficult to reason about.
There was a problem hiding this comment.
@ivovandongen can you 👍 this if you are onboard on adding this?
| if (status.isComplete()) { | ||
| // Download complete | ||
| endProgress("Region downloaded successfully."); | ||
| offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE); |
There was a problem hiding this comment.
@tobrun Ref counting aside, this looks like new behavior for region downloads. Are there any side effects if a developer (like until now) doesn't manually set the region as inactive?
There was a problem hiding this comment.
This will result in not pausing the Filesource, in other words will match the same behavior as it is today. For this reason I'm not seeing this as a semver change but an enhancement to API.
closes #9965,
This PR integrates with FileSource pause/resume when the app state changes (foreground vs background). I'm currently looking into counting ongoing filesource interactions for two reasons: