Sharing widget heavily inspired by AirBNB, with default drivers and the ability to add custom drivers to share.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
controllers
styles
views
.DS_Store
LICENSE.md
README.md
widget.json

README.md

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.