Ejecta icon indicating copy to clipboard operation
Ejecta copied to clipboard

social share and share a png ?

Open matrixreal opened this issue 10 years ago • 52 comments

@finscn hi i see that in social.m and social.h the image call is implemented but how can we call the social share with image ? i use

var social = new ejecta.social(); var message = "hello";

and the call is openshare.social(message);

how to add the image to the call ?

matrixreal avatar Aug 21 '15 04:08 matrixreal

@finscn any suggestion ? because it's already implemented on your code see social.m thanks for feedback

matrixreal avatar Aug 22 '15 07:08 matrixreal

In china , I can't visit twitter and facebook , I can't test the feature...

finscn avatar Aug 22 '15 07:08 finscn

very sad news i'm searching about this since 3 months ok can you just give me a suggestion and i will test it ?

matrixreal avatar Aug 22 '15 07:08 matrixreal

try:social.showPostDialog("twitter", "message", "url" ,"imgSrc", callback)

finscn avatar Aug 22 '15 07:08 finscn

try: social.showPostDialog("twitter", "message", "url" ,"imgSrc", callback)

finscn avatar Aug 22 '15 07:08 finscn

ok i wil try it now and the image ? i put it in app folder and name it to "image.png" right ? [request addMultipartData:imageData withName:dataName type:@"image/png" filename:@"image.png"];

matrixreal avatar Aug 22 '15 07:08 matrixreal

your file's name could be anything. but must in app folder (or it's sub folder)

finscn avatar Aug 22 '15 08:08 finscn

I update my fork . Now you could use "${Documnets} ${tmp} ....

finscn avatar Aug 22 '15 08:08 finscn

ok but not work when i use social.showPostDialog("twitter", "message", "url" ,"imgSrc", callback); got black screen when i use social.showPostDialog("twitter", "message", "url" ,"imgSrc", callback); got js error line 1 colum 30

matrixreal avatar Aug 22 '15 08:08 matrixreal

but i will downloadthe latest fork and try again

matrixreal avatar Aug 22 '15 08:08 matrixreal

same error

matrixreal avatar Aug 22 '15 08:08 matrixreal

main file (index.js) should have this declaration right ? var social = new ejecta.social(); var message = "hello"; ?

matrixreal avatar Aug 22 '15 08:08 matrixreal

please post your code .

I found that you don't like post your code when you ask some questions.

Your code is always a secret ?

finscn avatar Aug 22 '15 08:08 finscn

no it's not secret this is what i use in the main file (index.js) i put var social = new ejecta.social(); var message = "hello"; and when i call the facebook or twitter message and image share i use exactly social.showPostDialog("twitter", "message", "url" ,"imgSrc", callback); and got black screen and the app don't lunch when i use social.showPostDialog(twitter, message, url ,imgSrc, callback); there is no black screen , the app lunch but the twitter share action not work and got the error js error js error line 1 colum 30 , 37 that's all :dango:

matrixreal avatar Aug 22 '15 08:08 matrixreal

@finscn any news please ? i think we are not far from the goal !!! :dancers:

matrixreal avatar Aug 23 '15 08:08 matrixreal

would you test on device?

finscn avatar Aug 23 '15 09:08 finscn

i'm testing on real device

matrixreal avatar Aug 23 '15 11:08 matrixreal

@finscn hi, here is what i have done and what i get

  1. i'm using lastest version of your fork

  2. i'm already logged in facebook and twitter app in my iphone (user and pass ok)

i'm using in the main js file (index.js) the following code

var social = new ejecta.social(); var message = "hello";

later in my app i'm using the call like : social.showPostDialog('twitter',message,'imgSrc');

this is the only one that work ... when i use social.showPostDialog("twitter",message,"imgSrc"); (with " and not ' i got error javascript , also when i use the word callback i got error javascript too ...

  1. with social.showPostDialog('twitter',message,'imgSrc'); i get the post dialog but with no image like screenshoot 1

img_1831

(i already put an image.png that i would like to post in the app folder and in the project folder)

  1. when i click on share (publier in french) i got the message on displayed + done like screenshoot 2

1

but after 2 or 3 seconds it seem that fail to post it on facebook (it say impossible to publish because fail to connect to facebook) and i got the screenshoot 3

img_1832

that is it ... i hope that will help and i think we are not far than the goal :dancer:

matrixreal avatar Sep 03 '15 15:09 matrixreal

use:

social.showPostDialog('twitter', 'message', "http://you-want-to-share-URL", 'image/file.png');

finscn avatar Sep 06 '15 07:09 finscn

there are 5 arguments : snsName ,message, shareUrl, imgSrc, callback if no message , shareUrl or imgSrc use null.

social.showPostDialog('twitter', 'message', null , 'image/file.png');

finscn avatar Sep 06 '15 07:09 finscn

I can't visit twitter facebook, I'm so sorry for late replied

finscn avatar Sep 06 '15 07:09 finscn

@finscn that's work thanks a lot

the last thing i want to ask you is how to take a screenshoot / snapshoot and save it to file.png (that can be used to be share with this method) ?

matrixreal avatar Sep 06 '15 11:09 matrixreal

I think it's a little complex . I don't know how to do that

finscn avatar Sep 06 '15 11:09 finscn

because i see your post here https://github.com/phoboslab/Ejecta/issues/210

matrixreal avatar Sep 06 '15 11:09 matrixreal

@matrixreal https://github.com/phoboslab/Ejecta/issues/428

finscn avatar Sep 06 '15 11:09 finscn

@finscn i use toDataURL(); and toDataURLHD(); call but it say "not supported for this context"

matrixreal avatar Sep 06 '15 12:09 matrixreal

@matrixreal , please update . I add a function for save image/canvas

var appUtils = new Ejecta.AppUtils();
appUtils.saveImage(canvas, "${Documents}/test.png", function(filePath){
    console.log(filePath);
});

the canvas could be screen-canvas , offscreen-canvas , or Image object.

finscn avatar Sep 06 '15 13:09 finscn

@finscn i sorry for my bad english but i don't understand so this call is to take screenshoot and save it right ?

matrixreal avatar Sep 06 '15 14:09 matrixreal

got this

Sep 6 17:37:48 iPhone-4 Ejecta[7875] <Error>: CGImageCreate: invalid image size: 0 x 0. 2015-09-06 17:37:48.726 Swing Copters[7875:60b] JS LOG: /var/mobile/Applications/040170E3-CE92-47D7-A2A8-668F69868459/Documents/test.png

matrixreal avatar Sep 06 '15 15:09 matrixreal

show me your code

finscn avatar Sep 06 '15 16:09 finscn