aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-07-01 20:35:06 -0500
committerIván Ávalos <avalos@disroot.org>2022-07-01 20:35:06 -0500
commit6c6f001fe846efdfea36ba9c19934c4b44d88c15 (patch)
treed1413b30bd20eb01d598665b3e409c363858df64
parent6bff5dce8807408ab0ee30b36714bc35711a5a30 (diff)
downloadfrost-6c6f001fe846efdfea36ba9c19934c4b44d88c15.tar.gz
frost-6c6f001fe846efdfea36ba9c19934c4b44d88c15.tar.bz2
frost-6c6f001fe846efdfea36ba9c19934c4b44d88c15.zip
Fixed ads filter and added new “suggested posts” filter
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/prefs/sections/FeedPrefs.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt1
-rw-r--r--app/src/main/res/values-es-rES/strings_pref_feed.xml2
-rw-r--r--app/src/main/res/values/strings_pref_feed.xml2
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 @@
<string name="suggested_friends_desc">Mostrar \"Gente que quizá conozcas\" en el feed</string>
<string name="suggested_groups">Grupos sugeridos</string>
<string name="suggested_groups_desc">Mostrar \"grupos sugeridos\" en el feed</string>
+ <string name="suggested_posts">Publicaciones sugeridos</string>
+ <string name="suggested_posts_desc">Mostrar \"publicaciones sugeridas\" en el feed</string>
<string name="show_stories">Historias destacadas</string>
<string name="show_stories_desc">Mostrar historias en el feed</string>
<string name="facebook_ads">Anuncios de Facebook</string>
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 @@
<string name="suggested_friends_desc">Show \"People You May Know\" in the feed</string>
<string name="suggested_groups">Suggested Groups</string>
<string name="suggested_groups_desc">Show \"Suggested Groups\" in the feed</string>
+ <string name="suggested_posts">Suggested Posts</string>
+ <string name="suggested_posts_desc">Show \"Suggested Posts\" in the feed</string>
<string name="show_stories">Show Stories</string>
<string name="show_stories_desc">Show stories in the feed</string>
<string name="show_post_actions">Show Post Actions</string>