A simple Sharing widget heavy inspired to AirBnb, with default drivers and the ability to add custom drivers to share.
The widget use Trimethyl.Share, so you must install Trimethyl to use it, or define your own custom drivers.
gittio install com.caffeinalab.titanium.sharer
Download the latest release, unzip in app/widgets
and add in your config.json, under dependencies
:
"dependencies": {
"com.caffeinalab.titanium.sharer": "*"
}
var Sharer = Alloy.createWidget('com.caffeinalab.titanium.sharer');
Sharer.show({
url: 'http://google.it',
text: "Your awesome message!"
});
The so
object represents a Trimethyl.share
argument.
url
: The link to sharetext
: The personal share message to use, when supported by driver.image
: The image to share. Can be a URL orTi.Blob
.
where
is an Array of Strings of enabled drivers.
Close the mask.
Add/replace a driver definition.
A driver definition is in this form
{
callback: function(e) { }, // The callback invoked on click (`e.source` represents the Button`
args: {} // The property passed to the button
}
An example:
copytoclipboard: {
callback: function(e) {
Ti.UI.Clipboard.setText(e.shareObj.url);
e.source.titleid = L('Link copied!');
},
args: {
borderColor: '#fff',
titleid: L('Copy link')
}
}
Extend a driver only at UI level.