Skip to content

Commit

Permalink
Remove unused media upload code from PostSettingsViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jan 8, 2025
1 parent 7483497 commit d2c05f0
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension HomeSiteHeaderViewController {
mediaMenu.makeCameraAction(delegate: presenter),
mediaMenu.makeImagePlaygroundAction(delegate: presenter),
mediaMenu.makeSiteMediaAction(blog: blog, delegate: presenter)
]
].compactMap { $0 }
if FeatureFlag.siteIconCreator.enabled {
actions.append(UIAction(
title: SiteIconAlertStrings.Actions.createWithEmoji,
Expand Down
27 changes: 0 additions & 27 deletions WordPress/Classes/ViewRelated/Cells/PostFeaturedImageCell.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class SiteMediaAddMediaMenuController: NSObject, PHPickerViewControllerDel
menu.makeCameraAction(delegate: self),
menu.makeImagePlaygroundAction(delegate: self),
makeDocumentPickerAction(from: viewController)
])
].compactMap { $0 })
]
let freeMediaActions: [UIAction] = [
menu.makeStockPhotos(blog: blog, delegate: self),
Expand Down

This file was deleted.

63 changes: 2 additions & 61 deletions WordPress/Classes/ViewRelated/Post/PostSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ typedef NS_ENUM(NSInteger, PostSettingsRow) {
PostSettingsRowVisibility,
PostSettingsRowFormat,
PostSettingsRowFeaturedImage,
PostSettingsRowFeaturedImageAdd,
PostSettingsRowFeaturedImageRemove,
PostSettingsRowFeaturedLoading,
PostSettingsRowShareConnection,
PostSettingsRowShareMessage,
PostSettingsRowSlug,
Expand All @@ -39,8 +36,6 @@ typedef NS_ENUM(NSInteger, PostSettingsRow) {
};

static NSString *const PostSettingsAnalyticsTrackingSource = @"post_settings";
static NSString *const TableViewActivityCellIdentifier = @"TableViewActivityCellIdentifier";
static NSString *const TableViewProgressCellIdentifier = @"TableViewProgressCellIdentifier";
static NSString *const TableViewFeaturedImageCellIdentifier = @"TableViewFeaturedImageCellIdentifier";
static NSString *const TableViewToggleCellIdentifier = @"TableViewToggleCellIdentifier";
static NSString *const TableViewGenericCellIdentifier = @"TableViewGenericCellIdentifier";
Expand Down Expand Up @@ -83,8 +78,6 @@ @implementation PostSettingsViewController
- (void)dealloc
{
[self.internetReachability stopNotifier];

[self removeMediaObserver];
}

- (instancetype)initWithPost:(AbstractPost *)aPost
Expand Down Expand Up @@ -119,8 +112,6 @@ - (void)viewDidLoad
[self setupFormatsList];
[self setupPublicizeConnections];

[self.tableView registerNib:[UINib nibWithNibName:@"WPTableViewActivityCell" bundle:nil] forCellReuseIdentifier:TableViewActivityCellIdentifier];
[self.tableView registerClass:[WPProgressTableViewCell class] forCellReuseIdentifier:TableViewProgressCellIdentifier];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:TableViewFeaturedImageCellIdentifier];
[self.tableView registerClass:[SwitchTableViewCell class] forCellReuseIdentifier:TableViewToggleCellIdentifier];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:TableViewGenericCellIdentifier];
Expand All @@ -131,7 +122,6 @@ - (void)viewDidLoad
// Compensate for the first section's height of 1.0f
self.tableView.contentInset = UIEdgeInsetsMake(-1.0f, 0, 0, 0);
self.tableView.accessibilityIdentifier = @"SettingsTable";
self.isUploadingMedia = NO;

self.featuredImageViewModel.tableView = self.tableView;

Expand Down Expand Up @@ -490,10 +480,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[self showPostFormatSelector];
} else if (cell.tag == PostSettingsRowFeaturedImage) {
[self showFeaturedImageSelector];
} else if (cell.tag == PostSettingsRowFeaturedImageAdd) {
[self showFeaturedImageSelector];
} else if (cell.tag == PostSettingsRowFeaturedImageRemove) {
[self showFeaturedImageRemoveOrRetryActionAtIndexPath:indexPath];
} else if (sec == PostSettingsSectionDisabledTwitter) {
[self showShareDetailForIndexPath:indexPath];
} else if (cell.tag == PostSettingsRowShareConnection) {
Expand Down Expand Up @@ -644,7 +630,7 @@ - (UITableViewCell *)makeFeaturedImageCellForIndexPath:(NSIndexPath *)indexPath
cell.tag = PostSettingsRowFeaturedImage;
return cell;

// TODO: remove unused code
// TODO: (kean) remove unused code
// if (!self.apost.featuredImage && !self.isUploadingMedia) {
// return [self cellForSetFeaturedImage];
//
Expand Down Expand Up @@ -684,41 +670,7 @@ - (UITableViewCell *)configureStickyPostCellForIndexPath:(NSIndexPath *)indexPat
return cell;
}

- (UITableViewCell *)cellForSetFeaturedImage
{
UITableViewCell *cell = [self makeSetFeaturedImageCell];
cell.tag = PostSettingsRowFeaturedImageAdd;
return cell;
}

- (UITableViewCell *)cellForFeaturedImageError
{
WPTableViewActivityCell *activityCell = [self getWPTableViewActivityCell];
activityCell.textLabel.text = NSLocalizedString(@"Upload failed. Tap for options.", @"Description to show on post setting for a featured image that failed to upload.");
activityCell.tag = PostSettingsRowFeaturedImageRemove;
return activityCell;
}

- (UITableViewCell *)cellForFeaturedImageUploadProgressAtIndexPath:(NSIndexPath *)indexPath
{
self.progressCell = [self.tableView dequeueReusableCellWithIdentifier:TableViewProgressCellIdentifier forIndexPath:indexPath];
[WPStyleGuide configureTableViewCell:self.progressCell];
[self.progressCell setProgress:self.featuredImageProgress];
self.progressCell.tag = PostSettingsRowFeaturedLoading;
return self.progressCell;
}

- (UITableViewCell *)cellForFeaturedImageWithURL:(nonnull NSURL *)featuredURL atIndexPath:(NSIndexPath *)indexPath
{
// TODO: remove
return [UITableViewCell new];

// PostFeaturedImageCell *featuredImageCell = [self.tableView dequeueReusableCellWithIdentifier:TableViewFeaturedImageCellIdentifier forIndexPath:indexPath];
// [featuredImageCell setImageWithURL:featuredURL post:self.apost];
// featuredImageCell.tag = PostSettingsRowFeaturedImage;
// return featuredImageCell;
}

// TODO: (kean) remove
- (nullable NSURL *)urlForFeaturedImage {
NSURL *featuredURL = self.apost.featuredImage.absoluteLocalURL;

Expand Down Expand Up @@ -862,17 +814,6 @@ - (WPTableViewCell *)getWPTableViewImageAndAccessoryCell
return cell;
}

- (WPTableViewActivityCell *)getWPTableViewActivityCell
{
WPTableViewActivityCell *cell = [self.tableView dequeueReusableCellWithIdentifier:TableViewActivityCellIdentifier];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
[WPStyleGuide configureTableViewActionCell:cell];

cell.tag = 0;
return cell;
}

- (void)showPostAuthorSelector
{
PostAuthorSelectorViewController *vc = [[PostAuthorSelectorViewController alloc] init:self.apost];
Expand Down
Loading

0 comments on commit d2c05f0

Please sign in to comment.