Ejecta
Ejecta copied to clipboard
[QUESTION] Social share options
I would like to bind SLComposeViewController to Ejecta. I want to post string from Ejecta with score to social apps for example in JS: var score = 1234; var message = "You have scored" + score + "playing my game"; And then send message to iOS share options to be populated in the selected social app. I use Javascript but have little knowledge of objective-C.
Many thanks in advance.
My fork version has this feature. It used the Build-in Social API of iOS.
you can see : https://github.com/finscn/Ejecta/blob/master/Extension/EJBindingSocial.m
Because in China We can't use facebook and twitter. So , I don't test it enough , Sorry
This is working great for me 😀👍
Greatly appreciated.
Regards, Tom.
On Tuesday, April 14, 2015, finscn [email protected] wrote:
you can see : https://github.com/finscn/Ejecta/blob/master/Extension/EJBindingSocial.m
Because in China We can't use facebook and twitter. So , I don't test it enough , Sorry
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-92677494.
@rungo73 can you tel us how you done sending message to social apple share ? what is the javasciprt code u use to call or send this ? i need it too thanks in advance
I added this method to EJBindingSocial.m:
/////////////////////////////////
EJ_BIND_FUNCTION(openShare, ctx, argc, argv){
NSString *score = JSValueToNSString(ctx, argv[0]);
UIActivityViewController *activityViewController = [[
UIActivityViewController alloc] initWithActivityItems:@[score]
applicationActivities:nil];
[scriptView.window.rootViewController presentViewController
:activityViewController
animated:YES
completion:^{
NSLog(@"completed.");
}];
return NULL;
}
//////////////////////////// then in main.js you can do this which will open iOS default share options view, populated with supplied text
ig.global.social = new Ejecta.Social();
var message = ("Put in your message to share here");
ig.global.social.openShare(message);
@finscn this would be good to add to your fork.
On Wed, Apr 15, 2015 at 8:38 AM, MATRIX.REAL [email protected] wrote:
@rungo73 https://github.com/rungo73 can you tel us how you done sending message to social apple share ? what is the javasciprt code u use to call or send this ? i need it too thanks in advance
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-93098443.
@rungo73 , thanks , I add the code like this, I think it's better (you could do callback):
EJ_BIND_FUNCTION(openShare, ctx, argc, argv){
NSString *message = JSValueToNSString(ctx, argv[0]);
JSObjectRef callback = nil;
if (argc > 1){
callback = JSValueToObject(ctx, argv[1], NULL);
if (callback) {
JSValueProtect(ctx, callback);
}
}
UIActivityViewController *activityViewController = [
[UIActivityViewController alloc] initWithActivityItems:@[message] applicationActivities:nil
];
[scriptView.window.rootViewController
presentViewController:activityViewController
animated:YES
completion:^{
if (callback){
[scriptView invokeCallback:callback thisObject:NULL argc:0 argv:nil];
JSValueUnprotect(scriptView.jsGlobalContext, callback);
}
}
];
return NULL;
}
js code:
var social=new Ejecta.Social();
social.openShare("test", function(){
console.log("opened");
});
@finscn thanks a lot that work fine but with little changes js code have to be like that : var social=new Ejecta.Social(); social.openShare("test", function(){ console.log("opened"); }); var message = ("Put in your message to share here");
@rungo73 thanks a lot but i when the default share option apear there is no facebook and no twitter only text message and mail ???
@matrixreal you mean :
var social=new Ejecta.Social();
var message = "your message to share";
social.openShare(message, function(){
console.log("opened");
});
That's ok.
it will only show if you have twitter or facebook apps installed on your device.
On Wed, Apr 15, 2015 at 4:27 PM, MATRIX.REAL [email protected] wrote:
@finscn https://github.com/finscn thanks a lot that work fine but with little changes js code have to be like that : var social=new Ejecta.Social(); social.openShare("test", function(){ console.log("opened"); }); var message = ("Put in your message to share here");
@rungo73 https://github.com/rungo73 thanks a lot but i when the default share option apear there is no facebook and no twitter only text message and mail ???
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-93217950.
@finscn yes exactly but i done it only by :
var social=new Ejecta.Social();
var message = "your message to share";
social.openShare(message);
@rungo73 mmmm thats okay but i think putting direct link call on browser is better ... some people have not fb or twitter installed ...
@mattix.real You are correct to cover your bases but I find that users who care to post to social services will have those apps installed. I don't know of any tweeters who don't have a Twitter app installed on their device for example.
On Wednesday, April 15, 2015, MATRIX.REAL [email protected] wrote:
@finscn https://github.com/finscn yes exactly but i done it only by :
var social=new Ejecta.Social();
var message = "your message to share";
social.openShare(message);
@rungo73 https://github.com/rungo73 mmmm thats okay but i think putting direct link call on browser is better ... some people have not fb or twitter installed ...
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-93219957.
@rungo73 even with facebook and twitter installed i have not see them on apple share options any solutions please ?
@matrix.real what version iOS are you running ? Might need a fallback, I'll investigate.
On Wednesday, April 15, 2015, MATRIX.REAL [email protected] wrote:
@rungo73 https://github.com/rungo73 even with facebook and twitter installed i have not see them on apple share options any solutions please ?
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-93250362.
@matrixreal , the callback is optional, you can just use one argument.
@rungo73 ios 7
@rungo73 hi any news ? still get the apple share option but only with message send option (there is no other options) waiting for your reply thanks @phoboslab any suggestions ? thanks all in advance
@matrix.real see this post..
http://stackoverflow.com/questions/18987596/uiactivityviewcontroller-doesnt-show-fb-and-twitter-on-ios-7 On Thu, 16 Apr 2015 at 9:40 pm MATRIX.REAL [email protected] wrote:
@rungo73 https://github.com/rungo73 hi any news ? still get the apple share option but only with message send option (there is no other options) waiting for your reply thanks @phoboslab https://github.com/phoboslab any suggestions ? thanks all in advance
— Reply to this email directly or view it on GitHub https://github.com/phoboslab/Ejecta/issues/481#issuecomment-93718644.
Hi, where I can download social share plugin fo construct 2 ?
@Pasha187 , my fork version of Ejecta https://github.com/finscn/Ejecta
How to realize this function, it is possible an example on mail: [email protected]. I don't know as to realize social share :/