aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-06 19:29:25 -0700
committerAllan Wang <me@allanwang.ca>2017-06-06 19:29:25 -0700
commit067ea15188f20fa268255153e35c2df732fdffee (patch)
tree87a0fcd84f37ad569ec2743ffc702a69cd59e252 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
parentc4e22f5512570d05178711ba90c28eb6dc288253 (diff)
downloadfrost-067ea15188f20fa268255153e35c2df732fdffee.tar.gz
frost-067ea15188f20fa268255153e35c2df732fdffee.tar.bz2
frost-067ea15188f20fa268255153e35c2df732fdffee.zip
Clean up injectors and events
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
index a3233c4c..045c180f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -1,13 +1,26 @@
package com.pitchedapps.frost.web
+import android.content.Context
import android.webkit.JavascriptInterface
+import com.pitchedapps.frost.LoginActivity
+import com.pitchedapps.frost.SelectorActivity
+import com.pitchedapps.frost.dbflow.CookieModel
+import com.pitchedapps.frost.utils.launchNewTask
+import com.pitchedapps.frost.utils.launchWebOverlay
/**
* Created by Allan Wang on 2017-06-01.
*/
-class FrostJSI {
+class FrostJSI(val context: Context, val cookies: ArrayList<CookieModel>) {
@JavascriptInterface
- fun loadUrl(url: String){
+ fun loadUrl(url: String) = context.launchWebOverlay(url)
+ @JavascriptInterface
+ fun loadLogin() {
+ if (cookies.isNotEmpty())
+ context.launchNewTask(SelectorActivity::class.java, cookies)
+ else
+ context.launchNewTask(LoginActivity::class.java, clearStack = false)
}
+
} \ No newline at end of file