From 6c6f001fe846efdfea36ba9c19934c4b44d88c15 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Fri, 1 Jul 2022 20:35:06 -0500 Subject: Fixed ads filter and added new “suggested posts” filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt | 8 ++++++-- app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt | 2 ++ .../main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt | 7 +++++++ app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt | 1 + .../main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 1 + app/src/main/res/values-es-rES/strings_pref_feed.xml | 2 ++ app/src/main/res/values/strings_pref_feed.xml | 2 ++ 7 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt index 7b400a43..cc7174d1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -34,11 +34,15 @@ enum class CssHider(private vararg val items: String) : InjectorContract { "[data-sigil*=m-promo-jewel-header]" ), ADS( - "article[data-xt*=sponsor]", - "article[data-store*=sponsor]" + "article[data-store*=adid]", + "article[data-ft*=adid]" ), PEOPLE_YOU_MAY_KNOW("article._d2r"), SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"), + SUGGESTED_POSTS( + "article[data-store*=recommendation]", + "article[data-ft*=recommendation]" + ), COMPOSER("#MComposer"), MESSENGER("._s15", "[data-testid=info_panel]", "js_i"), NON_RECENT("article:not([data-store*=actor_name])"), diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt index cfd8edbd..14ef3c98 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt @@ -77,6 +77,8 @@ class OldPrefs @Inject internal constructor(factory: KPrefFactory) : var showSuggestedGroups: Boolean by kpref("suggested_groups_feed", true) + var showSuggestedPosts: Boolean by kpref("suggested_posts_feed", true) + var showFacebookAds: Boolean by kpref("facebook_ads", false) var showStories: Boolean by kpref("show_stories", true) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt index 00df9743..f60470f0 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt @@ -37,6 +37,8 @@ interface FeedPrefs : PrefsBase { var showSuggestedGroups: Boolean + var showSuggestedPosts: Boolean + var showFacebookAds: Boolean var showStories: Boolean @@ -82,6 +84,11 @@ class FeedPrefsImpl @Inject internal constructor( oldPrefs.showSuggestedGroups /* true */ ) + override var showSuggestedPosts: Boolean by kpref( + "suggested_groups_posts", + oldPrefs.showSuggestedPosts /* true */ + ) + override var showFacebookAds: Boolean by kpref( "facebook_ads", oldPrefs.showFacebookAds /* false */ diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt index 187e7d4e..10a2cf6f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -120,6 +120,7 @@ class DebugWebView @JvmOverloads constructor( CssHider.STORIES.maybe(!prefs.showStories), CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!prefs.showSuggestedFriends), CssHider.SUGGESTED_GROUPS.maybe(!prefs.showSuggestedGroups), + CssHider.SUGGESTED_POSTS.maybe(!prefs.showSuggestedPosts), themeProvider.injector(ThemeCategory.FACEBOOK), CssHider.NON_RECENT.maybe( (url?.contains("?sk=h_chr") ?: false) && diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index ba19989d..95601236 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -122,6 +122,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { CssHider.STORIES.maybe(!prefs.showStories), CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!prefs.showSuggestedFriends), CssHider.SUGGESTED_GROUPS.maybe(!prefs.showSuggestedGroups), + CssHider.SUGGESTED_POSTS.maybe(!prefs.showSuggestedPosts), themeProvider.injector(ThemeCategory.FACEBOOK), CssHider.NON_RECENT.maybe( (web.url?.contains("?sk=h_chr") ?: false) && diff --git a/app/src/main/res/values-es-rES/strings_pref_feed.xml b/app/src/main/res/values-es-rES/strings_pref_feed.xml index 613cee3a..487869c4 100644 --- a/app/src/main/res/values-es-rES/strings_pref_feed.xml +++ b/app/src/main/res/values-es-rES/strings_pref_feed.xml @@ -13,6 +13,8 @@ Mostrar \"Gente que quizá conozcas\" en el feed Grupos sugeridos Mostrar \"grupos sugeridos\" en el feed + Publicaciones sugeridos + Mostrar \"publicaciones sugeridas\" en el feed Historias destacadas Mostrar historias en el feed Anuncios de Facebook diff --git a/app/src/main/res/values/strings_pref_feed.xml b/app/src/main/res/values/strings_pref_feed.xml index 58d832cc..bdaca2ac 100644 --- a/app/src/main/res/values/strings_pref_feed.xml +++ b/app/src/main/res/values/strings_pref_feed.xml @@ -14,6 +14,8 @@ Show \"People You May Know\" in the feed Suggested Groups Show \"Suggested Groups\" in the feed + Suggested Posts + Show \"Suggested Posts\" in the feed Show Stories Show stories in the feed Show Post Actions -- cgit v1.2.3