aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}