diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-15 13:46:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-15 13:46:41 -0700 |
commit | 19ec9b543e15fe453b576f1b38994b3f8692054f (patch) | |
tree | 99600f87160b492de453a7f249bf3b258b5ef990 /app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | |
parent | 203305e1890f9e23caa80d7ad6921767f830a4da (diff) | |
download | frost-19ec9b543e15fe453b576f1b38994b3f8692054f.tar.gz frost-19ec9b543e15fe453b576f1b38994b3f8692054f.tar.bz2 frost-19ec9b543e15fe453b576f1b38994b3f8692054f.zip |
Add checks before injections (#180)
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 5 |
1 files changed, 4 insertions, 1 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 e79816f3..ad9340d7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -172,10 +172,13 @@ fun Context.createPrivateMediaFile(extension: String) = createPrivateMediaFile(" * @returns {@code true} if activity is resolved, {@code false} otherwise */ fun Context.resolveActivityForUri(uri: Uri): Boolean { - if (uri.toString().contains(FACEBOOK_COM) && !uri.toString().contains("intent:")) return false //ignore response as we will be triggering ourself + if (uri.toString().isFacebookUrl && !uri.toString().contains("intent:")) return false //ignore response as we will be triggering ourself val intent = Intent(Intent.ACTION_VIEW, uri) if (intent.resolveActivity(packageManager) == null) return false startActivity(intent) return true } +inline val String?.isFacebookUrl + get() = this != null && this.contains(FACEBOOK_COM) + |