Commit Graph

6 Commits

Author SHA1 Message Date
Minh Nguyễn
38116e39c5 [ios, osx] Require progress to be requested manually
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.
2016-03-29 11:46:27 -07:00
Minh Nguyễn
55f1ad11c4 [ios, osx] More accurate KVO, private delegate, descriptive fallback name, 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.
2016-03-29 11:46:26 -07:00
Minh Nguyễn
a1e5701fa3 [ios, osx] Centralized offline pack management
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.
2016-03-29 11:46:25 -07:00
Minh Nguyễn
6f86bee283 [ios] Only set preferred action on iOS 9+
Fixed a crash on iOS 8 when presenting the Add Offline Pack dialog.

Fixes #4305.
2016-03-14 13:30:11 -07:00
Minh Nguyễn
922269cd7c [ios] Immediately remove offline pack from table
Remove all references to an offline pack before the call to -removePackWithCompletionHander:.

Cherry-picked from d64b8ad25c.
2016-03-14 12:54:10 -07:00
Minh Nguyễn
641c31507d [ios] Renamed downloads to offline packs in iosapp 2016-03-10 17:14:14 -08:00