From 00521742a5bea364224651cd1fa25052fa812426 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:20:30 +0000 Subject: [PATCH] Update docs from maps rnmapbox/maps@721de19 --- docs/components/offlineManagerLegacy.md | 139 ++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 docs/components/offlineManagerLegacy.md diff --git a/docs/components/offlineManagerLegacy.md b/docs/components/offlineManagerLegacy.md new file mode 100644 index 0000000..ebde12a --- /dev/null +++ b/docs/components/offlineManagerLegacy.md @@ -0,0 +1,139 @@ +--- +custom_edit_url: https://github.com/rnmapbox/maps/blob/main/src/modules/offline/offlineManagerLegacy.ts +--- + + + + +```tsx +import { offlineManagerLegacy } from '@rnmapbox/maps'; + +offlineManagerLegacy + +``` +OfflineManagerLegacy implements a singleton (shared object) that manages offline packs. +All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database. +The shared object maintains a canonical collection of offline packs. + + + +## methods +### createPack(options) + +Creates and registers an offline pack that downloads the resources needed to use the given region offline. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | +| `options` | `OfflineCreatePackOptions` | `Yes` | Create options for a offline pack that specifices zoom levels, style url, and the region to download. | + + + +```javascript +await Mapbox.offlineManager.createPack({ + name: 'offlinePack', + styleURL: 'mapbox://...', + minZoom: 14, + maxZoom: 20, + bounds: [[neLng, neLat], [swLng, swLat]] +}) +``` + + +### invalidatePack(name) + +Invalidates the specified offline pack. This method checks that the tiles in the specified offline pack match those from the server. Local tiles that do not match the latest version on the server are updated.This is more efficient than deleting the offline pack and downloading it again. If the data stored locally matches that on the server, new data will not be downloaded. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | +| `name` | `String` | `Yes` | Name of the offline pack. | + + + +```javascript +await Mapbox.offlineManagerLegacy.invalidatePack('packName') +``` + + +### deletePack(name) + +Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | +| `name` | `String` | `Yes` | Name of the offline pack. | + + + +```javascript +await Mapbox.offlineManagerLegacy.deletePack('packName') +``` + + +### migrateOfflineCache() + +Migrates the offline cache from pre-v10 SDKs to the new v10 cache location + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | + + + + +```javascript +await Mapbox.offlineManager.migrateOfflineCache() +``` + + +### resetDatabase() + +Deletes the existing database, which includes both the ambient cache and offline packs, then reinitializes it. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | + + + + +```javascript +await Mapbox.offlineManager.resetDatabase(); +``` + + +### getPacks() + +Retrieves all the current offline packs that are stored in the database. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | + + + + +```javascript +const offlinePacks = await Mapbox.offlineManagerLegacy.getPacks(); +``` + + +### getPack(name) + +Retrieves an offline pack that is stored in the database by name. + +#### arguments +| Name | Type | Required | Description | +| ---- | :--: | :------: | :----------: | +| `name` | `String` | `Yes` | Name of the offline pack. | + + + +```javascript +const offlinePack = await Mapbox.offlineManagerLegacy.getPack(); +``` + + +