Commit 35fd9c90 authored by A. Wilcox's avatar A. Wilcox

iUI: ItemVC: Add two methods and show # of tags/mats on Etsy item.

-materialsForEtsyItem retrieves an NSArray of materials.
-tagsForEtsyItem retrieves an NSArray of tags.

Because the ItemVC OBVIOUSLY wasn't already doing enough.
parent 68cdb4bd
......@@ -49,8 +49,10 @@ extern const char *site_names[3];
@interface ItemViewController(Internal)
-(void)cancelTimers;
-(NSArray *)materialsForEtsyItem:(EtsyItem *)item;
-(void)sellSimilar;
-(void)setTimers;
-(NSArray *)tagsForEtsyItem:(EtsyItem *)item;
-(void)updateCategoryCells;
-(void)updateHeader;
-(void)updateHeaderFrame;
......@@ -809,6 +811,36 @@ extern const char *site_names[3];
}
-(NSArray *)materialsForEtsyItem:(EtsyItem *)etsyItem
{
vector<const char *> *raw_materials = etsyItem->getMaterials();
NSMutableArray *materials = [NSMutableArray arrayWithCapacity:raw_materials->size()];
for(size_t next_elem = 0; next_elem < raw_materials->size(); next_elem++)
{
[materials addObject:[NSString stringWithCString:raw_materials->at(next_elem) encoding:NSASCIIStringEncoding]];
}
delete raw_materials;
return materials;
}
-(NSArray *)tagsForEtsyItem:(EtsyItem *)etsyItem
{
vector<const char *> *raw_tags = etsyItem->getTags();
NSMutableArray *tags = [NSMutableArray arrayWithCapacity:raw_tags->size()];
for(size_t next_tag = 0; next_tag < raw_tags->size(); next_tag++)
{
[tags addObject:[NSString stringWithCString:raw_tags->at(next_tag) encoding:NSASCIIStringEncoding]];
}
delete raw_tags;
return tags;
}
-(void)updateHeaderFrame
{
CGFloat addition = (isEditingHax ? 40.0 : 0.0);
......@@ -1162,6 +1194,33 @@ extern const char *site_names[3];
[priceSectionCells addObject:cell];
}
if(item->parent()->siteCode() == SITE_ETSY)
{
EtsyItem *etsy = static_cast<EtsyItem *>(item);
/* Tags */
cell = [self getPriceCell];
cell.textLabel.text = @"tags";
cell.detailTextLabel.text = [NSString stringWithFormat:@"%lu tag%@", etsy->tagCount(), (etsy->tagCount() > 1 ? @"s" : @"")];
cell.editableTextField.leftView = nil;
cell.textEditingStyle = WTEditableCellEditingStyleNone;
cell.tag = CELLTAG_TAGS;
[priceSectionCells addObject:cell];
/* Materials */
cell = [self getPriceCell];
cell.textLabel.text = @"materials";
cell.detailTextLabel.text = [NSString stringWithFormat:@"%lu tag%@", etsy->materialCount(), (etsy->materialCount() > 1 ? @"s" : @"")];
cell.editableTextField.leftView = nil;
cell.textEditingStyle = WTEditableCellEditingStyleNone;
cell.tag = CELLTAG_MATERIALS;
[priceSectionCells addObject:cell];
}
NSUInteger newPriceCellCount = [priceSectionCells count];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment