EddyVerbruggen / SocialSharing-PhoneGap-Plugin

πŸ‘¨β€β€οΈβ€πŸ’‹β€πŸ‘¨ Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 906 forks source link

On Android some external urls in file array don't work from Firebase Storage Image url, on IOS it does. #690

Open numerized opened 7 years ago

numerized commented 7 years ago

I've found a special case where a certain type of url doesn't work with android (all sharing platforms) but works on ios all sharing platforms Twitter, Facebook, Email, SMS, Slack it's perfect, thanks for awesomeness ! πŸ‘

https://firebasestorage.googleapis.com/v0/b/emoviser.appspot.com/o/images%2Fimage-1476230096116.jpg?alt=media&token=fc949e81-1969-4dfc-b905-38c64387fac4

It's a url from firebase, it works great with iOS plugin but not with Android

Do you think you can have a lot, it's blocking my google store submission for now.

Appstore is about to accept my submission in few hours.

    console.log(this.imageSaved)
    var options = {
      message: 'My Last Mooz !!!!', // not supported on some apps (Facebook, Instagram)
      subject: 'Here we go !', // fi. for email
      files: [this.imageSaved], // an array of filenames either locally or remotely
      chooserTitle: 'Pick an app' // Android only, you can override the default share sheet title
    }

    var onSuccess = (result) => {
            console.log("Sharing succeeded with message: " + result);
    }

    var onError = (msg) => {
      console.log("Sharing failed with message: " + msg);
    }

    SocialSharing.shareWithOptions(options)
      .then((result) => onSuccess)
      .catch(() => onError);
  }
MontyZhao commented 7 years ago

I have met this issue too. And don't know why!

numerized commented 7 years ago

check this @mateunicorn https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/696

I'll try it on sunday and report here.

DeeM297 commented 7 years ago

Do you think that the PR below is related to this encodedURI / decodedURI issue in android ?

https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/pull/715

numerized commented 7 years ago

Hope so :)

mirzailhami commented 7 years ago

Hi @numerized, have you solve this issue?

numerized commented 7 years ago

No the trick didn't work for me, but I'll give it another go soon.

mirzailhami commented 7 years ago

What is another trick you will trying to?

albertora commented 7 years ago

Same issue here :(

nonren commented 7 years ago

I'm facing the same issue now. Any solutions for this?

numerized commented 7 years ago

I'll dig that in the next few weeks I'm sure there's a workaround. But professional project is not giving me time to investigate...

lluisnieto commented 7 years ago

It's been a 5 hours struggle. cordova-plugin-x-socialsharing (5.1.7) aka "SocialSharing" is completly broken regarding image sharing through Any service (Gmail, Whatsapp, Facebook,.. any) in case your project uses Firebase storage.

I could not find any solution sharing any image that is stored under to any folder in the firebase storage. The '/' -> %2F prevents plugin from working well.

I'm so frustrated right now.

lluisnieto commented 7 years ago

Ok the only way i found to send a firebase image was converting it to a base64 string. This conversion it's easy to do, there are many examples out there.

Only that way worked. but only through shareWithOptions() method. I wanted to share only through Facebook pages app -> shareVia('com.facebook.pages.app'.... but even that did not work.

jayzus......

nonren commented 7 years ago

Hi @lluisnieto, the way you did it is convert the blob into base64 string before upload to firebase?

lluisnieto commented 7 years ago

Yes, but remember to use shareWithOptions( ) method. It adds an extra step for the user to choose wich network want to share but it's the only way it works. ShareVia( ) did Not work.

If anybody else has info about this, i'll be pleased to read.

carryall commented 6 years ago

Same issue here, any solution for this ?

Manasmd commented 6 years ago

@lluisnieto you are right....finally that's the only solution..just wondering saving base64 string would occupy more storage right?

jamesbenns commented 6 years ago

Any solution for this yet? :)

CliversonObrzut commented 6 years ago

Just faced this issue trying to share an image from firebase storage sub-folder on Instagram in an Android device. It passes all methods correctly (canShareVia, shareViaInstagram) but, during the process of creating the Instagram message it returns to my app and toast a message saying "Unable to load image". I'm wondering if any solution was presented.

jamesbenns commented 6 years ago

I think it's to do with how third parties interpret the URL - unfortunately the firebase download URL relies on the token in the query parameter but I'm guessing a lot of apps disregard the query parameter on download URLs as it's pretty unconventional anyway! I've changed my app to use Cloudinary which provides a normal download link (no token in query param) and everything works now. I can't imagine a reliable work around exists and I don't believe this is a plugin isssue! :(

CliversonObrzut commented 6 years ago

I am not sure, but I think the plugin maybe is changing something in the URL when sharing to Instagram through and Android device. In an IOs device it works fine. Also, if i put an image in the root folder of my firebase storage it works in Android. Only images in sub-folders can't be uploaded to Instagram. Earlier I thought it could be the token in the URL, but why does it work when the image is in root folder in Storage? Weird. I'm guessing the plugin maybe is not passing correctly the URL to a the third party when there are folders added to the image path like Iluisnieto said above: "I could not find any solution sharing any image that is stored under to any folder in the firebase storage. The '/' -> %2F prevents plugin from working well."

pedrovitor074 commented 4 years ago

did someone find solution for this ?

Carlosps commented 3 years ago

Have you guys found any solution for that?

niojihye commented 3 years ago

Making all objects in a bucket publicly readable

https://cloud.google.com/storage/docs/access-control/making-data-public#buckets