From 0f3d58fb4a9dc641ec6bf0fd317805ddaeaa2afb Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 7 Oct 2017 14:59:53 -0400 Subject: Fix composer hider --- app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt | 8 +++++--- 2 files changed, 6 insertions(+), 4 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 9cc23895..5b26ebac 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -16,7 +16,7 @@ enum class CssHider(vararg val items: String) : InjectorContract { ), PEOPLE_YOU_MAY_KNOW("article._d2r"), SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"), - COMPOSER("MComposer"), + 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() }) - Observable.zip>(observables.map { it.toObservable() }, { it.map { it.toString() }.toTypedArray() }).subscribeOn(AndroidSchedulers.mainThread()).subscribe({ - callback(it) - }) + L.d("Injecting ${observables.size} items") + Observable.zip>(observables.map(SingleSubject::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) }) } } -- cgit v1.2.3