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

Add offline pack context setter #289

Merged
merged 1 commit into from
Apr 30, 2020
Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Apr 30, 2020

Added the -[MGLOfflinePack setContext:completionHandler:] method for replacing the data associated with an offline pack, such as a name.

To do:

  • Add setter
  • Add unit test of setter
  • Debug unit test failure
  • Make offline pack table editable in macosapp

Fixes #256.

/cc @mapbox/maps-ios

[pack setContext:newContext completionHandler:^(NSError * _Nullable error) {
XCTAssertNil(error);
XCTAssertNotNil(weakPack);
XCTAssertEqualObjects(weakPack.context, newContext, @"Offline pack context should match the updated context specified by the application.");

This comment was marked as resolved.

@1ec5
Copy link
Contributor Author

1ec5 commented Apr 30, 2020

8e5dd29ff47e6f75607f2353c9d0703322c94381 tries to work around mapbox/mapbox-gl-native#16450 by reloading the offline packs, storing the mbgl::OfflineRegion matching the offline pack being updated, and throwing away all the wrapping MGLOfflinePacks. Unfortunately, calling mbgl::DatabaseFileSource::listOfflineRegions() seems to return exactly the same offline regions as before, making me wonder if mbgl is actually changing anything like it’s supposed to.

Edit: That was a typo, fixed in f88052c8de03cc9425496b5317e232e1749b3ede.

Set the offline pack’s associated metadata, then replace the offline pack’s underlying offline region based on a fresh reload, without touching the master array of offline packs.
@1ec5 1ec5 force-pushed the 1ec5-offline-context-setter-256 branch from 4393c82 to ed4495f Compare April 30, 2020 20:46
@1ec5 1ec5 merged commit 1b4c422 into master Apr 30, 2020
@1ec5 1ec5 deleted the 1ec5-offline-context-setter-256 branch April 30, 2020 23:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request ios macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow changing offline metadata
2 participants