From 3aa44ba16e52ceaf37dd28a8075b302c42785526 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 27 Sep 2018 19:56:25 -0400 Subject: Fix more lints --- app/src/test/kotlin/com/pitchedapps/frost/MiscTest.kt | 10 +++++----- .../com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'app/src/test/kotlin/com/pitchedapps') diff --git a/app/src/test/kotlin/com/pitchedapps/frost/MiscTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/MiscTest.kt index 2be743a3..d730b933 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/MiscTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/MiscTest.kt @@ -1,7 +1,6 @@ package com.pitchedapps.frost import com.pitchedapps.frost.facebook.requests.zip -import com.pitchedapps.frost.injectors.CssHider import org.junit.Test import kotlin.test.assertTrue @@ -19,10 +18,11 @@ class MiscTest { fun zip() { val now = System.currentTimeMillis() val base = 1 - val data = (0..15).map { Math.random() + base }.toTypedArray().zip( - List::toLongArray, - { Thread.sleep((it * 1000).toLong()); System.currentTimeMillis() - now } - ).blockingGet() + val data: LongArray = (0..15).map { Math.random() + base } + .toTypedArray().zip(List::toLongArray) { + Thread.sleep((it * 1000).toLong()) + System.currentTimeMillis() - now + }.blockingGet() println(data.contentToString()) assertTrue(data.all { it >= base * 1000 && it < base * 1000 * 5 }, "zip did not seem to work on different threads") diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt index 291637c6..c4e51d41 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbFullImageTest.kt @@ -1,13 +1,10 @@ package com.pitchedapps.frost.facebook.requests -import com.pitchedapps.frost.facebook.requests.getFullSizedImage -import com.pitchedapps.frost.facebook.requests.getFullSizedImageUrl import com.pitchedapps.frost.internal.COOKIE import com.pitchedapps.frost.internal.authDependent import org.junit.BeforeClass import org.junit.Test import kotlin.test.assertNotNull -import kotlin.test.assertTrue /** * Created by Allan Wang on 12/04/18. -- cgit v1.2.3 From 857fe0a28ccb5b8f7f3caef4ecd477596fe2468c Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 27 Sep 2018 20:49:45 -0400 Subject: Add tests and move header hider to css --- app/src/main/assets/css/core/core.css | 2 +- app/src/main/assets/css/core/core.scss | 5 +---- app/src/main/assets/css/themes/custom.css | 2 +- app/src/main/assets/css/themes/material_amoled.css | 2 +- app/src/main/assets/css/themes/material_dark.css | 2 +- app/src/main/assets/css/themes/material_glass.css | 2 +- app/src/main/assets/css/themes/material_light.css | 2 +- .../com/pitchedapps/frost/injectors/CssHider.kt | 6 ++--- .../com/pitchedapps/frost/web/DebugWebView.kt | 2 +- .../pitchedapps/frost/web/FrostWebViewClients.kt | 5 +++-- .../com/pitchedapps/frost/facebook/FbDomTest.kt | 26 ++++++++++++++++++++++ 11 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 app/src/test/kotlin/com/pitchedapps/frost/facebook/FbDomTest.kt (limited to 'app/src/test/kotlin/com/pitchedapps') diff --git a/app/src/main/assets/css/core/core.css b/app/src/main/assets/css/core/core.css index b57ef4be..497dd969 100644 --- a/app/src/main/assets/css/core/core.css +++ b/app/src/main/assets/css/core/core.css @@ -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; } diff --git a/app/src/main/assets/css/core/core.scss b/app/src/main/assets/css/core/core.scss index 15074674..8091e2a6 100644 --- a/app/src/main/assets/css/core/core.scss +++ b/app/src/main/assets/css/core/core.scss @@ -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; } diff --git a/app/src/main/assets/css/themes/custom.css b/app/src/main/assets/css/themes/custom.css index ee27be23..c7e31ed5 100644 --- a/app/src/main/assets/css/themes/custom.css +++ b/app/src/main/assets/css/themes/custom.css @@ -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; } diff --git a/app/src/main/assets/css/themes/material_amoled.css b/app/src/main/assets/css/themes/material_amoled.css index 6f044052..7a055429 100644 --- a/app/src/main/assets/css/themes/material_amoled.css +++ b/app/src/main/assets/css/themes/material_amoled.css @@ -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; } diff --git a/app/src/main/assets/css/themes/material_dark.css b/app/src/main/assets/css/themes/material_dark.css index 990b5168..f4e20933 100644 --- a/app/src/main/assets/css/themes/material_dark.css +++ b/app/src/main/assets/css/themes/material_dark.css @@ -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; } diff --git a/app/src/main/assets/css/themes/material_glass.css b/app/src/main/assets/css/themes/material_glass.css index ee16ee2a..bad6bd44 100644 --- a/app/src/main/assets/css/themes/material_glass.css +++ b/app/src/main/assets/css/themes/material_glass.css @@ -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; } diff --git a/app/src/main/assets/css/themes/material_light.css b/app/src/main/assets/css/themes/material_light.css index 55ddebcf..f4a5dee4 100644 --- a/app/src/main/assets/css/themes/material_light.css +++ b/app/src/main/assets/css/themes/material_light.css @@ -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; } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt index 6981fd1c..5444fad8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -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"), diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt index 4c4e5525..ac62f142 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -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), 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 a1fd594f..8824e635 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -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) diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbDomTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbDomTest.kt new file mode 100644 index 00000000..ce748907 --- /dev/null +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbDomTest.kt @@ -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")) + } + +} \ No newline at end of file -- cgit v1.2.3