Skip to content

Commit 58d564a

Browse files
authored
Revert FXIOS-11882 ⁃ Restore "Show Link Previews" setting (#26155)
Revert "Remove FXIOS-11882 ⁃ Remove "Show Link Previews" setting (#25917)" This reverts commit a7de37a.
1 parent 710a8f5 commit 58d564a

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

BrowserKit/Sources/Shared/Prefs.swift

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public struct PrefsKeys {
3131
public static let KeyDefaultBrowserCardShowType = "defaultBrowserCardShowType"
3232
public static let DidDismissDefaultBrowserMessage = "DidDismissDefaultBrowserCard"
3333
public static let KeyDidShowDefaultBrowserOnboarding = "didShowDefaultBrowserOnboarding"
34+
public static let ContextMenuShowLinkPreviews = "showLinkPreviews"
3435
public static let ShowClipboardBar = "showClipboardBar"
3536
public static let BlockOpeningExternalApps = "blockOpeningExternalApps"
3637
public static let NewTabCustomUrlPrefKey = "HomePageURLPref"

firefox-ios/Client/Frontend/Browser/BrowserViewController/Extensions/BrowserViewController+WebViewDelegates.swift

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ extension BrowserViewController: WKUIDelegate {
220220

221221
private func contextMenuPreviewProvider(for url: URL, webView: WKWebView) -> UIContextMenuContentPreviewProvider? {
222222
let provider: UIContextMenuContentPreviewProvider = {
223+
guard self.profile.prefs.boolForKey(PrefsKeys.ContextMenuShowLinkPreviews) ?? true else { return nil }
224+
223225
let previewViewController = ContextMenuPreviewViewController()
224226
previewViewController.view.isUserInteractionEnabled = false
225227
let clonedWebView = WKWebView(frame: webView.frame, configuration: webView.configuration)

firefox-ios/Client/Frontend/Settings/BrowsingSettingsViewController.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,17 @@ class BrowsingSettingsViewController: SettingsTableViewController, FeatureFlagga
6262
statusText: String(format: .SettingsOfferClipboardBarStatus, AppName.shortName.rawValue)
6363
)
6464

65-
linksSettings += [offerToOpenCopiedLinksSettings]
65+
let showLinksPreviewSettings = BoolSetting(
66+
prefs: profile.prefs,
67+
theme: theme,
68+
prefKey: PrefsKeys.ContextMenuShowLinkPreviews,
69+
defaultValue: true,
70+
titleText: .SettingsShowLinkPreviewsTitle,
71+
statusText: .SettingsShowLinkPreviewsStatus
72+
)
73+
74+
linksSettings += [offerToOpenCopiedLinksSettings,
75+
showLinksPreviewSettings]
6676

6777
let blockOpeningExternalAppsSettings = BoolSetting(
6878
prefs: profile.prefs,

firefox-ios/Shared/Strings.swift

+14-10
Original file line numberDiff line numberDiff line change
@@ -3536,6 +3536,20 @@ extension String {
35363536
comment: "Description displayed under the ”Offer to Open Copied Link” option. See https://bug1223660.bmoattachments.org/attachment.cgi?id=8898349. %@ is for the app name.")
35373537
}
35383538

3539+
// MARK: - Link Previews
3540+
extension String {
3541+
public static let SettingsShowLinkPreviewsTitle = MZLocalizedString(
3542+
key: "Settings.ShowLinkPreviews.Title",
3543+
tableName: nil,
3544+
value: "Show Link Previews",
3545+
comment: "Title of setting to enable link previews when long-pressing links.")
3546+
public static let SettingsShowLinkPreviewsStatus = MZLocalizedString(
3547+
key: "Settings.ShowLinkPreviews.StatusV2",
3548+
tableName: nil,
3549+
value: "When long-pressing links",
3550+
comment: "Description displayed under the ”Show Link Previews” option")
3551+
}
3552+
35393553
// MARK: - Block Opening External Apps
35403554
extension String {
35413555
public static let SettingsBlockOpeningExternalAppsTitle = MZLocalizedString(
@@ -7182,16 +7196,6 @@ extension String {
71827196
tableName: nil,
71837197
value: "Last month",
71847198
comment: "This label is meant to signify the section containing a group of items from the past thirty days.")
7185-
public static let SettingsShowLinkPreviewsTitle = MZLocalizedString(
7186-
key: "Settings.ShowLinkPreviews.Title",
7187-
tableName: nil,
7188-
value: "Show Link Previews",
7189-
comment: "Title of setting to enable link previews when long-pressing links.")
7190-
public static let SettingsShowLinkPreviewsStatus = MZLocalizedString(
7191-
key: "Settings.ShowLinkPreviews.StatusV2",
7192-
tableName: nil,
7193-
value: "When long-pressing links",
7194-
comment: "Description displayed under the ”Show Link Previews” option")
71957199
}
71967200
struct v139 {
71977201
public static let PagesCount = MZLocalizedString(

0 commit comments

Comments
 (0)