Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,7 @@ - (void)configureCell:(UITableViewCell *)aCell atIndexPath:(NSIndexPath *)indexP
__weak __typeof(self) weakSelf = self;

cell.accessoryButtonAction = ^(UIView * _Nonnull sourceView) {
if (comment && [self isModerationMenuEnabledFor:comment]) {
// NOTE: Remove when minimum version is bumped to iOS 14.
[self showMenuSheetFor:comment indexPath:indexPath handler:weakSelf.tableViewHandler sourceView:sourceView];
} else if (comment) {
if (comment) {
[self shareComment:comment sourceView:sourceView];
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,6 @@ extension NSNotification.Name {
present(activityViewController, animated: true, completion: nil)
}

/// Shows a contextual menu through `UIPopoverPresentationController`. This is a fallback implementation for iOS 13, since the menu can't be
/// shown programmatically or through a single tap.
///
/// NOTE: Remove this once we bump the minimum version to iOS 14.
///
func showMenuSheet(for comment: Comment, indexPath: IndexPath, handler: WPTableViewHandler, sourceView: UIView?) {
let commentMenus = commentMenu(for: comment, indexPath: indexPath, handler: handler, sourceView: sourceView)
let menuViewController = MenuSheetViewController(items: commentMenus.map { menuSection in
// Convert ReaderCommentMenu to MenuSheetViewController.MenuItem
menuSection.map { $0.toMenuItem }
})

menuViewController.modalPresentationStyle = .popover
if let popoverPresentationController = menuViewController.popoverPresentationController {
popoverPresentationController.delegate = self
popoverPresentationController.sourceView = sourceView
popoverPresentationController.sourceRect = sourceView?.bounds ?? .null
}

present(menuViewController, animated: true)
}

func isModerationMenuEnabled(for comment: Comment) -> Bool {
return comment.allowsModeration()
}
Expand Down Expand Up @@ -398,18 +376,4 @@ enum ReaderCommentMenu {
}
}
}

/// NOTE: Remove when minimum version is bumped to iOS 14.
var toMenuItem: MenuSheetViewController.MenuItem {
switch self {
case .unapprove(let handler),
.spam(let handler),
.trash(let handler),
.edit(let handler),
.share(let handler):
return MenuSheetViewController.MenuItem(title: title, image: image) {
handler()
}
}
}
}
171 changes: 0 additions & 171 deletions WordPress/Classes/ViewRelated/Views/MenuSheetViewController.swift

This file was deleted.

6 changes: 0 additions & 6 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5500,8 +5500,6 @@
FE2E3729281C839C00A1E82A /* BloggingPromptsServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE2E3728281C839C00A1E82A /* BloggingPromptsServiceTests.swift */; };
FE320CC5294705990046899B /* ReaderPostBackupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE320CC4294705990046899B /* ReaderPostBackupTests.swift */; };
FE32E7F12844971000744D80 /* ReminderScheduleCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32E7F02844971000744D80 /* ReminderScheduleCoordinatorTests.swift */; };
FE32EFFF275914390040BE67 /* MenuSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32EFFE275914390040BE67 /* MenuSheetViewController.swift */; };
FE32F000275914390040BE67 /* MenuSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32EFFE275914390040BE67 /* MenuSheetViewController.swift */; };
FE32F002275F602E0040BE67 /* CommentContentRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32F001275F602E0040BE67 /* CommentContentRenderer.swift */; };
FE32F003275F602E0040BE67 /* CommentContentRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32F001275F602E0040BE67 /* CommentContentRenderer.swift */; };
FE32F006275F62620040BE67 /* WebCommentContentRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE32F005275F62620040BE67 /* WebCommentContentRenderer.swift */; };
Expand Down Expand Up @@ -9296,7 +9294,6 @@
FE320CC4294705990046899B /* ReaderPostBackupTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderPostBackupTests.swift; sourceTree = "<group>"; };
FE32E7F02844971000744D80 /* ReminderScheduleCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReminderScheduleCoordinatorTests.swift; sourceTree = "<group>"; };
FE32E7F32846A68800744D80 /* WordPress 142.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 142.xcdatamodel"; sourceTree = "<group>"; };
FE32EFFE275914390040BE67 /* MenuSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuSheetViewController.swift; sourceTree = "<group>"; };
FE32F001275F602E0040BE67 /* CommentContentRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentContentRenderer.swift; sourceTree = "<group>"; };
FE32F005275F62620040BE67 /* WebCommentContentRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebCommentContentRenderer.swift; sourceTree = "<group>"; };
FE341704275FA157005D5CA7 /* RichCommentContentRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RichCommentContentRenderer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9763,7 +9760,6 @@
37EAAF4C1A11799A006D6306 /* CircularImageView.swift */,
ADF544C0195A0F620092213D /* CustomHighlightButton.h */,
ADF544C1195A0F620092213D /* CustomHighlightButton.m */,
FE32EFFE275914390040BE67 /* MenuSheetViewController.swift */,
B5B410B51B1772B000CFCF8D /* NavigationTitleView.swift */,
982A4C3420227D6700B5518E /* NoResultsViewController.swift */,
98B33C87202283860071E1E2 /* NoResults.storyboard */,
Expand Down Expand Up @@ -21643,7 +21639,6 @@
2481B17F260D4D4E00AE59DB /* WPAccount+Lookup.swift in Sources */,
7E3E9B702177C9DC00FD5797 /* GutenbergViewController.swift in Sources */,
800035C1292307E8007D2D26 /* ExtensionConfiguration.swift in Sources */,
FE32EFFF275914390040BE67 /* MenuSheetViewController.swift in Sources */,
3FC7F89E2612341900FD8728 /* UnifiedPrologueStatsContentView.swift in Sources */,
7D21280D251CF0850086DD2C /* EditPageViewController.swift in Sources */,
738B9A4F21B85CF20005062B /* SiteCreator.swift in Sources */,
Expand Down Expand Up @@ -23919,7 +23914,6 @@
FABB21612602FC2C00C8785C /* ReaderShowAttributionAction.swift in Sources */,
FABB21622602FC2C00C8785C /* LinkSettingsViewController.swift in Sources */,
9856A39E261FC21E008D6354 /* UserProfileUserInfoCell.swift in Sources */,
FE32F000275914390040BE67 /* MenuSheetViewController.swift in Sources */,
FABB21632602FC2C00C8785C /* FeatureItemCell.swift in Sources */,
C3FBF4E928AFEDF8003797DF /* JetpackBrandingAnalyticsHelper.swift in Sources */,
803C493C283A7C0C00003E9B /* QuickStartChecklistHeader.swift in Sources */,
Expand Down