1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-09-20 07:31:40 +02:00

Merge pull request #1541 from AllanWang/menu-fragment

Fix menu loading visibility
This commit is contained in:
Allan Wang 2019-09-14 20:51:23 -07:00 committed by GitHub
commit 5071a44197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View File

@ -127,7 +127,9 @@ class FrostJSI(val web: FrostWebView) {
@JavascriptInterface
fun isReady() {
refresh.offer(false)
if (web.frostWebClient !is FrostWebViewClientMenu) {
refresh.offer(false)
}
}
@JavascriptInterface

View File

@ -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
}
}