You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2023. It is now read-only.
Over at issue #61 we considered a refactored design for asynchronously loading TileJSON, and at pull request #71 we discussed my issue61 branch with a new approach to solving problems around the asynchronous TileJSON stuff.
The conclusion from #71 seems to be that the general approach in the issue61 branch is sound, but it needs to be packaged within an API which feels consistent with Apple's API's in general, and MKMapKit in particular. So this ticket is for discussing refinements to the API. One of the big open questions is what the caching will look like.
My plan for the moment is:
Make a new branch based on issue61
Get rid of MBXStandardDelegate by moving its code back to the OS X and iOS sample apps.
Once the delegate protocol implementations and caching stuff are in good order, work on simplifying, renaming, and otherwise polishing up the remaining API.
I'm guessing this iteration will reach a good stopping point by approximately March 20th (next Thursday).
This seems really well thought-out, @wsnook! I can't possibly hope to totally grok 65 commits and 32 changed files with 4,961 additions and 5 deletions just yet, particularly the whole functionality of MBXOfflineMapDownloader and its dual queue system, but here's how I see things proceeding:
We address some more important comments below leading up to / when we voice Tuesday.
We consider some other comments, more as backburner things that we can discuss on GitHub.
We squash these into a new commit or handful of commits and open a pull request for more in-depth review and testing, getting it into master for some testing before release of 0.3.0.
Main comments (voice)
Overall, and I mean this from a general "Mapbox how we do it" angle, it would help in future if you could more clearly highlight how to test the new functionality. I'm able to read through all the source myself and figure it out, but it takes a while and having a nice "run this app and press X button" comment would really help before I dive all in, since I've been away from these for some weeks / never used your example app directly anyway.
Related to the above, we need to clean up all the v030 stuff and just make the final proposed-merge branch reflect the state that master should be. In a branch, don't be shy about blowing away our current view controller/sample app/whatever. Branches are cheap and non-permanent.
If I'm understanding things properly, MBXOfflineMapDatabase instances, though referenced by the MBXOfflineMapDownloader and used as arguments by the delegate methods and -removeOfflineMapDatabase:, are meant to be opaque, "private" items. We should consider making all the methods and most/all of the properties on MBXOfflineMapDatabase private, with a category inside MBXOfflineMapDownloader / any other class that needs to use them directly. That is to say the "public" should never be calling these methods. As a descendent of NSObject, too, you can throw an exception inside of a declared -init to discourage such direct use. Otherwise, believe me, it's gonna happen / generate support inquiries.
Why is the delegate passed in -[MBXRasterTileOverlay initWithOfflineMapDatabase:delegate:]? How is this different from instantiating with a mapID? I'm asking both out of implementation curiosity but also as a future potential confused user of the API.
Minor comments (online)
Properties like these should be more declarative and explain what they are for. metadata says "data structure" to me, not a BOOL value. Similar for markers, which says "image data or GeoJSON", not a boolean value. Probably something like hasMetadata? This is especially confusing when reading code like
where it's not really obvious what's happening. Does metadata = YES mean that metadata is not loaded?
Thinking ahead to how MBXOfflineMapDatabase will be used, could we maybe take -initWithContentsOfFile: one step further as we do over in https://github.com/mapbox/mapbox-ios-sdk/blob/3a1835bc8871dfba53befa20b41bddfdf1f4ca33/MapView/Map/RMMBTilesSource.h#L53-L63. These examples allow the user to specify a bundle resource or even just the first part of the filename (assuming .mbtiles) and the framework does the rest. Similarly, for offline map databases, these are basically always going to be in the app jail and either in the documents folder or the caches folder. I would recommend some default, but changeable, file extension (.mboffline?) perhaps before your .partial/.complete or even nothing appended to .mboffline in place of .complete, and then something like -initWithDatabaseName:inDocuments:, the latter argument being a BOOL defaulting to YES.
Related to the above, we should make iCloud backup configurable (
Inside of -completeDatabaseAndInstantiateOfflineMapWithError: the idea of moving a file from a background thread (albeit supposedly a single-concurrency one) is kind of gross to me. Maybe an assert or dispatch_sync() to main queue there? Just something that ensures that the -setMaxConcurrentOperationCount:1 has happened elsewhere rather than implicitly linking these by intent, which will eventually be lost to the sands of time.
Why isn't -[MBXOfflineMapDownloader delegate] a property as is custom? Why is this write-only? That's weird for a delegate.
Activity
#73 Improve statistics instrumentation
#73 Massive surgery to use NSURLSession with NSURLCache
#73 Working on caching and streamlining networking code. Broken & in …
#73 Factored redundancy out of async network code. Fixed Mac demo.
#73 Add a network activity indicator
#73 Better delegate callback names
70 remaining items
#73 insert/update works, but I still need to bind the image blob
#73 Saving blobs works! Now able to load and view an offline map!
#73 Offline Map: tiles work, delete db works, marker icons don’t work.
#73 Offline marker icons: Save to db works. Display on map still broken.
#73 Fixed the offline marker display issue
#73 Fixed typo in filename
incanus commentedon Apr 22, 2014
Handy pre-PR link comparing the
issue73branch againstmaster:master...issue73
incanus commentedon Apr 22, 2014
This seems really well thought-out, @wsnook! I can't possibly hope to totally grok 65 commits and 32 changed files with 4,961 additions and 5 deletions just yet, particularly the whole functionality of
MBXOfflineMapDownloaderand its dual queue system, but here's how I see things proceeding:masterfor some testing before release of0.3.0.Main comments (voice)
v030stuff and just make the final proposed-merge branch reflect the state thatmastershould be. In a branch, don't be shy about blowing away our current view controller/sample app/whatever. Branches are cheap and non-permanent.MBXOfflineMapDatabaseinstances, though referenced by theMBXOfflineMapDownloaderand used as arguments by the delegate methods and-removeOfflineMapDatabase:, are meant to be opaque, "private" items. We should consider making all the methods and most/all of the properties onMBXOfflineMapDatabaseprivate, with a category insideMBXOfflineMapDownloader/ any other class that needs to use them directly. That is to say the "public" should never be calling these methods. As a descendent ofNSObject, too, you can throw an exception inside of a declared-initto discourage such direct use. Otherwise, believe me, it's gonna happen / generate support inquiries.-[MBXRasterTileOverlay initWithOfflineMapDatabase:delegate:]? How is this different from instantiating with amapID? I'm asking both out of implementation curiosity but also as a future potential confused user of the API.Minor comments (online)
metadatasays "data structure" to me, not aBOOLvalue. Similar formarkers, which says "image data or GeoJSON", not a boolean value. Probably something likehasMetadata? This is especially confusing when reading code likembxmapkit/v030/MBXRasterTileOverlay.m
Lines 208 to 215 in 7ca0eca
metadata = YESmean that metadata is not loaded?MBXOfflineMapDatabasewill be used, could we maybe take-initWithContentsOfFile:one step further as we do over in https://github.com/mapbox/mapbox-ios-sdk/blob/3a1835bc8871dfba53befa20b41bddfdf1f4ca33/MapView/Map/RMMBTilesSource.h#L53-L63. These examples allow the user to specify a bundle resource or even just the first part of the filename (assuming.mbtiles) and the framework does the rest. Similarly, for offline map databases, these are basically always going to be in the app jail and either in the documents folder or the caches folder. I would recommend some default, but changeable, file extension (.mboffline?) perhaps before your.partial/.completeor even nothing appended to.mbofflinein place of.complete, and then something like-initWithDatabaseName:inDocuments:, the latter argument being aBOOLdefaulting toYES.mbxmapkit/v030/MBXOfflineMapDownloader.m
Line 80 in 7ca0eca
mbxmapkit/v030/MBXOfflineMapDownloader.m
Lines 163 to 167 in 7ca0eca
-completeDatabaseAndInstantiateOfflineMapWithError:the idea of moving a file from a background thread (albeit supposedly a single-concurrency one) is kind of gross to me. Maybe an assert ordispatch_sync()to main queue there? Just something that ensures that the-setMaxConcurrentOperationCount:1has happened elsewhere rather than implicitly linking these by intent, which will eventually be lost to the sands of time.-[MBXOfflineMapDownloader delegate]a property as is custom? Why is this write-only? That's weird for a delegate.Fix #73 Encourage questions instead of writing tutorial