diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-07-04 22:13:56 -0500 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-07-04 22:13:56 -0500 |
commit | 76b26e3d7aad8f6f48cdfb3e196be5143c3c0887 (patch) | |
tree | b169107c934de4836f94658d03be4498fab0d2b9 /app/src | |
parent | a5a786ce27e7a002eb1f7cea344f48a367b5ce9c (diff) | |
download | frost-76b26e3d7aad8f6f48cdfb3e196be5143c3c0887.tar.gz frost-76b26e3d7aad8f6f48cdfb3e196be5143c3c0887.tar.bz2 frost-76b26e3d7aad8f6f48cdfb3e196be5143c3c0887.zip |
Added new “marketplace items” filterdev
Diffstat (limited to 'app/src')
8 files changed, 29 insertions, 0 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 cc7174d1..b8879a76 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -37,6 +37,10 @@ enum class CssHider(private vararg val items: String) : InjectorContract { "article[data-store*=adid]", "article[data-ft*=adid]" ), + MARKETPLACE_ITEMS( + "article[data-store*=CommerceAttachment]", + "article[data-ft*=CommerceAttachment]" + ), PEOPLE_YOU_MAY_KNOW("article._d2r"), SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"), SUGGESTED_POSTS( 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 14ef3c98..6e62134a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/prefs/OldPrefs.kt @@ -81,6 +81,8 @@ class OldPrefs @Inject internal constructor(factory: KPrefFactory) : var showFacebookAds: Boolean by kpref("facebook_ads", false) + var showMarketplaceItems: Boolean by kpref("marketplace_items", true) + var showStories: Boolean by kpref("show_stories", true) var animate: Boolean by kpref("fancy_animations", 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 f60470f0..660dffda 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 @@ -41,6 +41,8 @@ interface FeedPrefs : PrefsBase { var showFacebookAds: Boolean + var showMarketplaceItems: Boolean + var showStories: Boolean var mainActivityLayoutType: Int @@ -94,6 +96,11 @@ class FeedPrefsImpl @Inject internal constructor( oldPrefs.showFacebookAds /* false */ ) + override var showMarketplaceItems: Boolean by kpref( + "marketplace_items", + oldPrefs.showMarketplaceItems /* true */ + ) + override var showStories: Boolean by kpref("show_stories", oldPrefs.showStories /* true */) override var mainActivityLayoutType: Int by kpref( diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt index 5b1007d5..851fa6f8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt @@ -110,6 +110,16 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = { } checkbox( + R.string.marketplace_items, prefs::showMarketplaceItems, + { + prefs.showMarketplaceItems = it + shouldRefreshMain() + } + ) { + descRes = R.string.marketplace_items_desc + } + + checkbox( R.string.show_stories, prefs::showStories, { prefs.showStories = it 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 10a2cf6f..11460ce4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -116,6 +116,7 @@ class DebugWebView @JvmOverloads constructor( if (url.isFacebookUrl) view.jsInject( // CssHider.CORE, + CssHider.MARKETPLACE_ITEMS.maybe(!prefs.showMarketplaceItems), CssHider.COMPOSER.maybe(!prefs.showComposer), CssHider.STORIES.maybe(!prefs.showStories), CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!prefs.showSuggestedFriends), 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 95601236..a2ea000f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -129,6 +129,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { prefs.aggressiveRecents ), CssHider.ADS.maybe(!prefs.showFacebookAds), + CssHider.MARKETPLACE_ITEMS.maybe(!prefs.showMarketplaceItems), CssHider.POST_ACTIONS.maybe(!prefs.showPostActions), CssHider.POST_REACTIONS.maybe(!prefs.showPostReactions), CssAsset.FullSizeImage.maybe(prefs.fullSizeImage), 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 487869c4..a81366f0 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 @@ -19,4 +19,6 @@ <string name="show_stories_desc">Mostrar historias en el feed</string> <string name="facebook_ads">Anuncios de Facebook</string> <string name="facebook_ads_desc">Mostrar anuncios nativos de Facebook</string> + <string name="marketplace_items">Artículos de Marketplace</string> + <string name="marketplace_items_desc">Mostrar artículos en venta en Marketplace</string> </resources> diff --git a/app/src/main/res/values/strings_pref_feed.xml b/app/src/main/res/values/strings_pref_feed.xml index bdaca2ac..00688e61 100644 --- a/app/src/main/res/values/strings_pref_feed.xml +++ b/app/src/main/res/values/strings_pref_feed.xml @@ -24,6 +24,8 @@ <string name="show_post_reactions_desc">Show reaction counts to post</string> <string name="facebook_ads">Facebook Ads</string> <string name="facebook_ads_desc">Show native Facebook ads</string> + <string name="marketplace_items">Marketplace Items</string> + <string name="marketplace_items_desc">Show articles on sale in Marketplace</string> <string name="full_size_image">Full Size Images</string> <string name="full_size_image_desc">Force news feed images to be full width</string> |