summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLOfflineStorage.mm
Commit message (Collapse)AuthorAgeFilesLines
* [ios] Guard against over calling pause or resumeJesse Bounds2017-03-181-0/+9
|
* [darwin] Use explicit initialization rather than global static variables for ↵Konstantin Käfer2017-03-101-0/+3
| | | | | | | | the default RunLoop When linking Mapbox GL as a static library, the object file (MGLFoundation.o) containing the global static variable initialization was not linked into the resulting binary since it was not referenced. This resulted in the RunLoop not being initialized in the main thread. Reverts 03a14ff0003e976a4ded70d284bc80adf54bc6c9
* [ios] Pause file source activity on backgroundJesse Bounds2017-03-011-0/+15
| | | | | | | | | | | This uses the pause/resume API on the default file source to pause network and revalidation activity when the host iOS application goes into the background. Activity is resumed when the host application goes into the foreground. The intention of this change is to avoid edge cases on some OSs where resources (i.e. sqlite) are not available when the host app is not visible to the user.
* [macos,ios] expose callback for transforming URLsKonstantin Käfer2017-02-201-0/+44
|
* Make `MGLOfflinePack` instances post notificationsEimantas Vaiciunas2017-02-061-27/+1
| | | | | | | This commit also gets rid of private `MGLOfflinePackDelegate` protocol. `userInfo` dictionary in notification objects retain the `state` and `progress` values for backwards compatibility. They can be removed in later major release.
* [core] remove trailing whitespace, add trailing newlines, add space after //Konstantin Käfer2017-01-271-6/+6
|
* [ios, macos] Rationalized string enum namesMinh Nguyễn2016-11-021-12/+16
| | | | Renamed MGLGeoJSONSourceOption and MGLOfflinePackUserInfoKey constants for clarity and to remove redundancy in the Swift-bridged names. Left the old MGLOfflinePackUserInfoKey constants in place as deprecated aliases.
* [ios, macos] fixes #6346: add support for configurable API base URL (#6709)Justin R. Miller2016-10-151-0/+16
|
* [ios, macos] Guard against nil bundle identifier during testsJesse Bounds2016-09-281-2/+11
|
* [ios, macos] Offline storage size APIMinh Nguyễn2016-07-181-0/+13
| | | | | | Added a property to MGLOfflineStorage that indicates the disk space occupied by all cached and offline resources. Fixes #5580.
* [ios] Move cache.db to a subdirectory (#5601)Jason Wray2016-07-071-44/+78
| | | | | | | | | | | We cannot guarantee that the offline/ambient tile cache (cache.db) will be created in a timely manner, so it's safer to set the backup exclusion key on its containing directory. But, because we placed cache.db in the base of the app's Application Support directory (where backups are expected to be allowed), we need to move cache.db into a directory that we control and can exclude from backups with impunity. This is an amalgam of https://github.com/mapbox/mapbox-gl-native/pull/5578 (directory exclusion) and https://github.com/mapbox/mapbox-gl-native/pull/5585 (refactored URL methods, but without the new database size method). Also: * Prefix mapbox subdirectory with dot, for extra safety * Update changelog entry with new ticket, less speculation
* [ios] Set backup exclusion flag after initializing DefaultFileSource (#5124)Jason Wray2016-05-241-7/+7
| | | Speculatively fixes #511, where apps mistakenly backup the offline/ambient cache.
* [ios, osx] Updated build system for jazzyMinh Nguyễn2016-04-221-0/+1
| | | | Consolidated NSValue categories to work around realm/jazzy#539. Documented MGLErrorCode. Moved jazzy configuration file into platform/ios/. Removed redundant include/Mapbox.h that was only being used by jazzy, now that the static frameworks’s umbrella header is based on that of the dynamic framework. Moved framework/Mapbox.h to include/Mapbox.h for consistency.
* [ios, osx] Require progress to be requested manuallyMinh Nguyễn2016-03-291-2/+1
| | | | Requesting progress is expensive, so it is once again computed only on demand, rather than automatically at launch. Moved progress requesting back to iosapp and osxapp.
* [ios, osx] Include progress in progress change notificationMinh Nguyễn2016-03-291-1/+6
| | | | An MGLOfflinePackProgressChangedNotification notification now includes the pack’s state and progress values, which match the values in the corresponding MGLOfflinePack properties. Implemented NSValue category methods to store MGLOfflinePackProgress inside a dictionary.
* [osx] Fixed build errorMinh Nguyễn2016-03-291-10/+9
| | | | Fixed an incomplete variable renaming. Don’t bother creating intermediate directories to the legacy cache path. When the main bundle lacks a bundle identifier, as is the case when the SDK runs in the test bundle, fall back on the SDK’s bundle.
* [ios, osx] Allow creating invalid offline packsMinh Nguyễn2016-03-291-0/+5
| | | | | | Removed NS_UNAVAILABLE attribute from -[MGLOfflinePack init]. Packs initialized with this initializer are doomed to invalidity. Fixes #4421.
* [ios, osx] Invalidate packs upon reloadMinh Nguyễn2016-03-291-0/+3
|
* [ios, osx] More accurate KVO, private delegate, descriptive fallback name, ↵Minh Nguyễn2016-03-291-40/+20
| | | | | | | | | | | | fewer reloads Made MGLOfflineStorage.packs strong rather than copy so that KVO notifications on that key path include index paths. Replaced custom KVO mutable collection methods with calls to -mutableArrayValueForKey:, avoiding redundant casts. Privatized MGLOfflinePackDelegate and made its methods required, since MGLOfflineStorage is the only conforming implementation. Require a pack to be explicitly invalidated before deallocation by its owner (MGLOfflineStorage). Added a method to reload the canonical collection of packs. Previously, if the user adds an offline pack without specifying a name in the alert, the pack would be named “Untitled n” for the nth pack created since the application was launched. This logic could result in identically named packs (for example, if the user relaunches and creates another unnamed pack). Instead, use the visible coordinate bounds as a placeholder and fallback name. Resume a pack upon successful addition. Removed an extraneous weakSelf/strongSelf dance. When possible, update individual labels in a cell instead of reloading the entire cell. That way, if the user swipes to the left to reveal the Delete accessory button while the pack is actively downloading, the accessory button remains on screen as progress updates come in.
* [ios, osx] Centralized offline pack managementMinh Nguyễn2016-03-291-12/+98
| | | | | | MGLOfflineStorage now maintains a centralized, strongly held, KVO-compliant collection of all extant offline packs. MGLOfflineStorage issues notifications for progress updates. Client code can now react to the successful addition of an offline pack either via the completion block or via a KVO insertion. Fixes #4287.
* [ios, osx] Exclude offline cache from backupsMinh Nguyễn2016-03-281-0/+6
| | | | Avoid backing up the offline cache onto iCloud, because it can be redownloaded and would easily take up a significant portion of a standard iCloud account. Ideally, we’d even put ambiently cached resources in Caches, so it can be reclaimed by the system when disk space runs low. But unfortunately it has to live in the same file as offline resources.
* [ios, osx] Unified offline and ambient cachesMinh Nguyễn2016-03-181-6/+35
| | | | | | There is now only one instance of mbgl::OfflineFileSource, created when the shared MGLOfflineStorage object is initialized. Also create and use the shared MGLOfflineStorage object when initializing an MGLMapView object. The unified cache file is located in a subdirectory of Application Support, where the SDK has control over the file’s lifetime. The subdirectory is already named after the host application’s bundle identifier, ensuring that each Mapbox-powered application has an independent tile limit. If there’s an ambient cache in a subdirectory of Caches, delete it. If there’s an offline cache in a subdirectory of Documents on iOS or Caches on OS X, move it to the unified cache location in a subdirectory of Application Support. Fixes the iOS/OS X side of #4338.
* [ios, osx] Renamed MGLOfflineTask to MGLOfflinePackMinh Nguyễn2016-03-101-15/+15
| | | | “Offline pack” more effectively communicates the persistent nature of the downloaded content.
* [ios, osx] Tightened offline task stateMinh Nguyễn2016-03-101-2/+3
| | | | Fixed a race condition that could occur if a progress update comes after a call to remove the task but before the removal is complete. Avoid synchronously setting the task’s state inside -resume and -suspend; instead, rely on the observer to set the state asynchronously.
* [ios, osx] Invalidate task immediately upon removalMinh Nguyễn2016-03-101-1/+1
|
* [ios, osx] Documented offline APIsMinh Nguyễn2016-03-101-5/+6
| | | | Also categorized offline symbols for jazzy and moved styleURL from MGLOfflineRegion to MGLTilePyramidOfflineRegion, since you never know if there will be a region type not constrained by a style in the future.
* [ios, osx] Renamed offline classesMinh Nguyễn2016-03-101-0/+150
Renamed SDK classes related to offline viewing to more closely match the terminology used by mbgl and the Android SDK while remaining consistent with Cocoa naming principles.