diff options
author | Allan Wang <me@allanwang.ca> | 2017-09-17 01:21:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-17 01:21:46 -0400 |
commit | a5ea7fd9606f2ae39d57d2463f093629d19b0200 (patch) | |
tree | fdd6a29608987999b4eb03fe7a569c4467d513bb /app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt | |
parent | e55fac98ef50a55f0064111cb767d1d7e3959bcc (diff) | |
download | frost-a5ea7fd9606f2ae39d57d2463f093629d19b0200.tar.gz frost-a5ea7fd9606f2ae39d57d2463f093629d19b0200.tar.bz2 frost-a5ea7fd9606f2ae39d57d2463f093629d19b0200.zip |
misc (#298)v1.5.0
* Wrap searchsubject with error handler
* Add dialog for older users
* Add identifier key
* Ensure notification service starts when app starts
* Update theme
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt index 16d9f4bf..d45c2cf6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt @@ -11,6 +11,7 @@ import com.pitchedapps.frost.facebook.USER_AGENT_BASIC import com.pitchedapps.frost.injectors.JsAssets import com.pitchedapps.frost.injectors.JsBuilder import com.pitchedapps.frost.utils.L +import io.reactivex.rxkotlin.subscribeBy import io.reactivex.schedulers.Schedulers import io.reactivex.subjects.PublishSubject import org.jetbrains.anko.runOnUiThread @@ -71,13 +72,18 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co } .filter { it.isNotEmpty() } .filter { Pair(it.last().second, it.size) != previousResult } - .subscribe { content: List<Pair<List<String>, String>> -> - saveResultFrame(content) - L.d("Search element count ${content.size}") - contract.emitSearchResponse(content.map { (texts, href) -> - SearchItem(href, texts[0], texts.getOrNull(1)) - }) - } + .subscribeBy( + onNext = { content: List<Pair<List<String>, String>> -> + saveResultFrame(content) + L.d("Search element count ${content.size}") + contract.emitSearchResponse(content.map { (texts, href) -> + SearchItem(href, texts[0], texts.getOrNull(1)) + }) + }, + onError = { throwable -> + L.e(throwable, "SearchSubject error") + } + ) reload() } |