diff options
Diffstat (limited to 'app/src/main/kotlin/com')
6 files changed, 25 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), |