Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: downloadOfflineRegion needs to be updated #534

Closed
shroff opened this issue Feb 12, 2021 · 0 comments · Fixed by #545
Closed

iOS: downloadOfflineRegion needs to be updated #534

shroff opened this issue Feb 12, 2021 · 0 comments · Fixed by #545
Labels

Comments

@shroff
Copy link
Collaborator

shroff commented Feb 12, 2021

See #491

@tobrun tobrun added the ios label Feb 12, 2021
n8han added a commit that referenced this issue Feb 16, 2021
The interface has changed to send region as a argument, as well as the
channelName. Without this change, the region download fails.

Fixes #534
n8han added a commit that referenced this issue Feb 16, 2021
While the Android SDK generates a region ID in createOfflineRegion, the
iOS SDK does not have this feature. To maintain a parallel interface and
relieve the client of the need to generate IDs, this change generates an
ID before submitting the download request to the iOS SDK. As in the
Android implementation, the completed OfflineRegionData is immediately
returned through the open channel.

Fixes #533

The following changes suggested in #491 are also pursued here:

* Restructure OfflineRegionData(native)/OfflineRegion(dart) classes into
  OfflineRegionDefinition and OfflineRegion classes to mirror SDK class
  structure. This is basically equivalient to something like
  OfflineRegionOptions.
* Accept OfflineRegionDefinition as an arg to downloadOfflineRegion, and
  return OfflineRegion as a result

Without those changes, the client code is `@required` to submit an id
along with the original download request, even though the id will not be
used and will be replaced by the generated ID. Furthermore, the object
returned from `downloadOfflineRegion` is now decoded so that the client
can await it to extract the generated ID.

I also made the properties of the definition and data classes immutable
on the iOS side, and renamed values dealing with the downloaded pack
context from "metadata" to "context". This is because the context is no
longer just the user-supplied metadata; it is a structure separately
holding the metadata and generated ID.

This change is not backwards compatible with regions previously
downloaded on iOS, however, offline downloading is not functional in the
latest or any release of this library because of #534.

It should be fully compatible with the existing implementation on
Android, though it would be a good idea to undertake a similar
separation of "definition" and "data" on that platform.
shroff pushed a commit that referenced this issue Feb 28, 2021
…with iOS and Android (#545)

* Handled updated downloadOfflineRegion interface

The interface has changed to send region as a argument, as well as the
channelName. Without this change, the region download fails.

Fixes #534

* Generate offline region IDs and adapt interfaces

While the Android SDK generates a region ID in createOfflineRegion, the
iOS SDK does not have this feature. To maintain a parallel interface and
relieve the client of the need to generate IDs, this change generates an
ID before submitting the download request to the iOS SDK. As in the
Android implementation, the completed OfflineRegionData is immediately
returned through the open channel.

Fixes #533

The following changes suggested in #491 are also pursued here:

* Restructure OfflineRegionData(native)/OfflineRegion(dart) classes into
  OfflineRegionDefinition and OfflineRegion classes to mirror SDK class
  structure. This is basically equivalient to something like
  OfflineRegionOptions.
* Accept OfflineRegionDefinition as an arg to downloadOfflineRegion, and
  return OfflineRegion as a result

Without those changes, the client code is `@required` to submit an id
along with the original download request, even though the id will not be
used and will be replaced by the generated ID. Furthermore, the object
returned from `downloadOfflineRegion` is now decoded so that the client
can await it to extract the generated ID.

I also made the properties of the definition and data classes immutable
on the iOS side, and renamed values dealing with the downloaded pack
context from "metadata" to "context". This is because the context is no
longer just the user-supplied metadata; it is a structure separately
holding the metadata and generated ID.

This change is not backwards compatible with regions previously
downloaded on iOS, however, offline downloading is not functional in the
latest or any release of this library because of #534.

* OfflineRegion and OfflineRegionDefinition

To better harmonize with the Mapbox sdk data structures for offline
regions on iOS and Android, and to pave the way for polygonal offline
regions, the dart classes are revamped in 71186fb. This required changes
on the Android side which are also in this PR, and it will require changes
in any client code using the download functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants