Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Activate filesource to list offline regions #10531

Merged
merged 1 commit into from
Nov 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,16 @@ private Handler getHandler() {
*
* @param callback the callback to be invoked
*/
public void listOfflineRegions(@NonNull
final ListOfflineRegionsCallback callback) {
public void listOfflineRegions(@NonNull final ListOfflineRegionsCallback callback) {
fileSource.activate();
listOfflineRegions(fileSource, new ListOfflineRegionsCallback() {

@Override
public void onList(final OfflineRegion[] offlineRegions) {
getHandler().post(new Runnable() {
@Override
public void run() {
fileSource.deactivate();
callback.onList(offlineRegions);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should fileSource.deactivate();
happen after the callback.onList(offlineRegions); ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased osana-offline branch and was not able to see listed offline regions any more.
Reversing the order - fixed my issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased osana-offline branch and was not able to see listed offline regions any more.
Reversing the order - fixed my issue

startled that this is the case, could you follow up in your branch with reversing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the branch with that change.

});
Expand All @@ -168,6 +169,7 @@ public void onError(final String error) {
getHandler().post(new Runnable() {
@Override
public void run() {
fileSource.deactivate();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should do the callback first and then deactivate the fileSource

callback.onError(error);
}
});
Expand Down Expand Up @@ -241,6 +243,7 @@ private boolean isValidOfflineRegionDefinition(OfflineRegionDefinition definitio
/**
* Changing or bypassing this limit without permission from Mapbox is prohibited
* by the Mapbox Terms of Service.
*
* @param limit the new tile count limit.
*/
public native void setOfflineMapboxTileCountLimit(long limit);
Expand Down