aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt33
1 files changed, 17 insertions, 16 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
index ede07710..191d9350 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt
@@ -39,24 +39,25 @@ class LoginWebView @JvmOverloads constructor(
lateinit var progressObservable: Subject<Int>
init {
- FbCookie.reset()
- cookieObservable.filter { (_, cookie) -> cookie?.contains(userMatcher) ?: false }
- .subscribe {
- (url, cookie) ->
- L.d("Checking cookie for $url\n\t$cookie")
- val id = userMatcher.find(cookie!!)?.groups?.get(1)?.value
- if (id != null) {
- try {
- FbCookie.save(id.toLong())
- //TODO proceed to next view
- cookieObservable.onComplete()
- loginObservable.onSuccess(CookieModel(id.toLong(), "", cookie))
- } catch (e: NumberFormatException) {
- //todo send report that id has changed
+ FbCookie.reset({
+ cookieObservable.filter { (_, cookie) -> cookie?.contains(userMatcher) ?: false }
+ .subscribe {
+ (url, cookie) ->
+ L.d("Checking cookie for $url\n\t$cookie")
+ val id = userMatcher.find(cookie!!)?.groups?.get(1)?.value
+ if (id != null) {
+ try {
+ FbCookie.save(id.toLong())
+ //TODO proceed to next view
+ cookieObservable.onComplete()
+ loginObservable.onSuccess(CookieModel(id.toLong(), "", cookie))
+ } catch (e: NumberFormatException) {
+ //todo send report that id has changed
+ }
}
}
- }
- setupWebview()
+ setupWebview()
+ })
}
@SuppressLint("SetJavaScriptEnabled")