-
-
Save csemrm/e0c157dfc8c6a938851fb269b35608e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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