From 5cb54b8b67fd35b69e634aac3b38901ee2791729 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Wed, 9 Jun 2021 17:45:23 -0400 Subject: [PATCH] Fix #916: Add pull to refresh --- BraveShared/BraveStrings.swift | 3 +++ Client/Application/ClientPreferences.swift | 3 +++ .../Contents.json | 22 ++++++++++++++++++ .../settings-pull-to-refresh@2x.png | Bin 0 -> 676 bytes .../settings-pull-to-refresh@3x.png | Bin 0 -> 996 bytes .../Browser/BrowserViewController.swift | 6 ++++- Client/Frontend/Browser/Tab.swift | 20 +++++++++++++++- .../Settings/SettingsViewController.swift | 6 +++++ 8 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/Contents.json create mode 100644 Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@2x.png create mode 100644 Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@3x.png diff --git a/BraveShared/BraveStrings.swift b/BraveShared/BraveStrings.swift index 2940da21e09..a2c8f3fbea4 100644 --- a/BraveShared/BraveStrings.swift +++ b/BraveShared/BraveStrings.swift @@ -484,6 +484,9 @@ extension Strings { public static let defaultBrowserCalloutCloseAccesabilityLabel = NSLocalizedString("defaultBrowserCalloutCloseAccesabilityLabel", tableName: "BraveShared", bundle: .braveShared, value: "Close default browser callout", comment: "") + public static let enablePullToRefresh = + NSLocalizedString("enablePullToRefresh", tableName: "BraveShared", + bundle: .braveShared, value: "Enable Pull-to-refresh", comment: "Describes whether or not the feature that allows the user to pull down from the top of a web page a certain amount before it triggers a page refresh") } extension Strings { diff --git a/Client/Application/ClientPreferences.swift b/Client/Application/ClientPreferences.swift index 6f6bc065784..daf4211f06c 100644 --- a/Client/Application/ClientPreferences.swift +++ b/Client/Application/ClientPreferences.swift @@ -101,6 +101,9 @@ extension Preferences { /// Whether or not the app (in regular browsing mode) will follow universal links static let followUniversalLinks = Option(key: "general.follow-universal-links", default: true) + + /// Whether or not the pull-to-refresh control is added to web views + static let enablePullToRefresh = Option(key: "general.enable-pull-to-refresh", default: true) } final class DefaultBrowserIntro { diff --git a/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/Contents.json b/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/Contents.json new file mode 100644 index 00000000000..b3cdca860ce --- /dev/null +++ b/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "settings-pull-to-refresh@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "settings-pull-to-refresh@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@2x.png b/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4c2fedc1c26fe4d2cdb979d5dbc61cf05e83e35d GIT binary patch literal 676 zcmV;V0$crwP)dY7mJ9EMtMYelbcpsx!U^h!_eywy2+ZO4z!J@3N}=fF3;Z#v&;pm9#=-_dR)J;qp{0H&s~8GFGqDiXe>%qACmCl01a4~4L_n2q4hoCl=G zQK%gSPK+B>UQLbA%rPEW#;@oHd7#~j0!??X&=2^XkZSvGgzbRhHkDdAisGX8>|uhb z)K0JeDyKaZy{Y1`QQ6Z0=%HH_D~Uppo1caErV$tBO8G4Y2FBpC@qdDWfdb8$%OTbn z5Gc?dR*eC|tST6&eNUEJ?3Pz^#@;!6t;;Z7V5J=Zsuay*62(GtH6%riBst+>4a0000< KMNUMnLSTYVS}ceF literal 0 HcmV?d00001 diff --git a/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@3x.png b/Client/Assets/Images.xcassets/Settings/settings-pull-to-refresh.imageset/settings-pull-to-refresh@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..9bf76212d588f3f15f9ae8469ecb7f21c0085459 GIT binary patch literal 996 zcmVvJv7Vma~dN3iS z*iB3V^&`g{{a&}%DFW4_%5KQSbpn;h%7~=SYP7%7ZFdH{@EYY=cCIhJ4MHle@O$@A zz0Er`Tb6wjREuO?Vz`ZaH(h3SiTz~H1bZ+o;J&*F_RF#3dRm*FI2vcfWAp<}U%_rV zLPIWKH#F+h#agN(_goSNPvumGLZDaMyTf#gk7ktmxXt zu1g>D4P0P2(dD>xbz@iej*YDZq)Bu$F;6|XHXRIQkx?W;bHl3xn2n`SrPI)0 zcNS=luo=F=NTJ~)!}lRZm#|y53C1-I3&VjF;nF4;59gW&cZ6`^I9{UJv?PGx877>X zXrPYSBs+PChDnU-W*7MrhiaHG(%cH#qRk4(S^k9QPzg#D8WI==OQ{!7(SD8XjKe1! zKcv3E@EF!qDhaK+;SEkpsp0#V7%4RT$MAiq>u4|7_QG8}ItcA$(=?ml@qTxPmP}#aW72eA-MeUZr+m|fbJ(j0?B4q} z?Rqpy!(KK#3GAk`ms`4i=bG)iUS^?w!y^gYHKR*?LB5T%y+i%`u6M@WI^;h%9P4~l S-WQ<&0000 Bool { return sequence(first: parent) { $0?.parent }.contains { $0 == ancestor } diff --git a/Client/Frontend/Settings/SettingsViewController.swift b/Client/Frontend/Settings/SettingsViewController.swift index 435e545aede..dc5c55e82e8 100644 --- a/Client/Frontend/Settings/SettingsViewController.swift +++ b/Client/Frontend/Settings/SettingsViewController.swift @@ -249,6 +249,12 @@ class SettingsViewController: TableViewController { }, cellClass: MultilineButtonCell.self)) } + general.rows.append( + .boolRow(title: Strings.enablePullToRefresh, + option: Preferences.General.enablePullToRefresh, + image: #imageLiteral(resourceName: "settings-pull-to-refresh").template) + ) + return general }()