aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt48
-rw-r--r--app/src/web/scss/messenger/core/_core_bg.scss4
-rw-r--r--app/src/web/scss/messenger/core/_core_vars.scss10
-rw-r--r--app/src/web/scss/messenger/core/core.scss1
5 files changed, 54 insertions, 13 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 92bea27a..2d3a10c8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -64,6 +64,7 @@ import com.pitchedapps.frost.facebook.FBCDN_NET
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT
+import com.pitchedapps.frost.facebook.MESSENGER_COM
import com.pitchedapps.frost.facebook.USER_AGENT
import com.pitchedapps.frost.facebook.formattedFbUri
import com.pitchedapps.frost.facebook.formattedFbUrl
@@ -311,6 +312,9 @@ fun Context.resolveActivityForUri(uri: Uri): Boolean {
inline val String?.isFacebookUrl
get() = this != null && (contains(FACEBOOK_COM) || contains(FBCDN_NET))
+inline val String?.isMessengerUrl
+get() = this != null && contains(MESSENGER_COM)
+
/**
* [true] if url is a video and can be accepted by VideoViewer
*/
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 b5874bf2..7a7bc293 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -41,6 +41,7 @@ import com.pitchedapps.frost.utils.isExplicitIntent
import com.pitchedapps.frost.utils.isFacebookUrl
import com.pitchedapps.frost.utils.isImageUrl
import com.pitchedapps.frost.utils.isIndirectImageUrl
+import com.pitchedapps.frost.utils.isMessengerUrl
import com.pitchedapps.frost.utils.launchImageActivity
import com.pitchedapps.frost.utils.resolveActivityForUri
import com.pitchedapps.frost.views.FrostWebView
@@ -133,6 +134,13 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
)
}
+ private fun WebView.messengerJsInject() {
+ jsInject(
+ themeProvider.injector(ThemeCategory.MESSENGER),
+ prefs = prefs
+ )
+ }
+
override fun onPageStarted(view: WebView, url: String?, favicon: Bitmap?) {
super.onPageStarted(view, url, favicon)
if (url == null) return
@@ -153,18 +161,25 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
override fun onPageCommitVisible(view: WebView, url: String?) {
super.onPageCommitVisible(view, url)
injectBackgroundColor()
- if (url.isFacebookUrl) {
- v { "Page commit visible" }
- view.facebookJsInject()
- } else {
- refresh.offer(false)
+ when {
+ url.isFacebookUrl -> {
+ v { "FB Page commit visible" }
+ view.facebookJsInject()
+ }
+ url.isMessengerUrl -> {
+ v { "Messenger Page commit visible" }
+ view.messengerJsInject()
+ }
+ else -> {
+ refresh.offer(false)
+ }
}
}
override fun onPageFinished(view: WebView, url: String?) {
url ?: return
v { "finished $url" }
- if (!url.isFacebookUrl) {
+ if (!url.isFacebookUrl && !url.isMessengerUrl) {
refresh.offer(false)
return
}
@@ -182,13 +197,20 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
v { "page finished reveal" }
refresh.offer(false)
injectBackgroundColor()
- web.jsInject(
- JsActions.LOGIN_CHECK,
- JsAssets.TEXTAREA_LISTENER,
- JsAssets.HEADER_BADGES.maybe(isMain),
- prefs = prefs
- )
- web.facebookJsInject()
+ when {
+ web.url.isFacebookUrl -> {
+ web.jsInject(
+ JsActions.LOGIN_CHECK,
+ JsAssets.TEXTAREA_LISTENER,
+ JsAssets.HEADER_BADGES.maybe(isMain),
+ prefs = prefs
+ )
+ web.facebookJsInject()
+ }
+ web.url.isMessengerUrl -> {
+ web.messengerJsInject()
+ }
+ }
}
open fun handleHtml(html: String?) {
diff --git a/app/src/web/scss/messenger/core/_core_bg.scss b/app/src/web/scss/messenger/core/_core_bg.scss
index e69de29b..92d3dd85 100644
--- a/app/src/web/scss/messenger/core/_core_bg.scss
+++ b/app/src/web/scss/messenger/core/_core_bg.scss
@@ -0,0 +1,4 @@
+html, body, :root, #root,
+[style*="background-color: #FFFFFF"], [style*="background-color: #E4E6EB"] {
+ background: $bg_transparent !important;
+}
diff --git a/app/src/web/scss/messenger/core/_core_vars.scss b/app/src/web/scss/messenger/core/_core_vars.scss
new file mode 100644
index 00000000..f15c936c
--- /dev/null
+++ b/app/src/web/scss/messenger/core/_core_vars.scss
@@ -0,0 +1,10 @@
+:root, .__fb-light-mode {
+ // Main background; needs to be opaque to hide gradient used for sender card
+ --messenger-card-background: $bg_transparent !important;
+ // Date
+ --placeholder-text: $text !important;
+ // Emoji background
+ --surface-background: $bg_opaque2 !important;
+ --primary-text: $text !important;
+ --web-wash: #f0f !important;
+} \ No newline at end of file
diff --git a/app/src/web/scss/messenger/core/core.scss b/app/src/web/scss/messenger/core/core.scss
index f6a92475..d5cb691a 100644
--- a/app/src/web/scss/messenger/core/core.scss
+++ b/app/src/web/scss/messenger/core/core.scss
@@ -1,5 +1,6 @@
@import "../../core/colors";
@import "../../core/base";
+@import "core_vars";
@import "core_text";
@import "core_bg";
@import "core_border"; \ No newline at end of file