aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-04 15:55:47 -0500
committerGitHub <noreply@github.com>2019-03-04 15:55:47 -0500
commitdc4910e1e9b26eb71bb7a663cb2994b277be40ac (patch)
tree2d6b9b818f65066fa15dc4213b9a664c607b1d55 /app/src
parent7e5894aa51ea27dafa85534c0c66e274dddd3096 (diff)
downloadfrost-dc4910e1e9b26eb71bb7a663cb2994b277be40ac.tar.gz
frost-dc4910e1e9b26eb71bb7a663cb2994b277be40ac.tar.bz2
frost-dc4910e1e9b26eb71bb7a663cb2994b277be40ac.zip
Allow hiding stories (#1361)
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-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/strings_pref_feed.xml2
6 files changed, 15 insertions, 1 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 4fd46ae4..292b7ff5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -37,7 +37,8 @@ enum class CssHider(vararg val items: String) : InjectorContract {
SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"),
COMPOSER("#MComposer"),
MESSENGER("._s15", "[data-testid=info_panel]", "js_i"),
- NON_RECENT("article:not([data-store*=actor_name])")
+ NON_RECENT("article:not([data-store*=actor_name])"),
+ STORIES("#MStoriesTray")
;
val injector: JsInjector by lazy {
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 ff0badf0..baf68634 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -76,6 +76,13 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.suggested_groups_desc
}
+ checkbox(R.string.show_stories, Prefs::showStories, {
+ Prefs.showStories = it
+ setFrostResult(REQUEST_REFRESH)
+ }) {
+ descRes = R.string.show_stories_desc
+ }
+
checkbox(R.string.facebook_ads, Prefs::showFacebookAds, {
Prefs.showFacebookAds = it
setFrostResult(REQUEST_REFRESH)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index add9c6cd..9a63f527 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -126,6 +126,8 @@ object Prefs : KPref() {
var showFacebookAds: Boolean by kpref("facebook_ads", false)
+ var showStories: Boolean by kpref("show_stories", true)
+
var animate: Boolean by kpref("fancy_animations", true)
var notificationKeywords: Set<String> by kpref("notification_keywords", mutableSetOf())
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 d2b53ab5..6b186b1c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt
@@ -105,6 +105,7 @@ class DebugWebView @JvmOverloads constructor(
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
// CssHider.CORE,
CssHider.COMPOSER.maybe(!Prefs.showComposer),
+ CssHider.STORIES.maybe(!Prefs.showStories),
CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups),
Prefs.themeInjector,
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 2e8408ea..e162f9da 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -95,6 +95,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
// CssHider.CORE,
CssHider.HEADER,
CssHider.COMPOSER.maybe(!Prefs.showComposer),
+ CssHider.STORIES.maybe(!Prefs.showStories),
CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups),
Prefs.themeInjector,
diff --git a/app/src/main/res/values/strings_pref_feed.xml b/app/src/main/res/values/strings_pref_feed.xml
index bacd6b32..d7a15bda 100644
--- a/app/src/main/res/values/strings_pref_feed.xml
+++ b/app/src/main/res/values/strings_pref_feed.xml
@@ -12,6 +12,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="show_stories">Show Stories</string>
+ <string name="show_stories_desc">Show stories in the feed</string>
<string name="facebook_ads">Facebook Ads</string>
<string name="facebook_ads_desc">Show native Facebook ads</string>