Skip to content

Commit

Permalink
Remove FXIOS-6896 [v121] Remove share extension coordinator feature f…
Browse files Browse the repository at this point in the history
…lag (#17350)
  • Loading branch information
lmarceau authored Nov 17, 2023
1 parent 4885190 commit da194ae
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 120 deletions.
5 changes: 2 additions & 3 deletions Client/Coordinators/Browser/BrowserCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ class BrowserCoordinator: BaseCoordinator,
homepageViewController.libraryPanelDelegate = libraryPanelDelegate
homepageViewController.sendToDeviceDelegate = sendToDeviceDelegate
homepageViewController.statusBarScrollDelegate = statusBarScrollDelegate
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
homepageViewController.browserNavigationHandler = self
}
homepageViewController.browserNavigationHandler = self

return homepageViewController
}
}
Expand Down
4 changes: 0 additions & 4 deletions Client/Coordinators/CoordinatorFlagManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import Shared

/// This is a temporary struct made to manage the coordinator multiple feature flag for conveniance
struct CoordinatorFlagManager {
static var isShareExtensionCoordinatorEnabled: Bool {
return NimbusManager.shared.featureFlagLayer.checkNimbusConfigFor(.shareExtensionCoordinatorRefactor)
}

static var isQRCodeCoordinatorEnabled: Bool {
return NimbusManager.shared.featureFlagLayer.checkNimbusConfigFor(.qrCodeCoordinatorRefactor)
}
Expand Down
19 changes: 1 addition & 18 deletions Client/Coordinators/Library/DownloadsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ class DownloadsCoordinator: BaseCoordinator, ParentCoordinatorDelegate, Download
func handleFile(_ file: DownloadedFile, sourceView: UIView) {
guard file.canShowInWebView
else {
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
startShare(file: file, sourceView: sourceView)
} else {
shareFile(file, sourceView: sourceView)
}
startShare(file: file, sourceView: sourceView)
return
}
parentCoordinator?.libraryPanel(didSelectURL: file.path, visitType: .typed)
Expand All @@ -63,19 +59,6 @@ class DownloadsCoordinator: BaseCoordinator, ParentCoordinatorDelegate, Download
return coordinator
}

private func shareFile(_ file: DownloadedFile, sourceView: UIView) {
let helper = ShareExtensionHelper(url: file.path, tab: nil)
let controller = helper.createActivityViewController { _, _ in }

if let popoverPresentationController = controller.popoverPresentationController {
popoverPresentationController.sourceView = sourceView
popoverPresentationController.sourceRect = sourceView.bounds
popoverPresentationController.permittedArrowDirections = .any
}

router.present(controller)
}

func showDocument(file: DownloadedFile) {
let docController = UIDocumentInteractionController(url: file.path)
docController.delegate = self
Expand Down
2 changes: 0 additions & 2 deletions Client/FeatureFlags/NimbusFlaggableFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum NimbusFeatureFlagID: String, CaseIterable {
case reduxIntegration
case reportSiteIssue
case searchHighlights
case shareExtensionCoordinatorRefactor
case shareSheetChanges
case shareToolbarChanges
case tabTrayRefactor
Expand Down Expand Up @@ -80,7 +79,6 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar {
.reportSiteIssue,
.feltPrivacyUI,
.searchHighlights,
.shareExtensionCoordinatorRefactor,
.shareSheetChanges,
.shareToolbarChanges,
.tabTrayRefactor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,6 @@ extension BrowserViewController: ToolBarActionMenuDelegate {
}
}

func showMenuPresenter(url: URL, tab: Tab, view: UIView) {
presentActivityViewController(url, tab: tab, sourceView: view, sourceRect: view.bounds, arrowDirection: .up)
}

func showFindInPage() {
updateFindInPageVisibility(visible: true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,11 @@ extension BrowserViewController: URLBarDelegate {
extras: nil)

if let selectedtab = tabManager.selectedTab, let tabUrl = selectedtab.canonicalURL?.displayURL {
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
navigationHandler?.showShareExtension(
url: tabUrl,
sourceView: shareView,
toastContainer: contentContainer,
popoverArrowDirection: isBottomSearchBar ? .down : .up)
} else {
presentShareSheet(tabUrl,
tab: selectedtab,
sourceView: shareView,
sourceRect: CGRect.null,
arrowDirection: isBottomSearchBar ? .down : .up)
}
navigationHandler?.showShareExtension(
url: tabUrl,
sourceView: shareView,
toastContainer: contentContainer,
popoverArrowDirection: isBottomSearchBar ? .down : .up)
}
}

Expand Down
53 changes: 16 additions & 37 deletions Client/Frontend/Browser/MainMenuActionHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ protocol ToolBarActionMenuDelegate: AnyObject {
func showLibrary(panel: LibraryPanelType)
func showViewController(viewController: UIViewController)
func showToast(message: String, toastAction: MenuButtonToastAction)
func showMenuPresenter(url: URL, tab: Tab, view: UIView)
func showFindInPage()
func showCustomizeHomePage()
func showZoomPage(tab: Tab)
Expand Down Expand Up @@ -577,15 +576,11 @@ class MainMenuActionHelper: PhotonActionSheetProtocol,
TelemetryWrapper.recordEvent(category: .action, method: .tap, object: .sharePageWith)

guard let temporaryDocument = tab.temporaryDocument else {
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
self.navigationHandler?.showShareExtension(
url: url,
sourceView: self.buttonView,
toastContainer: self.toastContainer,
popoverArrowDirection: .any)
} else {
self.delegate?.showMenuPresenter(url: url, tab: tab, view: self.buttonView)
}
self.navigationHandler?.showShareExtension(
url: url,
sourceView: self.buttonView,
toastContainer: self.toastContainer,
popoverArrowDirection: .any)
return
}

Expand All @@ -597,15 +592,11 @@ class MainMenuActionHelper: PhotonActionSheetProtocol,
tempDocURL.isFileURL {
self.share(fileURL: tempDocURL, buttonView: self.buttonView)
} else {
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
self.navigationHandler?.showShareExtension(
url: url,
sourceView: self.buttonView,
toastContainer: self.toastContainer,
popoverArrowDirection: .any)
} else {
self.delegate?.showMenuPresenter(url: url, tab: tab, view: self.buttonView)
}
self.navigationHandler?.showShareExtension(
url: url,
sourceView: self.buttonView,
toastContainer: self.toastContainer,
popoverArrowDirection: .any)
}
}
}
Expand All @@ -614,24 +605,12 @@ class MainMenuActionHelper: PhotonActionSheetProtocol,

// Main menu option Share page with when opening a file
private func share(fileURL: URL, buttonView: UIView) {
if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
navigationHandler?.showShareExtension(
url: fileURL,
sourceView: buttonView,
toastContainer: toastContainer,
popoverArrowDirection: .any)
} else {
let helper = ShareExtensionHelper(url: fileURL, tab: selectedTab)
let controller = helper.createActivityViewController { _, _ in }

if let popoverPresentationController = controller.popoverPresentationController {
popoverPresentationController.sourceView = buttonView
popoverPresentationController.sourceRect = buttonView.bounds
popoverPresentationController.permittedArrowDirections = .up
}
TelemetryWrapper.recordEvent(category: .action, method: .tap, object: .sharePageWith)
delegate?.showViewController(viewController: controller)
}
TelemetryWrapper.recordEvent(category: .action, method: .tap, object: .sharePageWith)
navigationHandler?.showShareExtension(
url: fileURL,
sourceView: buttonView,
toastContainer: toastContainer,
popoverArrowDirection: .any)
}

// MARK: Reading list
Expand Down
38 changes: 8 additions & 30 deletions Client/Frontend/Home/HomepageContextMenuHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,16 @@ class HomepageContextMenuHelper: HomepageContextMenuProtocol {
/// - sourceView: View to show the popover
/// - Returns: Share action
private func getShareAction(site: Site, sourceView: UIView?) -> PhotonRowActions {
return SingleActionViewModel(title: .ShareContextMenuTitle, iconString: ImageIdentifiers.share, tapHandler: { _ in
return SingleActionViewModel(title: .ShareContextMenuTitle,
iconString: ImageIdentifiers.share,
tapHandler: { _ in
guard let url = URL(string: site.url, invalidCharacters: false) else { return }

if CoordinatorFlagManager.isShareExtensionCoordinatorEnabled {
self.browserNavigationHandler?.showShareExtension(
url: url,
sourceView: sourceView ?? UIView(),
toastContainer: self.toastContainer,
popoverArrowDirection: [.up, .down, .left])
} else {
let helper = ShareExtensionHelper(url: url, tab: nil)
let controller = helper.createActivityViewController { (_, activityType) in
switch activityType {
case CustomActivityAction.sendToDevice.actionType:
self.showSendToDevice(site: site)
case CustomActivityAction.copyLink.actionType:
self.delegate?.showToast(message: .AppMenu.AppMenuCopyURLConfirmMessage)
default: break
}
}

if UIDevice.current.userInterfaceIdiom == .pad,
let popoverController = controller.popoverPresentationController,
let getSourceRect = self.getPopoverSourceRect {
popoverController.sourceView = sourceView
popoverController.sourceRect = getSourceRect(sourceView)
popoverController.permittedArrowDirections = [.up, .down, .left]
popoverController.delegate = self.delegate
}

self.delegate?.presentWithModalDismissIfNeeded(controller, animated: true)
}
self.browserNavigationHandler?.showShareExtension(
url: url,
sourceView: sourceView ?? UIView(),
toastContainer: self.toastContainer,
popoverArrowDirection: [.up, .down, .left])
}).items
}

Expand Down
8 changes: 0 additions & 8 deletions Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ final class NimbusFeatureFlagLayer {
case .reportSiteIssue:
return checkGeneralFeature(for: featureID, from: nimbus)

case .shareExtensionCoordinatorRefactor:
return checkShareExtensionCoordinatorRefactorFeature(from: nimbus)

case .shareSheetChanges,
.shareToolbarChanges:
return checkNimbusForShareSheet(for: featureID, from: nimbus)
Expand Down Expand Up @@ -136,11 +133,6 @@ final class NimbusFeatureFlagLayer {
return status
}

private func checkShareExtensionCoordinatorRefactorFeature(from nimbus: FxNimbus) -> Bool {
let config = nimbus.features.shareExtensionCoordinatorRefactor.value()
return config.enabled
}

private func checkNimbusForWallpapersFeature(using nimbus: FxNimbus) -> Bool {
let config = nimbus.features.wallpaperFeature.value()

Expand Down
1 change: 0 additions & 1 deletion nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ include:
- nimbus-features/reduxIntegrationFeature.yaml
- nimbus-features/searchFeature.yaml
- nimbus-features/searchTermGroupsFeature.yaml
- nimbus-features/shareExtensionCoordinatorRefactor.yaml
- nimbus-features/shareSheetFeature.yaml
- nimbus-features/spotlightSearchFeature.yaml
- nimbus-features/tabTrayFeature.yaml
Expand Down

0 comments on commit da194ae

Please sign in to comment.