Skip to content

Commit

Permalink
Remove pocket share sheet experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Amin authored and Sophie Amin committed May 8, 2024
1 parent 5987f05 commit 8797dde
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 72 deletions.
4 changes: 0 additions & 4 deletions firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,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 @@ -83,8 +81,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 @@ -66,19 +66,12 @@ class TabLocationView: UIView, FeatureFlaggable {
didSet {
hideButtons()
updateTextWithURL()
shareButton.isHidden = !(shouldEnableShareButtonFeature && isValidHttpUrlProtocol(url))
shareButton.isHidden = !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
15 changes: 0 additions & 15 deletions firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,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 @@ -182,18 +179,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

0 comments on commit 8797dde

Please sign in to comment.