j3k0 / cordova-plugin-openwith

Get your Cordova App in the O.S. "Share" menu on iOS and Android
MIT License
138 stars 114 forks source link

public.movie and public.url dont work #68

Open joshoconnor89 opened 5 years ago

joshoconnor89 commented 5 years ago

I initially was not able to able to get the app showing when sharing a link in safari or a video file. That was when I realized that the ShareExtension/ShareExtension.plist wasn't set up for it:

<dict>
    <key>NSExtensionActivationDictionaryVersion</key>
    <integer>2</integer>
    <key>NSExtensionActivationRule</key>
    <dict>
        <key>NSExtensionActivationSupportsImageWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsMovieWithMaxCount</key>
        <integer>1</integer>
        <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
        <integer>1</integer>
    </dict>
    <key>NSExtensionActivationUsesStrictMatching</key>
    <integer>1</integer>
</dict>

After that, the app began appearing when sharing videos/webpages from Safari, but, after selecting the video/website to share, I notice that none of them work. I've tried UTI's of public.movie, public.item, and nothing works. The only thing that works is images, if the UTI is set to public.image or public.item. Otherwise, the data is alway empty:

Attempting to share a movie, in OpenWithPlugin.m's checkForFileToShare method:

{
    backURL = "photos-redirect://";
    data = <>;
    name = "";
    text = "Movie\n";
    uti = "public.mpeg-4";
    utis =     (
        "public.mpeg-4"
    );
}

Attempting to share a website, in OpenWithPlugin.m's checkForFileToShare method:

{
    backURL = "";
    data = <>;
    name = "";
    text = "f - Google Search";
    uti = "public.url";
    utis =     (
        "public.url"
    );
}

It seem's as if ShareViewController.m didSelectPost method isnt grabbing the data correctly. public.image works great without issues. Are other UTI's supported in this plugin besides images?

joshoconnor89 commented 5 years ago

My latest commit on my fork allows me to share videos: https://github.com/joshoconnor89/cordova-plugin-openwith/commit/796a66de04c798f38383372d8772342bd5c75df8

NiklasMerz commented 5 years ago

Thank you for reporting. Would you like to create a PR for that?

HarelM commented 4 years ago

I would like to do some more advanced stuff with this plugin, but I'm not sure if it possible or not. and if it's possible only by using a fork which I would like to avoid. I would like to be able to open GPX files (used for navigation). For that I need to define a UTI type and do all kinds plist manipulation. I was wondering if someone had done it. The following is what I would like to add to my app, I'm not sure if I need to add it to the ShareExtension-Info.plist file or my app's info-plist file, or both. Any help would be appreciated. https://github.com/IsraelHikingMap/Site/blob/02515d4a74cb101a28a78c146c050a9eef589a91/IsraelHiking.Web/config.xml#L204L260