From 25acd6bb04a229f3201c6122795b017f3262e360 Mon Sep 17 00:00:00 2001 From: Sophie <5545720+dataports@users.noreply.github.com> Date: Thu, 9 May 2024 08:42:04 -0700 Subject: [PATCH] Remove FXIOS-9088 - Remove Pocket Share Sheet Experiment (#20173) (cherry picked from commit a6329c890bca644c4d3bf96b27522e870e1b22df) --- .../FeatureFlags/NimbusFlaggableFeature.swift | 4 --- .../Browser/MainMenuActionHelper.swift | 23 ++++--------- .../Frontend/Share/ShareExtensionHelper.swift | 31 ++---------------- .../Toolbar+URLBar/TabLocationView.swift | 32 +------------------ .../Nimbus/NimbusFeatureFlagLayer.swift | 15 --------- .../nimbus-features/shareSheetFeature.yaml | 23 ------------- firefox-ios/nimbus.fml.yaml | 3 +- 7 files changed, 11 insertions(+), 120 deletions(-) delete mode 100644 firefox-ios/nimbus-features/shareSheetFeature.yaml diff --git a/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift b/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift index 01b3d65d8294..6c56f9cad72b 100644 --- a/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift +++ b/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift @@ -31,8 +31,6 @@ enum NimbusFeatureFlagID: String, CaseIterable { case reduxSearchSettings case reportSiteIssue case searchHighlights - case shareSheetChanges - case shareToolbarChanges case splashScreen case tabTrayRefactor case zoomFeature @@ -81,8 +79,6 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar { .feltPrivacySimplifiedUI, .feltPrivacyFeltDeletion, .searchHighlights, - .shareSheetChanges, - .shareToolbarChanges, .splashScreen, .tabTrayRefactor, .zoomFeature: diff --git a/firefox-ios/Client/Frontend/Browser/MainMenuActionHelper.swift b/firefox-ios/Client/Frontend/Browser/MainMenuActionHelper.swift index cf2040439c3c..26a9cec20294 100644 --- a/firefox-ios/Client/Frontend/Browser/MainMenuActionHelper.swift +++ b/firefox-ios/Client/Frontend/Browser/MainMenuActionHelper.swift @@ -263,23 +263,14 @@ class MainMenuActionHelper: PhotonActionSheetProtocol, let shortAction = getShortcutAction() append(to: §ion, action: shortAction) - // Feature flag for share sheet changes where we moved send to device and copy - // away from hamburger menu to the actual system share sheet. When share sheet - // changes flag is on we do not append items to the hamburger menu - if !featureFlags.isFeatureEnabled(.shareSheetChanges, checking: .buildOnly) { - let copyAction = getCopyAction() - append(to: §ion, action: copyAction) - - let sendToDeviceAction = getSendToDevice() - append(to: §ion, action: sendToDeviceAction) - } + let copyAction = getCopyAction() + append(to: §ion, action: copyAction) - // Feature flag for toolbar share action changes where if the toolbar is showing - // share action button then we do not show the share button in hamburger menu - if !featureFlags.isFeatureEnabled(.shareToolbarChanges, checking: .buildOnly) { - let shareAction = getShareAction() - append(to: §ion, action: shareAction) - } + let sendToDeviceAction = getSendToDevice() + append(to: §ion, action: sendToDeviceAction) + + let shareAction = getShareAction() + append(to: §ion, action: shareAction) } return section diff --git a/firefox-ios/Client/Frontend/Share/ShareExtensionHelper.swift b/firefox-ios/Client/Frontend/Share/ShareExtensionHelper.swift index 71204a99169e..eef5ba45edcc 100644 --- a/firefox-ios/Client/Frontend/Share/ShareExtensionHelper.swift +++ b/firefox-ios/Client/Frontend/Share/ShareExtensionHelper.swift @@ -17,19 +17,8 @@ class ShareExtensionHelper: NSObject, FeatureFlaggable { private let pocketIconExtension = "com.ideashower.ReadItLaterPro.AddToPocketExtension" private let pocketActionExtension = "com.ideashower.ReadItLaterPro.Action-Extension" - var areShareSheetChangesEnabled: Bool { - return featureFlags.isFeatureEnabled(.shareSheetChanges, checking: .buildOnly) && !url.isFileURL - } - - /// Exclude 'Add to Reading List' which currently uses Safari. If share sheet changes are enabled exclude - /// Copy from system to provide custom activity private var excludingActivities: [UIActivity.ActivityType] { - guard areShareSheetChangesEnabled else { - return [UIActivity.ActivityType.addToReadingList] - } - - return [UIActivity.ActivityType.addToReadingList, - UIActivity.ActivityType.copyToPasteboard] + return [UIActivity.ActivityType.addToReadingList] } // Can be a file:// or http(s):// url @@ -50,9 +39,8 @@ class ShareExtensionHelper: NSObject, FeatureFlaggable { if #available(iOS 16.4, *), let webView = webView { activityItems.append(webView) } - let appActivities = getApplicationActivities() let activityViewController = UIActivityViewController(activityItems: activityItems, - applicationActivities: appActivities) + applicationActivities: nil) activityViewController.excludedActivityTypes = excludingActivities @@ -109,21 +97,6 @@ class ShareExtensionHelper: NSObject, FeatureFlaggable { return activityItems } - - private func getApplicationActivities() -> [UIActivity]? { - guard areShareSheetChangesEnabled else { - return nil - } - - var appActivities = [UIActivity]() - let copyLinkActivity = CopyLinkActivity(activityType: .copyLink, url: url) - appActivities.append(copyLinkActivity) - - let sendToDeviceActivity = SendToDeviceActivity(activityType: .sendToDevice, url: url) - appActivities.append(sendToDeviceActivity) - - return appActivities - } } extension ShareExtensionHelper: UIActivityItemSource { diff --git a/firefox-ios/Client/Frontend/Toolbar+URLBar/TabLocationView.swift b/firefox-ios/Client/Frontend/Toolbar+URLBar/TabLocationView.swift index 7bd53b0d2c88..26be673347ac 100644 --- a/firefox-ios/Client/Frontend/Toolbar+URLBar/TabLocationView.swift +++ b/firefox-ios/Client/Frontend/Toolbar+URLBar/TabLocationView.swift @@ -13,7 +13,6 @@ protocol TabLocationViewDelegate: AnyObject { func tabLocationViewDidTapReload(_ tabLocationView: TabLocationView) func tabLocationViewDidTapShield(_ tabLocationView: TabLocationView) func tabLocationViewDidBeginDragInteraction(_ tabLocationView: TabLocationView) - func tabLocationViewDidTapShare(_ tabLocationView: TabLocationView, button: UIButton) func tabLocationViewPresentCFR(at sourceView: UIView) /// - returns: whether the long-press was handled by the delegate; i.e. return `false` when the conditions @@ -66,19 +65,11 @@ class TabLocationView: UIView, FeatureFlaggable { didSet { hideButtons() updateTextWithURL() - shareButton.isHidden = !(shouldEnableShareButtonFeature && isValidHttpUrlProtocol(url)) setNeedsUpdateConstraints() showTrackingProtectionButton(for: url) } } - var shouldEnableShareButtonFeature: Bool { - guard featureFlags.isFeatureEnabled(.shareToolbarChanges, checking: .buildOnly) else { - return false - } - return true - } - var readerModeState: ReaderModeState { get { return readerModeButton.readerModeState @@ -129,17 +120,6 @@ class TabLocationView: UIView, FeatureFlaggable { trackingProtectionButton.accessibilityLabel = .TabLocationLockButtonAccessibilityLabel } - lazy var shareButton: ShareButton = .build { shareButton in - shareButton.addTarget(self, action: #selector(self.didPressShareButton(_:)), for: .touchUpInside) - shareButton.clipsToBounds = false - shareButton.contentHorizontalAlignment = .center - shareButton.accessibilityIdentifier = AccessibilityIdentifiers.Toolbar.shareButton - shareButton.accessibilityLabel = .TabLocationShareAccessibilityLabel - shareButton.showsLargeContentViewer = true - shareButton.largeContentImage = .templateImageNamed(StandardImageIdentifiers.Large.shareApple) - shareButton.largeContentTitle = .TabLocationShareButtonLargeContentTitle - } - private lazy var shoppingButton: UIButton = .build { button in let image = UIImage(named: StandardImageIdentifiers.Large.shopping) @@ -219,7 +199,6 @@ class TabLocationView: UIView, FeatureFlaggable { urlTextField, shoppingButton, readerModeButton, - shareButton, reloadButton ] contentView = UIStackView(arrangedSubviews: subviews) @@ -236,8 +215,6 @@ class TabLocationView: UIView, FeatureFlaggable { shoppingButton.heightAnchor.constraint(equalToConstant: UX.buttonSize), readerModeButton.widthAnchor.constraint(equalToConstant: UX.buttonSize), readerModeButton.heightAnchor.constraint(equalToConstant: UX.buttonSize), - shareButton.heightAnchor.constraint(equalToConstant: UX.buttonSize), - shareButton.widthAnchor.constraint(equalToConstant: UX.buttonSize), reloadButton.widthAnchor.constraint(equalToConstant: UX.buttonSize), reloadButton.heightAnchor.constraint(equalToConstant: UX.buttonSize), ]) @@ -262,7 +239,6 @@ class TabLocationView: UIView, FeatureFlaggable { urlTextField, shoppingButton, readerModeButton, - shareButton, reloadButton ] @@ -324,11 +300,6 @@ class TabLocationView: UIView, FeatureFlaggable { delegate?.tabLocationViewDidTapShield(self) } - @objc - func didPressShareButton(_ button: UIButton) { - delegate?.tabLocationViewDidTapShare(self, button: shareButton) - } - @objc func didPressShoppingButton(_ button: UIButton) { button.isSelected = true @@ -445,7 +416,7 @@ class TabLocationView: UIView, FeatureFlaggable { // Fixes: https://github.com/mozilla-mobile/firefox-ios/issues/17403 private func hideButtons() { - [shoppingButton, shareButton].forEach { $0.isHidden = true } + [shoppingButton].forEach { $0.isHidden = true } } private func currentTheme() -> Theme { @@ -555,7 +526,6 @@ extension TabLocationView: ThemeApplicable { urlTextField.textColor = theme.colors.textPrimary readerModeButton.applyTheme(theme: theme) trackingProtectionButton.applyTheme(theme: theme) - shareButton.applyTheme(theme: theme) reloadButton.applyTheme(theme: theme) shoppingButton.tintColor = theme.colors.textPrimary shoppingButton.setImage(UIImage(named: StandardImageIdentifiers.Large.shopping)? diff --git a/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift b/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift index e9a3a94c3cfd..ce3d05d74c1b 100644 --- a/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift +++ b/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift @@ -65,9 +65,6 @@ final class NimbusFeatureFlagLayer { case .reportSiteIssue: return checkGeneralFeature(for: featureID, from: nimbus) - case .shareSheetChanges, - .shareToolbarChanges: - return checkNimbusForShareSheet(for: featureID, from: nimbus) case .splashScreen: return checkSplashScreenFeature(for: featureID, from: nimbus) case .tabTrayRefactor: @@ -179,18 +176,6 @@ final class NimbusFeatureFlagLayer { } } - public func checkNimbusForShareSheet( - for featureID: NimbusFeatureFlagID, - from nimbus: FxNimbus) -> Bool { - let config = nimbus.features.shareSheet.value() - - switch featureID { - case .shareSheetChanges: return config.moveActions - case .shareToolbarChanges: return config.toolbarChanges - default: return false - } - } - private func checkSplashScreenFeature( for featureID: NimbusFeatureFlagID, from nimbus: FxNimbus diff --git a/firefox-ios/nimbus-features/shareSheetFeature.yaml b/firefox-ios/nimbus-features/shareSheetFeature.yaml deleted file mode 100644 index a5cb7713bbff..000000000000 --- a/firefox-ios/nimbus-features/shareSheetFeature.yaml +++ /dev/null @@ -1,23 +0,0 @@ -features: - share-sheet: - description: This feature define the redesign of the share sheet - variables: - move-actions: - description: If true copy and send to device are moved to share sheet - type: Boolean - default: false - toolbar-changes: - description: If true share option is shown on the toolbar - type: Boolean - default: false - defaults: - - channel: developer - value: { - "move-actions": false, - "toolbar-changes": false - } - - channel: beta - value: { - "move-actions": false, - "toolbar-changes": false - } diff --git a/firefox-ios/nimbus.fml.yaml b/firefox-ios/nimbus.fml.yaml index 794085ba7d27..18395504c29a 100644 --- a/firefox-ios/nimbus.fml.yaml +++ b/firefox-ios/nimbus.fml.yaml @@ -27,9 +27,8 @@ include: - nimbus-features/onboardingFrameworkFeature.yaml - nimbus-features/reduxSearchSettingsFeature.yaml - nimbus-features/searchFeature.yaml - - nimbus-features/shareSheetFeature.yaml + - nimbus-features/splashScreenFeature.yaml - nimbus-features/spotlightSearchFeature.yaml - nimbus-features/tabTrayFeature.yaml - nimbus-features/tabTrayRefactorFeature.yaml - nimbus-features/zoomFeature.yaml - - nimbus-features/splashScreenFeature.yaml