aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-23 19:09:55 -0800
committerGitHub <noreply@github.com>2020-02-23 19:09:55 -0800
commite893c5ab9a976031c15e792583b411f6c9a429e5 (patch)
tree159692a4520bea0735d2ab89f9f5623c98a9aa16 /app/src/main/kotlin/com
parent358cd0771de790e299ff8516d422f9b8e075c4e2 (diff)
parentd07fc10926cdf9d28b3fbbe080a43b6703641474 (diff)
downloadfrost-e893c5ab9a976031c15e792583b411f6c9a429e5.tar.gz
frost-e893c5ab9a976031c15e792583b411f6c9a429e5.tar.bz2
frost-e893c5ab9a976031c15e792583b411f6c9a429e5.zip
Merge pull request #1650 from AllanWang/sharing
Sharing
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt21
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt2
2 files changed, 15 insertions, 8 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
index bdaf22ba..43b7071e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
@@ -48,6 +48,7 @@ import kotlinx.coroutines.channels.SendChannel
*/
class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
+ private val refresh: SendChannel<Boolean> = web.parent.refreshChannel
private val progress: SendChannel<Int> = web.parent.progressChannel
private val title: SendChannel<String> = web.parent.titleChannel
private val activity = (web.context as? ActivityContract)
@@ -83,6 +84,12 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
return activity != null
}
+ private fun JsResult.frostCancel() {
+ cancel()
+ refresh.offer(false)
+ progress.offer(100)
+ }
+
override fun onJsAlert(
view: WebView,
url: String,
@@ -93,7 +100,7 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- onDismiss { result.cancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -108,8 +115,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -124,8 +131,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -144,8 +151,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
result.confirm(charSequence.toString())
}
// positive button added through input
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
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 a3c61323..4d635547 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -215,7 +215,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
return true
}
// Convert desktop urls to mobile ones
- if (url.contains("https://www.facebook.com")) {
+ if (url.contains("https://www.facebook.com") && urlSupportsRefresh(url)) {
view.loadUrl(url.replace(WWW_FACEBOOK_COM, FACEBOOK_BASE_COM))
return true
}