1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Fix composer hider

This commit is contained in:
Allan Wang 2017-10-07 14:59:53 -04:00
parent 5a83083c20
commit 0f3d58fb4a
2 changed files with 6 additions and 4 deletions

View File

@ -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])")
;

View File

@ -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) }) }
}