Options
All
  • Public
  • Public/Protected
  • All
Menu

Manages offline state. Chief among the offline state is the offline map which defines what data will be available offline and how offline requests are handled. Offline profiles that are added may be activated when offline.

Hierarchy

  • OfflineManager

Index

Constructors

constructor

Properties

aoiMask

The mask that hides everything outside of the offline map area of interest. Can be configured.

app

canCancel

canCancel: Observable<boolean>

Whether or not the current job can be canceled

currentOperation

currentOperation: OfflineManagerOperation

The current operation being performed by the OfflineManager.

isOfflineMapActive

isOfflineMapActive: Observable<boolean>

An indiciator of whether or not there is an active offline map. This property is preferable to app.isOffline (which is deprecated) because it more accurately describes the state of the application. There is no binary online/offline switch, so app.isOffline is misleading. Even though an offline map is active, the device may still have internet connectivity.

libraryId

libraryId: string

syncInfo

syncInfo: SyncInfo

Information about the currently active offline map.

Methods

activateOfflineMap

  • activateOfflineMap(offlineMapOrId: string | OfflineMap, userAction?: boolean): Promise<void>
  • Make an offline map active. When offline this is the data from which offline data is served.

    Parameters

    • offlineMapOrId: string | OfflineMap
    • Optional userAction: boolean

      Set to true if the activation is happening as a result of the user explicitly clicking a button to activate the offline map. Set to false if the activation is happening automatically without the user explicitly activating the offline map.

    Returns Promise<void>

addOfflineMap

  • addOfflineMap(offlineMap: OfflineMap, progress?: function): Promise<void>
  • Add an offline map. The site information and features are downloaded.

    Parameters

    • offlineMap: OfflineMap

      The offline map to add.

    • Optional progress: function

      An optional callback for a stream of progress messages.

    Returns Promise<void>

cancel

  • cancel(): Promise<void>
  • Cancels the current sync or download.

    Returns Promise<void>

deactivateOfflineMap

  • deactivateOfflineMap(userAction?: boolean): Promise<void>
  • Make no offline map active. This will succeed even if there is no active profile.

    Parameters

    • Optional userAction: boolean

      Set to true if the activation is happening as a result of the user explicitly clicking a button to activate the offline map. Set to false if the activation is happening automatically without the user explicitly activating the offline map.

    Returns Promise<void>

forgetLast

  • forgetLast(): void
  • Clears out the last operation, so that the next operation can just go ahead without waiting for the last operation to complete. This should be used with caution, only called in extreme circumstances - for example if the last operation is hung.

    Returns void

getActiveOfflineMap

  • Get the currently active offline map or null if none.

    Returns OfflineMap

getActiveOfflineMapWithState

  • getActiveOfflineMapWithState(): object
  • Get the currently active offline map with state or null if none.

    Returns object

getOfflineMapById

  • getOfflineMapById(offlineMapId: string): OfflineMap
  • Get the offline map with the given ID or null if not found.

    Parameters

    • offlineMapId: string

    Returns OfflineMap

getOfflineMapWithStateById

  • getOfflineMapWithStateById(offlineMapId: string): object
  • Get the offline map state with the given ID or null if not found.

    Parameters

    • offlineMapId: string

    Returns object

getOfflineMaps

  • Get all offline maps.

    Returns OfflineMap[]

getOfflineMapsWithState

  • getOfflineMapsWithState(): object[]
  • Get all offline maps with state and sync info.

    Returns object[]

getResource

  • getResource(key: string): string
  • Parameters

    • key: string

    Returns string

getStoreResource

  • getStoreResource(offlineMap: OfflineMap, key: string): Promise<string>
  • Gets a resource from the store with the specified key, for the specified offline map.

    Parameters

    Returns Promise<string>

hasInternetCheck

  • hasInternetCheck(): Promise<any>
  • Checks to see if the host can be accessed, indicating that there is connectivity

    Returns Promise<any>

    An object whose result indicates if there is connectivity to the site's host

load

  • load(): Promise<void>
  • Load the state of the OfflineManager from storage. This should only be called on start up.

    Returns Promise<void>

openLink

  • openLink(link: string): Promise<any>
  • Parameters

    • link: string

    Returns Promise<any>

refreshSyncInfo

  • Refresh the sync info object.

    Parameters

    Returns Promise<SyncInfo>

removeOfflineMap

  • removeOfflineMap(offlineMap: string | OfflineMap, progress?: function): Promise<void>
  • Remove an offline map. The site information and feature data is deleted.

    Parameters

    • offlineMap: string | OfflineMap

      The offline map to remove, or its ID.

    • Optional progress: function

      An optional callback for a stream of progress messages.

        • (message: string): void
        • Parameters

          • message: string

          Returns void

    Returns Promise<void>

removeOfflineMapPartialData

  • removeOfflineMapPartialData(offlineMap: OfflineMap, firstDownload: boolean): Promise<void>
  • Remove an offline map. The site information and feature data is deleted.

    Parameters

    • offlineMap: OfflineMap

      The offline map to remove, or its ID.

    • firstDownload: boolean

    Returns Promise<void>

setStoreResource

  • setStoreResource(offlineMap: OfflineMap, key: string, value: string): Promise<void>
  • Gets a resource from the store with the specified key, for the specified offline map.

    Parameters

    • offlineMap: OfflineMap
    • key: string
    • value: string

    Returns Promise<void>

syncFeatureData

  • syncFeatureData(offlineMaps: OfflineMap[], totalProgress?: function): Promise<void[]>
  • Parameters

    • offlineMaps: OfflineMap[]
    • Optional totalProgress: function

    Returns Promise<void[]>

syncOfflineMap

  • syncOfflineMap(offlineMapOrId: string | OfflineMap, progress?: function, syncSteps?: SyncSteps): Promise<any>
  • Sync an offline map. Edits are sent to the server, then feature data redownloaded, then the site data is redownloaded.

    Parameters

    • offlineMapOrId: string | OfflineMap

      The offline map to sync, or its ID.

    • Optional progress: function

      An optional callback for a stream of progress messages.

    • Optional syncSteps: SyncSteps

    Returns Promise<any>

updateBundle

  • updateBundle(offlineMap: string | OfflineMap): Promise<void>
  • Updates the bundle for an offline map without syncing.

    Parameters

    • offlineMap: string | OfflineMap

      The offline map to sync, or its ID.

    Returns Promise<void>

updatePrincipal

  • updatePrincipal(): Promise<void[]>
  • Updates the site principal for each offline map that matches the current site.

    Returns Promise<void[]>