aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-11-15 04:03:16 -0500
committerAllan Wang <me@allanwang.ca>2017-11-15 04:03:16 -0500
commitf6499a8741b8234770ba61c003f8065da041cdfe (patch)
tree65c8b9564c13f1afa624cface6a824f852e3d29f
parent0b60ad9b70be8cac67913c9e6438a5bb812cbd37 (diff)
downloadfrost-f6499a8741b8234770ba61c003f8065da041cdfe.tar.gz
frost-f6499a8741b8234770ba61c003f8065da041cdfe.tar.bz2
frost-f6499a8741b8234770ba61c003f8065da041cdfe.zip
Fix self loadingv1.6.6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt5
2 files changed, 6 insertions, 4 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 082f4758..d8fa2ce9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -190,9 +190,12 @@ fun Context.createPrivateMediaFile(extension: String) = createPrivateMediaFile("
/**
* Tries to send the uri to the proper activity via an intent
- * @returns {@code true} if activity is resolved, {@code false} otherwise
+ * returns [true] if activity is resolved, [false] otherwise
+ * For safety, any uri that [isFacebookUrl] without [isExplicitIntent] will return [false]
*/
fun Context.resolveActivityForUri(uri: Uri): Boolean {
+ val url = uri.toString()
+ if (url.isFacebookUrl && !url.isExplicitIntent) return false
val intent = Intent(Intent.ACTION_VIEW, uri)
if (intent.resolveActivity(packageManager) == null) return false
startActivity(intent)
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 22b6c0b6..5fc1ab27 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -146,14 +146,13 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
L.v("Url Loading Path", path)
val url = request.url.toString()
if (url.isExplicitIntent) {
- if (!url.contains("com.facebook"))
- view.context.resolveActivityForUri(request.url)
+ view.context.resolveActivityForUri(request.url)
return true
}
if (path.startsWith("/composer/")) return launchRequest(request)
if (url.contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png")))
return launchImage(url)
- if (Prefs.linksInDefaultApp && !url.isFacebookUrl && view.context.resolveActivityForUri(request.url)) return true
+ if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) return true
return super.shouldOverrideUrlLoading(view, request)
}