Skip to content

Instantly share code, notes, and snippets.

@csemrm
Forked from hansemannn/fb-hyperloop.js
Created February 13, 2018 20:13
Show Gist options
  • Save csemrm/e0c157dfc8c6a938851fb269b35608e7 to your computer and use it in GitHub Desktop.
Save csemrm/e0c157dfc8c6a938851fb269b35608e7 to your computer and use it in GitHub Desktop.
var FBSDKShareLinkContent = require("FBSDKShareKit/FBSDKShareLinkContent"),
FBSDKShareDialog = require("FBSDKShareKit/FBSDKShareDialog"),
NSURL = require("Foundation/NSURL");
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var btn = Ti.UI.createButton({
title: "Trigger Share Dialog"
});
btn.addEventListener("click", function() {
presentShareDialog({
link: "http://appcelerator.com",
description: "Titanium rocks!",
title: "Ti.Facebook Hyperloop"
})
});
win.add(btn);
win.open();
function presentShareDialog(params) {
var content = FBSDKShareLinkContent.alloc().init();
Ti.API.info(content);
content.setContentURL(NSURL.URLWithString(params["link"]));
content.setContentDescription(params["description"]);
content.setContentTitle(params["title"]);
var shareDialog = new FBSDKShareDialog();
shareDialog.setShareContent(content);
shareDialog.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment