1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 13:02:35 +01:00

Add tests and move header hider to css

This commit is contained in:
Allan Wang 2018-09-27 20:49:45 -04:00
parent 2bc366f8f4
commit 857fe0a28c
11 changed files with 40 additions and 16 deletions

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -1,6 +1,5 @@
@import "colors";
@import "base";
@import "core_text";
@import "core_bg";
@import "core_border";
@ -15,7 +14,7 @@
// box-shadow: none !important;
// }
//menu spinner
[data-sigil=m_login_upsell],
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}
@ -24,8 +23,6 @@
color: $text !important;
}
.excessItem {
outline: $divider !important;
}

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -210,7 +210,7 @@ button ._v89 ._54k8._1fl1 {
box-shadow: none !important;
}
[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
[data-sigil=m_login_upsell] [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] {
display: none !important;
}

View File

@ -8,9 +8,9 @@ import android.webkit.WebView
* List of elements to hide
*/
enum class CssHider(vararg val items: String) : InjectorContract {
CORE("[data-sigil=m_login_upsell]", "role=progressbar"),
// HEADER("#header", "[data-sigil=MTopBlueBarHeader]",
// "#header-notices", "[data-sigil*=m-promo-jewel-header]"),
CORE("[data-sigil=m_login_upsell]", "[role=progressbar]"),
HEADER("#header", "#mJewelNav", "[data-sigil=MTopBlueBarHeader]",
"#header-notices", "[data-sigil*=m-promo-jewel-header]"),
ADS("article[data-xt*=sponsor]",
"article[data-store*=sponsor]"),
PEOPLE_YOU_MAY_KNOW("article._d2r"),

View File

@ -82,7 +82,7 @@ class DebugWebView @JvmOverloads constructor(
if (url.isFacebookUrl)
view.jsInject(
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
CssHider.CORE,
// CssHider.CORE,
CssHider.COMPOSER.maybe(!Prefs.showComposer),
CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups),

View File

@ -65,7 +65,8 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
if (url.isFacebookUrl)
view.jsInject(
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
CssHider.CORE,
// CssHider.CORE,
CssHider.HEADER,
CssHider.COMPOSER.maybe(!Prefs.showComposer),
CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups),
@ -76,7 +77,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
JsAssets.CLICK_A,
CssHider.ADS.maybe(!Prefs.showFacebookAds),
JsAssets.CONTEXT_A,
JsAssets.HEADER_HIDER,
// JsAssets.HEADER_HIDER,
JsAssets.MEDIA)
else
refresh.onNext(false)

View File

@ -0,0 +1,26 @@
package com.pitchedapps.frost.facebook
import com.pitchedapps.frost.internal.authDependent
import com.pitchedapps.frost.internal.testJsoup
import org.junit.BeforeClass
import org.junit.Test
import kotlin.test.assertNotNull
class FbDomTest {
companion object {
@BeforeClass
@JvmStatic
fun before() {
authDependent()
}
}
@Test
fun checkHeaders() {
val doc = testJsoup(FB_URL_BASE)
assertNotNull(doc.getElementById("header"))
assertNotNull(doc.getElementById("mJewelNav"))
}
}