then my extension is only "active" when a single image is selected. And by "active" I mean, is available in the UI as a choice. If I select a movie in Photos, it is not active. If I select a screen grab (PNG, I assume), it is not ative.
BUT: If I select a PNG and an image, it is active.
It looks like .@count == $extensionItem.attachments.@count may be the solution. When I use:
If I select a PNG and an other (jpeg) image, my extension is not active. Though, if I select two live images, it is active.
When I do this, it seems improved:
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.heic"
).@count == 1
).@count == 1
AND
SUBQUERY (
extensionItems,
$extensionItem,
SUBQUERY (
$extensionItem.attachments,
$attachment,
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.jpeg" ||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.heic"
).@count == $extensionItem.attachments.@count
).@count == 1
a) If I select a single image, it is active.
b) Selecting two images, it is not active.
c) Selecting two live images, it is not active.
d) Selecting an image and a movie it is not active.
Now to try the parallel thing for url's (not going to worry about live images as that doesn't seem to work from sharing extensions):
This is documentation for my future use.
If I just put this one:
then my extension is only "active" when a single image is selected. And by "active" I mean, is available in the UI as a choice. If I select a movie in Photos, it is not active. If I select a screen grab (PNG, I assume), it is not ative. BUT: If I select a PNG and an image, it is active.
It looks like
.@count == $extensionItem.attachments.@count
may be the solution. When I use:If I select a PNG and an other (jpeg) image, my extension is not active. Though, if I select two live images, it is active.
When I do this, it seems improved:
a) If I select a single image, it is active. b) Selecting two images, it is not active. c) Selecting two live images, it is not active. d) Selecting an image and a movie it is not active.
Now to try the parallel thing for url's (not going to worry about live images as that doesn't seem to work from sharing extensions):
This does allow images to be selected in Photos!
Trying this:
Same thing: This does allow images to be selected in Photos! Probably because of the <= 2 constraint. 0 is <= 2.
That's not allowing a URL to be selected in Safari.
That seems to do the trick!
Next to try to combine the two results:
This seems to work OK, but has a problem with some images labeled HDR in the simulator.
Try to remove HEIC since I'm not dealing with them as still images yet:
The same issue occurs with the same image. But it seems to work well enough so that's where I'm going to leave it for now.