aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-17 12:38:42 -0700
committerGitHub <noreply@github.com>2017-07-17 12:38:42 -0700
commite4679b1663fa78a99c6c8225e454595c6c6f4e38 (patch)
treea777ee782207c89d6e9243399471b9ad936736d0 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
parent7bf93ea74b00ab7e8ceedac2aac6ad08fdf099ab (diff)
downloadfrost-1.3.2.tar.gz
frost-1.3.2.tar.bz2
frost-1.3.2.zip
Fix notifications and long press for albums (#69)v1.3.2
* Allow for album images to be viewed * Update listing info * Web refractoring * Test message notifications * Fix notifications and context press
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt52
1 files changed, 0 insertions, 52 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
deleted file mode 100644
index 4df6d6a7..00000000
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClient.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.pitchedapps.frost.web
-
-import android.net.Uri
-import android.webkit.ConsoleMessage
-import android.webkit.ValueCallback
-import android.webkit.WebChromeClient
-import android.webkit.WebView
-import ca.allanwang.kau.utils.snackbar
-import com.pitchedapps.frost.contracts.ActivityWebContract
-import com.pitchedapps.frost.utils.L
-import io.reactivex.subjects.BehaviorSubject
-import io.reactivex.subjects.Subject
-
-
-/**
- * Created by Allan Wang on 2017-05-31.
- */
-class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
-
- val progressObservable: Subject<Int> = webCore.progressObservable
- val titleObservable: BehaviorSubject<String> = webCore.titleObservable
- val activityContract = (webCore.context as? ActivityWebContract)
-
- companion object {
- val consoleBlacklist = setOf(
- "edge-chat"
- )
- }
-
- override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
- if (consoleBlacklist.any { consoleMessage.message().contains(it) }) return true
- L.i("Chrome Console ${consoleMessage.lineNumber()}: ${consoleMessage.message()}")
- return true
- }
-
- override fun onReceivedTitle(view: WebView, title: String) {
- super.onReceivedTitle(view, title)
- if (title.contains("http") || titleObservable.value == title) return
- titleObservable.onNext(title)
- }
-
- override fun onProgressChanged(view: WebView, newProgress: Int) {
- super.onProgressChanged(view, newProgress)
- progressObservable.onNext(newProgress)
- }
-
- override fun onShowFileChooser(webView: WebView, filePathCallback: ValueCallback<Array<Uri>>, fileChooserParams: FileChooserParams): Boolean {
- activityContract?.openFileChooser(filePathCallback, fileChooserParams) ?: webView.snackbar("File chooser not found")
- return activityContract != null
- }
-
-} \ No newline at end of file