aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-10-07 14:59:53 -0400
committerAllan Wang <me@allanwang.ca>2017-10-07 14:59:53 -0400
commit0f3d58fb4a9dc641ec6bf0fd317805ddaeaa2afb (patch)
tree7fb59ce0428547d3082db7d463bd29bf8dfa73e3 /app/src/main/kotlin/com/pitchedapps
parent5a83083c2053438d55a0aa5b3d36691000843bb3 (diff)
downloadfrost-0f3d58fb4a9dc641ec6bf0fd317805ddaeaa2afb.tar.gz
frost-0f3d58fb4a9dc641ec6bf0fd317805ddaeaa2afb.tar.bz2
frost-0f3d58fb4a9dc641ec6bf0fd317805ddaeaa2afb.zip
Fix composer hider
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-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
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<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) }) }
}