Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 6 additions & 53 deletions Sources/Controllers/Cloud/OAStatusBackupTableViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ - (void) setupDownloadingCellHelper
__weak OAStatusBackupTableViewController *weakSelf = self;
_downloadingCellCloudHelper = [[DownloadingCellCloudHelper alloc] init];
[_downloadingCellCloudHelper setHostTableView:weakSelf.tableView];
_downloadingCellCloudHelper.rightIconStyle = DownloadingCellRightIconTypeShowShevronBeforeDownloading;
if (_tableType == EOARecentChangesConflicts)
{
_downloadingCellCloudHelper.rightIconStyle = DownloadingCellRightIconTypeShowIconAndShevronAlways;
_downloadingCellCloudHelper.rightIconStyle = DownloadingCellRightIconTypeShowIconAndShevronBeforeDownloading;
_downloadingCellCloudHelper.rightIconName = @"ic_custom_alert";
_downloadingCellCloudHelper.rightIconColor = [UIColor colorNamed:ACColorNameIconColorDisruptive];
}
Expand Down Expand Up @@ -318,15 +317,12 @@ - (void)generateData
EOABackupSyncOperationType operation = it.deleted ? EOABackupSyncOperationDelete
: _tableType == EOARecentChangesLocal ? EOABackupSyncOperationUpload : EOABackupSyncOperationDownload;
OATableRowData *rowData = [self rowFromKey:it.key
mainTint:it.deleted ? [UIColor colorNamed:ACColorNameIconColorActive] : [UIColor colorNamed:ACColorNameIconColorDisabled]
secondaryColorName:it.deleted ? ACColorNameIconColorDisruptive : ACColorNameIconColorActive
operation:operation
localFile:it.localFile
remoteFile:it.remoteFile];
if (rowData)
[itemsSection addRow:rowData];
}

}
else if (_tableType == EOARecentChangesConflicts)
{
Expand Down Expand Up @@ -403,8 +399,6 @@ - (OATableRowData *)rowFromConflictItems:(NSString *)key
remoteFile:(OARemoteFile *)remoteFile
{
OATableRowData *rowData = [self rowFromKey:key
mainTint:[UIColor colorNamed:ACColorNameIconColorDisabled]
secondaryColorName:ACColorNameIconColorDefault
operation:EOABackupSyncOperationNone
localFile:localFile
remoteFile:remoteFile];
Expand All @@ -420,15 +414,11 @@ - (OATableRowData *)rowFromConflictItems:(NSString *)key
NSForegroundColorAttributeName : [UIColor colorNamed:ACColorNameTextColorSecondary] }
range:[attributedDescr.string rangeOfString:rowData.descr]];
[rowData setObj:attributedDescr forKey:@"descrAttr"];
[rowData setObj:@"ic_custom_alert" forKey:@"secondaryIconConflict"];
[rowData setObj:ACColorNameIconColorDisruptive forKey:@"secondaryIconColorName"];
[rowData setIconTintColor:[UIColor colorNamed:ACColorNameIconColorActive]];
return rowData;
}

- (OATableRowData *)rowFromKey:(NSString *)key
mainTint:(UIColor *)mainTint
secondaryColorName:(NSString *)secondaryColorName
operation:(EOABackupSyncOperationType)operation
localFile:(OALocalFile *)localFile
remoteFile:(OARemoteFile *)remoteFile
Expand Down Expand Up @@ -505,8 +495,6 @@ - (OATableRowData *)rowFromKey:(NSString *)key
kCellTypeKey: [OARightIconTableViewCell getCellIdentifier],
kCellTitleKey: name,
kCellDescrKey: description,
kCellIconTintColor: mainTint,
@"secondaryIconColorName": secondaryColorName,
@"operation": @(operation),
@"fileName": fileName,
@"settingsItem": settingsItem
Expand Down Expand Up @@ -649,46 +637,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
OASettingsItem *settingsItem = [item objForKey:@"settingsItem"];
NSString *type = [OASettingsItemType typeName:settingsItem.type];
NSString *resourceId = [_downloadingCellCloudHelper getResourceIdWithTypeName:type filename:[item stringForKey:@"fileName"]];
DownloadingCell *cell = [_downloadingCellCloudHelper getOrCreateCell:resourceId];
if (cell)
{
BOOL hasConflict = (EOABackupSyncOperationType) [item integerForKey:@"operation"] == EOABackupSyncOperationNone;
cell.separatorInset = UIEdgeInsetsMake(0., [OAUtilities getLeftMargin] + kPaddingToLeftOfContentWithIcon, 0., 0.);
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

NSString *description = item.descr;
NSAttributedString *descriptionAttributed = [item objForKey:@"descrAttr"];
[cell descriptionVisibility:description != nil || descriptionAttributed != nil];
if (descriptionAttributed)
{
cell.descriptionLabel.text = nil;
cell.descriptionLabel.attributedText = descriptionAttributed;
}
else
{
cell.descriptionLabel.attributedText = nil;
cell.descriptionLabel.text = description;
}

cell.titleLabel.text = item.title;
[cell leftIconVisibility:YES];
cell.leftIconView.image = [[item objForKey:@"icon"] imageFlippedForRightToLeftLayoutDirection];
cell.leftIconView.tintColor = item.iconTintColor;

NSString *secondaryIconName = hasConflict ? [item stringForKey:@"secondaryIconConflict"] : item.secondaryIconName;
if (secondaryIconName.length > 0)
{
cell.rightIconView.image = [UIImage templateImageNamed:secondaryIconName];
cell.rightIconView.tintColor = [UIColor colorNamed:[item stringForKey:@"secondaryIconColorName"]];
[cell rightIconVisibility:YES];
}
else
{
cell.rightIconView.image = nil;
[cell rightIconVisibility:NO];
}
}
return cell;
return [_downloadingCellCloudHelper getOrCreateCell:resourceId
title:item.title
desc:[item objForKey:@"descrAttr"] ?: item.descr
leftIcon:[[item objForKey:@"icon"] imageFlippedForRightToLeftLayoutDirection]
isDownloading:[_downloadingCellCloudHelper isDownloading:resourceId]];
}
else if ([item.cellType isEqualToString:[OALargeImageTitleDescrTableViewCell getCellIdentifier]])
{
Expand Down
12 changes: 2 additions & 10 deletions Sources/Controllers/Resources/OAManageResourcesViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2670,23 +2670,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
if ([item_ isKindOfClass:OAMultipleResourceItem.class] && ([self.region hasGroupItems] || ((OAResourceItem *) item_).resourceType == OsmAndResourceType::SrtmMapRegion))
{
OAMultipleResourceItem *item = (OAMultipleResourceItem *) item_;
UIColor *color = [UIColor colorNamed:ACColorNameIconColorDisabled];
NSArray<OAResourceItem *> *items = [self.region hasGroupItems] ? [self.region.groupItem getItems:item.resourceType] : item.items;
NSString *resourceId = [item getResourceId];
OAMultipleResourceSwiftItem *mapItem = [[OAMultipleResourceSwiftItem alloc] initWithItem:item];
DownloadingCell *downloadingCell = [_downloadingCellMultipleResourceHelper getOrCreateCell:resourceId swiftResourceItem:mapItem];
downloadingCell.titleLabel.text = title;
downloadingCell.descriptionLabel.text = subtitle;
return downloadingCell;
return [_downloadingCellMultipleResourceHelper getOrCreateCell:resourceId swiftResourceItem:mapItem title:title desc:subtitle];
}
else if ([item_ isKindOfClass:OAResourceItem.class] || [item_ isKindOfClass:OASearchResult.class])
{
OAResourceItem *item = (OAResourceItem *) ([item_ isKindOfClass:OASearchResult.class] ? ((OASearchResult *) item_).relatedObject : item_);
OAResourceSwiftItem *mapItem = [[OAResourceSwiftItem alloc] initWithItem:item];
DownloadingCell *downloadingCell = [_downloadingCellResourceHelper getOrCreateCell:mapItem.resourceId swiftResourceItem:mapItem];
downloadingCell.titleLabel.text = title;
downloadingCell.descriptionLabel.text = subtitle;
return downloadingCell;
return [_downloadingCellResourceHelper getOrCreateCell:mapItem.resourceId swiftResourceItem:mapItem title:title desc:subtitle];
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,7 @@ - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
else if (indexPath.section == _availableMapsSection)
{
OAResourceSwiftItem *mapItem = [[OAResourceSwiftItem alloc] initWithItem:_resourcesItems[indexPath.row]];
DownloadingCell *cell = [_downloadingCellResourceHelper getOrCreateCell:mapItem.resourceId swiftResourceItem:mapItem];
cell.titleLabel.text = title;
cell.descriptionLabel.text = description;
return cell;
return [_downloadingCellResourceHelper getOrCreateCell:mapItem.resourceId swiftResourceItem:mapItem title:title desc:description];
}
return nil;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,12 +928,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
else if ([item[@"type"] isEqualToString:@"downloading_cell"])
{
OAResourceSwiftItem *mapItem = [[OAResourceSwiftItem alloc] initWithItem:item[@"resource"]];
DownloadingCell *cell = [_downloadingCellResourceHelper getOrCreateCell:item[@"resourceId"] swiftResourceItem:mapItem];
DownloadingCell *cell = [_downloadingCellResourceHelper getOrCreateCell:item[@"resourceId"] swiftResourceItem:mapItem title:item[@"title"] desc:item[@"description"]];
[cell leftIconVisibility:NO];
[cell rightIconVisibility:NO];
[cell descriptionVisibility:YES];
cell.titleLabel.text = item[@"title"];
cell.descriptionLabel.attributedText = item[@"description"];
return cell;
}
else if ([item[@"type"] isEqualToString:[OASimpleTableViewCell getCellIdentifier]])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,8 @@ final class TravelExploreViewController: OABaseNavbarViewController, TravelExplo

if item.cellType == "kDownloadCellKey" {
if let resource = getSwiftResourceByIndex(indexPath: indexPath) {
outCell = downloadingCellResourceHelper.getOrCreateCell(resource.resourceId(), swiftResourceItem: resource)
outCell = downloadingCellResourceHelper.getOrCreateCell(resource.resourceId(), swiftResourceItem: resource, title: nil, desc: "")
}

} else if item.cellType == OAFilledButtonCell.getIdentifier() {
var cell = tableView.dequeueReusableCell(withIdentifier: OAFilledButtonCell.getIdentifier()) as? OAFilledButtonCell
if cell == nil {
Expand Down
Loading