aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt15
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt2
5 files changed, 28 insertions, 3 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 a926c8ac..5b26ebac 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -15,6 +15,8 @@ enum class CssHider(vararg val items: String) : InjectorContract {
"article[data-store*=sponsor]"
),
PEOPLE_YOU_MAY_KNOW("article._d2r"),
+ SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"),
+ 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/injectors/JsInjector.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
index 9fafbf88..a29ff55e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
@@ -1,6 +1,7 @@
package com.pitchedapps.frost.injectors
import android.webkit.WebView
+import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.web.FrostWebViewClient
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
@@ -55,9 +56,10 @@ fun WebView.jsInject(vararg injectors: InjectorContract, callback: ((Array<Strin
val validInjectors = injectors.filter { it != JsActions.EMPTY }
if (validInjectors.isEmpty()) return callback(emptyArray())
val observables = Array(validInjectors.size, { SingleSubject.create<String>() })
- Observable.zip<String, Array<String>>(observables.map { it.toObservable() }, { it.map { it.toString() }.toTypedArray() }).subscribeOn(AndroidSchedulers.mainThread()).subscribe({
- callback(it)
- })
+ L.d("Injecting ${observables.size} items")
+ Observable.zip<String, Array<String>>(observables.map(SingleSubject<String>::toObservable),
+ { it.map(Any::toString).toTypedArray() })
+ .subscribeOn(AndroidSchedulers.mainThread()).subscribe({ callback(it) })
(0 until validInjectors.size).forEach { i -> validInjectors[i].inject(this, { observables[i].onSuccess(it) }) }
}
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 3676d39c..3c7b385d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt
@@ -46,6 +46,13 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
onClick = { _, _, _ -> launchWebOverlay("https://touch.facebook.com/settings/videos"); true }
}
+ checkbox(R.string.composer, { Prefs.showComposer }, {
+ Prefs.showComposer = it
+ setFrostResult(MainActivity.REQUEST_REFRESH)
+ }) {
+ descRes = R.string.composer_desc
+ }
+
header(R.string.pro_features)
checkbox(R.string.suggested_friends, { Prefs.showSuggestedFriends }, {
@@ -56,6 +63,14 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = {
dependsOnPro()
}
+ checkbox(R.string.suggested_groups, { Prefs.showSuggestedGroups }, {
+ Prefs.showSuggestedGroups = it
+ setFrostResult(MainActivity.REQUEST_REFRESH)
+ }) {
+ descRes = R.string.suggested_groups_desc
+ dependsOnPro()
+ }
+
checkbox(R.string.facebook_ads, { Prefs.showFacebookAds }, {
Prefs.showFacebookAds = it
setFrostResult(MainActivity.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 68b4b80d..70144f9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -90,8 +90,12 @@ object Prefs : KPref() {
var showRoundedIcons: Boolean by kpref("rounded_icons", true)
+ var showComposer: Boolean by kpref("status_composer_feed", true)
+
var showSuggestedFriends: Boolean by kpref("suggested_friends_feed", true)
+ var showSuggestedGroups: Boolean by kpref("suggested_groups_feed", true)
+
var showFacebookAds: Boolean by kpref("facebook_ads", true)
var animate: Boolean by kpref("fancy_animations", true)
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 31aaaa6f..3275b2a6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -76,7 +76,9 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
CssHider.HEADER,
CssHider.CORE,
+ CssHider.COMPOSER.maybe(!Prefs.showComposer),
CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends && IS_FROST_PRO),
+ CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups && IS_FROST_PRO),
Prefs.themeInjector,
CssHider.NON_RECENT.maybe((webCore.url?.contains("?sk=h_chr") ?: false)
&& Prefs.aggressiveRecents))