Jobeso / react-native-whatsapp-stickers

Integrate sticker packs for WhatsApp with your react-native app
Other
81 stars 30 forks source link

Stickers from URL #13

Open kesepara opened 5 years ago

kesepara commented 5 years ago

Is it possible to add sticker packs to whatsapp from images which has fetched by url?

If not, is there any solution for this problem ? Maybe saving the image file first etc. ?

Jobeso commented 5 years ago

Hey @kesepara, this is currently not possible and not supported natively by WhatsApp. There are solutions to do that but I am currently not working on it. This is definitely something the library should support in the future. If there is someone willing to support on this, I'm glad for help.

kesepara commented 5 years ago

Oh i see @Jobeso . I am working on a project right now that should contains this feature too. So i need to do this on my own. I will let you know when i did that. Do you have any ideas for me to do that quickly? Or any other plugins to work with to upload stickers from URL. For example i think that i need to use react-native-fs first to save the files first. Or do i need to save the files first?

Any suggestions would be really appreciated.

Jobeso commented 5 years ago

Yeah I try to give you some hints. First of all, is your project cross platform or only for one os?

kesepara commented 5 years ago

Yeah I try to give you some hints. First of all, is your project cross platform or only for one os?

Cross platform. I've created my project with "react-native init" command.

Jobeso commented 5 years ago

So for iOS an approach could be to save them as a local image with rn-fs (like you mentioned) or to base64, convert them to imageData and add support of imageData to this library like discussed in #11. So there is a function addSticker in the native code in StickerPack.swift with imageData type as a parameter. This method is currently not exposed but could be an approach for you. For Android it's not that easy and I don't know an approach currently but I can tell you about the problem. On Android the library uses a ContentProvider. This needs to be available even if the app is not in the foreground. A ContentProvider behaves similar to a static method so you can't use the dynamic approach. At least this is what I figured out when developing this library.

kesepara commented 5 years ago

So for iOS an approach could be to save them as a local image with rn-fs (like you mentioned) or to base64, convert them to imageData and add support of imageData to this library like discussed in #11. So there is a function addSticker in the native code in StickerPack.swift with imageData type as a parameter. This method is currently not exposed but could be an approach for you. For Android it's not that easy and I don't know an approach currently but I can tell you about the problem. On Android the library uses a ContentProvider. This needs to be available even if the app is not in the foreground. A ContentProvider behaves similar to a static method so you can't use the dynamic approach. At least this is what I figured out when developing this library.

Thank you for hints. I'll let you know if i can make any progress.

PasinduDineth commented 5 years ago

waiting for this feature. Thanks for the library. working fine!!

srameshr commented 5 years ago

Was this added to the plugin?

Jobeso commented 5 years ago

@srameshr No I didn't implement it yet. I am actually thankful for help on that because I don't know a solution how to solve this on Android. Do you have plans working on this?

srameshr commented 5 years ago

@Jobeso Oh, sorry. I have no idea about it. Does it work on iOS though?

Jobeso commented 5 years ago

@srameshr No the functionality is also not supported by default by this library for iOS but I posted a way how to achieve this above. This is only theoretically because the official library from WhatApp doesn't support this behaviour. The above mentioned would be a way I assume it to work on iOS.

jowo-io commented 5 years ago

@Jobeso thanks for taking the time to outline how this could be done on iOS. The description was useful to me. (as is this entire repo, really awesome!)

I'm just wondering if anything has changed with what you said about Android?

... On Android the library uses a ContentProvider. This needs to be available even if the app is not in the foreground. A ContentProvider behaves similar to a static method so you can't use the dynamic approach. At least this is what I figured out when developing this library.

Any further info here would be greatly appreciated!

Cheers, Jo

Jobeso commented 5 years ago

Hey @pureth, glad to hear that this library helps you :) I browsed the WhatsApp sticker repo issues lately and found some hints how people implemented this behaviour on the native side but I didn't find the time to dig deeper into it yet.

vasconcelosvcd commented 5 years ago

@Jobeso is there any repo that I can see where did you stop so I can try to help you ?

stickers-internet

I've found this repo, I'll get deeper into it.

Jobeso commented 5 years ago

Hey @vasconcelosvcd, great to hear that you want to help out, appreciate it. I think the repo you posted is a good lead. They also added some info to their readme about that here. When I remember correctly my main problem was that the content provider or the content file parser acts statically and I couldn't figure out how to dynamically add stickers through the functions without having them available on app start.

ursnj commented 4 years ago

Any update on this ???

malithjkmt commented 4 years ago

Has anyone got a PR for this? :) @Jobeso any updates?

Pcpkomputer commented 3 years ago

up up

KishorJena commented 2 years ago

I found a guide on medium But I could not use it as I just resumed learning android after 3 years Part 1 Part 2

I hope this will help someone who is looking for it