Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FXIOS-9088 - Remove Pocket Share Sheet Experiment (backport #20173) #20283

Merged
merged 1 commit into from
May 24, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ enum NimbusFeatureFlagID: String, CaseIterable {
case reduxSearchSettings
case reportSiteIssue
case searchHighlights
case shareSheetChanges
case shareToolbarChanges
case splashScreen
case tabTrayRefactor
case zoomFeature
Expand Down Expand Up @@ -81,8 +79,6 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar {
.feltPrivacySimplifiedUI,
.feltPrivacyFeltDeletion,
.searchHighlights,
.shareSheetChanges,
.shareToolbarChanges,
.splashScreen,
.tabTrayRefactor,
.zoomFeature:
Expand Down
23 changes: 7 additions & 16 deletions firefox-ios/Client/Frontend/Browser/MainMenuActionHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,14 @@ class MainMenuActionHelper: PhotonActionSheetProtocol,
let shortAction = getShortcutAction()
append(to: &section, 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: &section, action: copyAction)

let sendToDeviceAction = getSendToDevice()
append(to: &section, action: sendToDeviceAction)
}
let copyAction = getCopyAction()
append(to: &section, 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: &section, action: shareAction)
}
let sendToDeviceAction = getSendToDevice()
append(to: &section, action: sendToDeviceAction)

let shareAction = getShareAction()
append(to: &section, action: shareAction)
}

return section
Expand Down
31 changes: 2 additions & 29 deletions firefox-ios/Client/Frontend/Share/ShareExtensionHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -219,7 +199,6 @@ class TabLocationView: UIView, FeatureFlaggable {
urlTextField,
shoppingButton,
readerModeButton,
shareButton,
reloadButton
]
contentView = UIStackView(arrangedSubviews: subviews)
Expand All @@ -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),
])
Expand All @@ -262,7 +239,6 @@ class TabLocationView: UIView, FeatureFlaggable {
urlTextField,
shoppingButton,
readerModeButton,
shareButton,
reloadButton
]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)?
Expand Down
15 changes: 0 additions & 15 deletions firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
23 changes: 0 additions & 23 deletions firefox-ios/nimbus-features/shareSheetFeature.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions firefox-ios/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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