Skip to content

Sharing widget heavily inspired by AirBNB, with default drivers and the ability to add custom drivers to share.

License

Notifications You must be signed in to change notification settings

caffeinalab/ti.sharer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ti.Sharer

com.caffeinalab.titanium.sharer

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.

Installation

Via Gittio

gittio install com.caffeinalab.titanium.sharer

Via Github

Download the latest release, unzip in app/widgets and add in your config.json, under dependencies:

"dependencies": {
    "com.caffeinalab.titanium.sharer": "*"
}

Usage

var Sharer = Alloy.createWidget('com.caffeinalab.titanium.sharer');
Sharer.show({
	url: 'http://google.it',
	text: "Your awesome message!"
});

API

show(so, [where])

The so object represents a Trimethyl.share argument.

  • url: The link to share
  • text: The personal share message to use, when supported by driver.
  • image: The image to share. Can be a URL or Ti.Blob.

where is an Array of Strings of enabled drivers.

hide()

Close the mask.

setDriver(name, def)

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')
	}
}

extendDriverArgs(name, args)

Extend a driver only at UI level.

About

Sharing widget heavily inspired by AirBNB, with default drivers and the ability to add custom drivers to share.

Resources

License

Stars

Watchers

Forks

Packages

No packages published