Is there a way to filter Share extension to show only when, for example, the URL domain is a specific one?
For example, I want to show my app extension only when the user is sharing a google link:
http://www.google.com/?someQuery
If I'm filtering to get URLs, a code like below would be sufficient:
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url"
).@count == $extensionItem.attachments.@count
).@count == 1
In this case the predicate access the $attachment
's registeredTypeIdentifiers
property and evaluate it. I want to be able to match a REGEX against the value inside the $attachment
, something like this:
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" AND
ANY $attachment.value MATCHES "^http\:\/\/www\.google\.com\/"
).@count == $extensionItem.attachments.@count
).@count == 1
... so my extension would be invisible when my application don't support the URL shared by the host app.
PS: Note that the URL domain used is only an example. The real one, of course, have a meaning to be used like this.