From fc375400411de3e7113a296b618940ef7b2b655c Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 31 Mar 2019 22:51:32 -0400 Subject: Remove round transformations --- app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt index d7a7de0e..d60ea7ed 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt @@ -53,7 +53,7 @@ class AccountItem(val cookie: CookieModel?) : KauIItem { + .transform(FrostGlide.circleCrop).listener(object : RequestListener { override fun onResourceReady( resource: Drawable?, model: Any?, -- cgit v1.2.3 From d0b4471667a3979deddf2c1e947cff301fb4d254 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 4 Apr 2019 21:28:41 -0400 Subject: Merge mute specific fixes (#1386) * Merge mute specific fixes * Remove version tag in user agent * Add extra forward slash * Update kau --- app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt | 4 ++-- app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt | 1 + app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt | 6 +++--- docs/Changelog.md | 3 +++ gradle.properties | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt index 1d6937f7..8bca6b67 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt @@ -22,7 +22,7 @@ package com.pitchedapps.frost.facebook const val FACEBOOK_COM = "facebook.com" const val FBCDN_NET = "fbcdn.net" -const val HTTPS_FACEBOOK_COM = "https://$FACEBOOK_COM" +const val HTTPS_FACEBOOK_COM = "https://$FACEBOOK_COM/" const val FB_URL_BASE = "https://m.$FACEBOOK_COM/" fun profilePictureUrl(id: Long) = "https://graph.facebook.com/$id/picture?type=large" const val FB_LOGIN_URL = "${FB_URL_BASE}login" @@ -30,7 +30,7 @@ const val FB_HOME_URL = "${FB_URL_BASE}home.php" // Default user agent const val USER_AGENT_FULL = - "Mozilla/5.0 (Linux; Android 7.1; Mi A1 Build/N2G47H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36" + "Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A3000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36" // Basic user agent; non mobile version const val USER_AGENT_BASIC = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt index 0e9d94e6..37b2234d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt @@ -70,6 +70,7 @@ class FrostWebView @JvmOverloads constructor( else USER_AGENT_FULL with(settings) { javaScriptEnabled = true + mediaPlaybackRequiresUserGesture = false // TODO check if we need this allowFileAccess = true textZoom = Prefs.webTextScaling } 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 90c4c7e2..e278db80 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -24,7 +24,7 @@ import android.util.AttributeSet import android.view.View import android.webkit.WebView import ca.allanwang.kau.utils.withAlpha -import com.pitchedapps.frost.facebook.USER_AGENT_BASIC +import com.pitchedapps.frost.facebook.USER_AGENT_FULL import com.pitchedapps.frost.injectors.CssHider import com.pitchedapps.frost.injectors.jsInject import com.pitchedapps.frost.utils.L @@ -53,9 +53,9 @@ class DebugWebView @JvmOverloads constructor( } @SuppressLint("SetJavaScriptEnabled") - fun setupWebview() { + private fun setupWebview() { settings.javaScriptEnabled = true - settings.userAgentString = USER_AGENT_BASIC + settings.userAgentString = USER_AGENT_FULL setLayerType(View.LAYER_TYPE_HARDWARE, null) webViewClient = DebugClient() isDrawingCacheEnabled = true diff --git a/docs/Changelog.md b/docs/Changelog.md index 99ba22d2..78f796d6 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## v2.2.4 +* Show top bar to allow sharing posts + ## v2.2.3 * Add ability to hide stories * Remove fbclid from urls diff --git a/gradle.properties b/gradle.properties index 80b320d7..3e449ebc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro APP_ID=Frost APP_GROUP=com.pitchedapps -KAU=998782a +KAU=4.0.0 KOTLIN=1.3.21 # https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google -- cgit v1.2.3 From e8c52e6ab127dae71d51b7b54c98bfd724568de3 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 13 Apr 2019 19:52:24 -0400 Subject: Update user agent (#1400) * Rename user agent and update chrome for desktop, resolves #1387 * Rename more basic to desktop * Apply spotless --- app/src/main/AndroidManifest.xml | 2 +- .../frost/activities/WebOverlayActivity.kt | 12 ++++++------ .../com/pitchedapps/frost/debugger/OfflineWebsite.kt | 4 ++-- .../kotlin/com/pitchedapps/frost/facebook/FbConst.kt | 8 ++++---- .../pitchedapps/frost/facebook/requests/FbRequest.kt | 4 ++-- .../kotlin/com/pitchedapps/frost/utils/Downloader.kt | 6 +++--- .../main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 8 ++++---- .../com/pitchedapps/frost/views/FrostWebView.kt | 10 +++++----- .../kotlin/com/pitchedapps/frost/web/DebugWebView.kt | 4 ++-- .../frost/web/FrostUrlOverlayValidator.kt | 20 ++++++++++---------- .../kotlin/com/pitchedapps/frost/web/LoginWebView.kt | 1 - docs/Changelog.md | 4 ++++ 12 files changed, 43 insertions(+), 40 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ad1fcbdc..5656860c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -48,7 +48,7 @@ android:launchMode="singleTop" android:theme="@style/FrostTheme.Overlay.Slide" /> >.withEmptyData(vararg key: String): List Context.launchWebOverlay fun Context.launchWebOverlay(url: String) = launchWebOverlayImpl(url) -fun Context.launchWebOverlayBasic(url: String) = launchWebOverlayImpl(url) +fun Context.launchWebOverlayDesktop(url: String) = launchWebOverlayImpl(url) private fun Context.fadeBundle() = ActivityOptions.makeCustomAnimation( this, @@ -393,7 +393,7 @@ fun frostJsoup(cookie: String?, url: String) = Jsoup.connect(url).run { if (cookie.isNullOrBlank()) this else cookie(FACEBOOK_COM, cookie) - }.userAgent(USER_AGENT_BASIC).get()!! + }.userAgent(USER_AGENT_DESKTOP).get()!! fun Element.first(vararg select: String): Element? { select.forEach { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt index 37b2234d..cc8e3fbc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostWebView.kt @@ -29,8 +29,8 @@ import com.pitchedapps.frost.contracts.FrostContentCore import com.pitchedapps.frost.contracts.FrostContentParent import com.pitchedapps.frost.facebook.FB_HOME_URL import com.pitchedapps.frost.facebook.FbItem -import com.pitchedapps.frost.facebook.USER_AGENT_BASIC -import com.pitchedapps.frost.facebook.USER_AGENT_FULL +import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP +import com.pitchedapps.frost.facebook.USER_AGENT_MOBILE import com.pitchedapps.frost.fragments.WebFragment import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.frostDownload @@ -38,7 +38,7 @@ import com.pitchedapps.frost.web.FrostChromeClient import com.pitchedapps.frost.web.FrostJSI import com.pitchedapps.frost.web.FrostWebViewClient import com.pitchedapps.frost.web.NestedWebView -import com.pitchedapps.frost.web.shouldUseBasicAgent +import com.pitchedapps.frost.web.shouldUseDesktopAgent /** * Created by Allan Wang on 2017-05-29. @@ -66,8 +66,8 @@ class FrostWebView @JvmOverloads constructor( @SuppressLint("SetJavaScriptEnabled") override fun bind(container: FrostContentContainer): View { userAgentString = - if (parent.baseEnum == FbItem.MESSAGES || parent.baseUrl.shouldUseBasicAgent) USER_AGENT_BASIC - else USER_AGENT_FULL + if (parent.baseEnum == FbItem.MESSAGES || parent.baseUrl.shouldUseDesktopAgent) USER_AGENT_DESKTOP + else USER_AGENT_MOBILE with(settings) { javaScriptEnabled = true mediaPlaybackRequiresUserGesture = false // TODO check if we need this 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 e278db80..6511ef9f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/DebugWebView.kt @@ -24,7 +24,7 @@ import android.util.AttributeSet import android.view.View import android.webkit.WebView import ca.allanwang.kau.utils.withAlpha -import com.pitchedapps.frost.facebook.USER_AGENT_FULL +import com.pitchedapps.frost.facebook.USER_AGENT_MOBILE import com.pitchedapps.frost.injectors.CssHider import com.pitchedapps.frost.injectors.jsInject import com.pitchedapps.frost.utils.L @@ -55,7 +55,7 @@ class DebugWebView @JvmOverloads constructor( @SuppressLint("SetJavaScriptEnabled") private fun setupWebview() { settings.javaScriptEnabled = true - settings.userAgentString = USER_AGENT_FULL + settings.userAgentString = USER_AGENT_MOBILE setLayerType(View.LAYER_TYPE_HARDWARE, null) webViewClient = DebugClient() isDrawingCacheEnabled = true diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt index 24885fdf..81ade98f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt @@ -22,7 +22,7 @@ import com.pitchedapps.frost.activities.WebOverlayActivityBase import com.pitchedapps.frost.contracts.VideoViewHolder import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem -import com.pitchedapps.frost.facebook.USER_AGENT_BASIC +import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs @@ -32,7 +32,7 @@ import com.pitchedapps.frost.utils.isIndirectImageUrl import com.pitchedapps.frost.utils.isVideoUrl import com.pitchedapps.frost.utils.launchImageActivity import com.pitchedapps.frost.utils.launchWebOverlay -import com.pitchedapps.frost.utils.launchWebOverlayBasic +import com.pitchedapps.frost.utils.launchWebOverlayDesktop import com.pitchedapps.frost.views.FrostWebView /** @@ -76,15 +76,15 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean { if (!Prefs.overlayEnabled) return false if (context is WebOverlayActivityBase) { L.v { "Check web request from overlay" } - val shouldUseBasic = url.formattedFbUrl.shouldUseBasicAgent + val shouldUseDesktop = url.formattedFbUrl.shouldUseDesktopAgent //already overlay; manage user agent - if (userAgentString != USER_AGENT_BASIC && shouldUseBasic) { - L.i { "Switch to basic agent overlay" } - context.launchWebOverlayBasic(url) + if (userAgentString != USER_AGENT_DESKTOP && shouldUseDesktop) { + L.i { "Switch to desktop agent overlay" } + context.launchWebOverlayDesktop(url) return true } - if (userAgentString == USER_AGENT_BASIC && !shouldUseBasic) { - L.i { "Switch from basic agent" } + if (userAgentString == USER_AGENT_DESKTOP && !shouldUseDesktop) { + L.i { "Switch from desktop agent" } context.launchWebOverlay(url) return true } @@ -103,9 +103,9 @@ val messageWhitelist: Set = setOf(FbItem.MESSAGES, FbItem.CHAT, FbItem.FEED_MOST_RECENT, FbItem.FEED_TOP_STORIES) .mapTo(mutableSetOf(), FbItem::url) -val String.shouldUseBasicAgent: Boolean +val String.shouldUseDesktopAgent: Boolean get() = when { - contains("story.php") -> false // do not use basic for comment section + contains("story.php") -> false // do not use desktop for comment section contains("/events/") -> false // do not use for events (namely the map) contains("/messages") -> true // must use for messages else -> false // default to normal user agent diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt index 1c300b03..c27385fc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt @@ -35,7 +35,6 @@ import com.pitchedapps.frost.facebook.FB_USER_MATCHER import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.get import com.pitchedapps.frost.injectors.CssHider -import com.pitchedapps.frost.injectors.JsAssets import com.pitchedapps.frost.injectors.jsInject import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs diff --git a/docs/Changelog.md b/docs/Changelog.md index 78f796d6..7a6bbfab 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,6 +2,9 @@ ## v2.2.4 * Show top bar to allow sharing posts +* Fix unmuting videos when autoplay is enabled +* Add shortcut to toggle autoplay in settings > behaviour +* Update theme ## v2.2.3 * Add ability to hide stories @@ -9,6 +12,7 @@ * Apply notification keyword filter to title as well * Remove round icon settings as they are the default in Facebook * Update theme +* Update translations ## v2.2.2 * New marketplace shortcut -- cgit v1.2.3