aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt12
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt2
-rw-r--r--app/src/main/res/values/strings_preferences4
5 files changed, 21 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
index ca823513..cde23ebc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
@@ -118,6 +118,10 @@ class SettingsActivity : KPrefActivity() {
checkbox(R.string.suggested_friends, { Prefs.showSuggestedFriends }, { Prefs.showSuggestedFriends = it }) {
descRes = R.string.suggested_friends_desc
}
+
+ checkbox(R.string.facebook_ads, { Prefs.showFacebookAds }, { Prefs.showFacebookAds = it }) {
+ descRes = R.string.facebook_ads_desc
+ }
}
@@ -153,10 +157,8 @@ class SettingsActivity : KPrefActivity() {
this@SettingsActivity.materialDialogThemed {
title(R.string.notification_keywords)
customView(keywordView, false)
- canceledOnTouchOutside(false)
+ dismissListener { keywordView.save() }
positiveText(R.string.kau_done)
- negativeText(R.string.kau_cancel)
- onPositive { _, _ -> keywordView.save() }
}
true
}
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 72279ee3..ba0bdaac 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -1,20 +1,26 @@
package com.pitchedapps.frost.injectors
import android.webkit.WebView
+import com.pitchedapps.frost.utils.L
/**
* Created by Allan Wang on 2017-05-31.
*/
enum class CssHider(vararg val items: String) : InjectorContract {
- CORE("[data-sigil=\"m_login_upsell\"]"),
- HEADER("#header[data-sigil=\"MTopBlueBarHeader\"]", "#header-notices", "[data-sigil*=\"m-promo-jewel-header\"]"),
- ADS("[data-xt*=\"is_sponsored.1\"]")
+ CORE("[data-sigil=m_login_upsell]"),
+ HEADER("#header[data-sigil=MTopBlueBarHeader]", "#header-notices", "[data-sigil*=m-promo-jewel-header]"),
+ ADS(
+ "article[data-xt*=sponsor]",
+ "article[data-store*=sponsor]"
+ ),
+ PEOPLE_YOU_MAY_KNOW("article._d2r")
;
val injector: JsInjector by lazy { JsBuilder().css("${items.joinToString(separator = ",")}{display:none!important}").build() }
override fun inject(webView: WebView, callback: ((String) -> Unit)?) {
injector.inject(webView, callback)
+ L.d(injector.function)
}
} \ No newline at end of file
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 428d0c30..9128c42b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -66,6 +66,8 @@ object Prefs : KPref() {
var showSuggestedFriends: Boolean by kpref("suggested_friends_feed", true)
+ var showFacebookAds: Boolean by kpref("facebook_ads", true)
+
var animate: Boolean by kpref("fancy_animations", true)
var notificationKeywords: StringSet by kpref("notification_keywords", mutableSetOf<String>())
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
index 8b1eca1e..ebea533c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
@@ -52,6 +52,8 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() {
}
view.jsInject(JsActions.LOGIN_CHECK,
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
+ CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
+ CssHider.ADS.maybe(!Prefs.showFacebookAds),
JsAssets.HEADER_BADGES.maybe(webCore.baseEnum != null))
onPageFinishedActions(url)
}
diff --git a/app/src/main/res/values/strings_preferences b/app/src/main/res/values/strings_preferences
index 2aad590f..08603ab4 100644
--- a/app/src/main/res/values/strings_preferences
+++ b/app/src/main/res/values/strings_preferences
@@ -16,7 +16,9 @@
<string name="base_customization">Base Customization</string>
<string name="feed_customization">Feed Customization</string>
<string name="suggested_friends">Suggested Friends</string>
- <string name="suggested_friends_desc">Show suggested friends in the feed</string>
+ <string name="suggested_friends_desc">Show "People You May Know" in the feed</string>
+ <string name="facebook_ads">Facebook Ads</string>
+ <string name="facebook_ads_desc">Show native Facebook ads</string>
<string name="notification_frequency">Notification Frequency</string>
<string name="notification_keywords">Keywords</string>