carsten-klaffke / send-intent

Repository for send-intent Capacitor plugin
MIT License
106 stars 12 forks source link

update to capacitor 3 #8

Closed RaulPROP closed 3 years ago

RaulPROP commented 3 years ago

Hello,

first of all, thank you for your library, it is really useful :)

I've updated it to capacitor 3.0 following this guide.

While doing that I've cleaned up a bit the repo, removing the .zip files and adding a .gitignore.

I've also added ios to the example, updated the README.md and modified the mayor version of the package.

Here's a list with all the changes:

Everything was tested on both android and ios using the example and the project that I'm using this library and it works.

j-d-carmichael commented 3 years ago

@RaulPROP would you be able to add to the android java file after line https://github.com/RaulPROP/send-intent/blob/master/android/src/main/java/de/mindlib/sendIntent/SendIntent.java#L57:

ret.put("text", intent.getStringExtra(Intent.EXTRA_TEXT));

So it looks like:

             ret.put("text", stringExtra);
                    }
                    call.resolve(ret);
                } else if (type.startsWith("image/")) {
                    JSObject ret = new JSObject();
                    ret.put("image", encoder((Uri) intent.getExtras().get(Intent.EXTRA_STREAM)));
                    ret.put("text", intent.getStringExtra(Intent.EXTRA_TEXT));
                    call.resolve(ret);
                } else if (type.equals("application/octet-stream")) {
                    JSObject ret = new JSObject();

This grabs any additional text send with an image through this intent plugin. Apps like zelando send data as type image but include important URL data in the additional text.

j-d-carmichael commented 3 years ago

Additionally (i'm just integrating you code btw :) massive thanks for the upgrade)... the defiintions don't appear to include image for the base64:

https://github.com/RaulPROP/send-intent/blob/master/src/definitions.ts#L2

export interface SendIntentPlugin {
  checkSendIntentReceived(): Promise<{
    text?: string,
    image?: string
  }>;
}

With an image there might not be text and vice versa

RaulPROP commented 3 years ago

Hi @j-d-carmichael ,

I've just added the changes, and also added file to the typescript interface.