[iOS] Added update size to context menu in Downloader

https://jira.mail.ru/browse/MAPSME-12871
This commit is contained in:
Alexander 2020-03-10 10:54:55 +03:00 committed by Aleksey Belousov
parent 8510918108
commit fc98524cf1
3 changed files with 11 additions and 1 deletions

View file

@ -34,6 +34,7 @@ NS_SWIFT_NAME(MapNodeAttributes)
@property(nonatomic, readonly) uint64_t totalSize;
@property(nonatomic, readonly) uint64_t downloadedSize;
@property(nonatomic, readonly) uint64_t downloadingSize;
@property(nonatomic, readonly) uint64_t totalUpdateSizeBytes;
@property(nonatomic, readonly) NSString *nodeName;
@property(nonatomic, readonly) NSString *nodeDescription;
@property(nonatomic, readonly) MWMMapNodeStatus nodeStatus;

View file

@ -1,4 +1,5 @@
#import "MWMMapNodeAttributes+Core.h"
#include <CoreApi/Framework.h>
static MWMMapNodeStatus convertStatus(storage::NodeStatus status) {
switch (status) {
@ -77,6 +78,13 @@ static MWMMapNodeStatus convertStatus(storage::NodeStatus status) {
_hasChildren = hasChildren;
_hasParent = hasParent;
storage::Storage::UpdateInfo updateInfo;
if (GetFramework().GetStorage().GetUpdateInfo([countryId UTF8String], updateInfo)) {
_totalUpdateSizeBytes = updateInfo.m_totalUpdateSizeInBytes;
} else {
_totalUpdateSizeBytes = 0;
}
NSMutableArray *parentInfoArray = [NSMutableArray arrayWithCapacity:attributes.m_parentInfo.size()];
for (auto const &pi : attributes.m_parentInfo) {
MWMCountryIdAndName *cn = [[MWMCountryIdAndName alloc] initWithCountryAndName:pi];

View file

@ -127,7 +127,8 @@ class DownloadMapsViewController: MWMViewController {
Storage.downloadNode(nodeAttrs.countryId)
})
case .update:
let title = "\(L("downloader_status_outdated")) (TODO: updated size)"
let size = formattedSize(nodeAttrs.totalUpdateSizeBytes)
let title = "\(L("downloader_status_outdated")) \(size)"
action = UIAlertAction(title: title, style: .default, handler: { _ in
Storage.updateNode(nodeAttrs.countryId)
})