aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-14 20:51:23 -0700
committerGitHub <noreply@github.com>2019-09-14 20:51:23 -0700
commit5071a44197cdc3b7ad4a2c3d188fcfd205f32449 (patch)
tree0fa0cb3ae1df832c8025afb8db5e745b66ded6a3
parent87851180e3259dacf0114c549e4dff5b48fe4e7e (diff)
parent21e745aeec6f57c0b972faa267c21c96bdb8224f (diff)
downloadfrost-5071a44197cdc3b7ad4a2c3d188fcfd205f32449.tar.gz
frost-5071a44197cdc3b7ad4a2c3d188fcfd205f32449.tar.bz2
frost-5071a44197cdc3b7ad4a2c3d188fcfd205f32449.zip
Merge pull request #1541 from AllanWang/menu-fragment
Fix menu loading visibility
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt18
2 files changed, 5 insertions, 17 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 376257d4..449e98f1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -127,7 +127,9 @@ class FrostJSI(val web: FrostWebView) {
@JavascriptInterface
fun isReady() {
- refresh.offer(false)
+ if (web.frostWebClient !is FrostWebViewClientMenu) {
+ refresh.offer(false)
+ }
}
@JavascriptInterface
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 025119aa..9e45d4fe 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -23,7 +23,6 @@ import android.webkit.WebResourceResponse
import android.webkit.WebView
import android.webkit.WebViewClient
import ca.allanwang.kau.utils.withAlpha
-import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.formattedFbUrl
@@ -203,22 +202,12 @@ private const val EMIT_FINISH = 0
*/
class FrostWebViewClientMenu(web: FrostWebView) : FrostWebViewClient(web) {
- private val String.shouldInjectMenu
- get() = when (removePrefix(FB_URL_BASE)) {
- "settings",
- "settings#",
- "settings#!/settings?soft=bookmarks" -> true
- else -> false
- }
-
override fun onPageFinished(view: WebView, url: String?) {
super.onPageFinished(view, url)
if (url == null) {
return
}
- if (url.shouldInjectMenu) {
- jsInject(JsAssets.MENU)
- }
+ jsInject(JsAssets.MENU)
}
override fun emit(flag: Int) {
@@ -231,9 +220,6 @@ class FrostWebViewClientMenu(web: FrostWebView) : FrostWebViewClient(web) {
}
override fun onPageFinishedActions(url: String) {
- v { "Should inject ${url.shouldInjectMenu}" }
- if (!url.shouldInjectMenu) {
- injectAndFinish()
- }
+ // Skip
}
}