Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-x-socialsharing

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-x-socialsharing - npm Package Compare versions

Comparing version 5.2.1 to 5.3.0

2

package.json
{
"name": "cordova-plugin-x-socialsharing",
"version": "5.2.1",
"version": "5.3.0",
"description": "Share text, images (and other files), or a link via the native sharing widget of your device. Android is fully supported, as well as iOS 6 and up. WP8 has somewhat limited support.",

@@ -5,0 +5,0 @@ "cordova": {

@@ -13,14 +13,5 @@ # PhoneGap / Cordova Social Sharing plugin

by [@EddyVerbruggen](http://www.twitter.com/eddyverbruggen), [read my blog about this plugin](http://www.x-services.nl/phonegap-share-plugin-facebook-twitter-social-media/754)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=eddyverbruggen%40gmail%2ecom&lc=US&item_name=cordova%2dplugin%2dsocialsharing&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)
Every now and then kind folks ask me how they can give me all their money. So if you want to contribute to my pension fund, then please go ahead :)
<table width="100%">
<tr>
<td width="100"><a href="http://plugins.telerik.com/plugin/socialsharing"><img src="http://www.x-services.nl/github-images/telerik-verified-plugins-marketplace.png" width="97px" height="71px" alt="Marketplace logo"/></a></td>
<td>For a quick demo app and easy code samples, check out the plugin page at the Verified Plugins Marketplace: http://plugins.telerik.com/plugin/socialsharing</td>
</tr>
</table>
## 0. Index

@@ -31,12 +22,7 @@

3. [Installation](#3-installation)
3. [Automatically (CLI / Plugman)](#automatically-cli--plugman)
3. [Manually](#manually)
3. [PhoneGap Build](#phonegap-build)
4. Usage
4. [iOS and Android](#4a-usage-on-ios-and-android)
4. [Windows Phone](#4b-usage-on-windows-phone)
4. [Share-popover on iPad](#4c-share-popover-on-ipad)
4. [Whitelisting on iOS 9](#4d-whitelisting-on-ios-9)
5. [Credits](#5-credits)
6. [License](#6-license)
4. [Usage on iOS and Android](#4-usage-on-ios-and-android)
5. [Web Share API](#5-web-share-api)
6. [Usage on Windows Phone](#6-usage-on-windows-phone)
7. [Share-popover on iPad](#7-share-popover-on-ipad)
8. [Whitelisting on iOS 9](#8-whitelisting-on-ios-9)

@@ -159,3 +145,3 @@ ## 1. Description

## 4a. Usage on iOS and Android
## 4. Usage on iOS and Android
You can share text, a subject (in case the user selects the email application), (any type and location of) file (like an image), and a link.

@@ -270,13 +256,21 @@ However, what exactly gets shared, depends on the application the user chooses to complete the action. A few examples:

##### Experimental feature: sharing directly to someone
Available in 5.0.8 and up - please let me know if this works for your device! Open an issue if not..
##### Sharing directly to someone
Note that on Android you can only send a 'text' and 'url' directly to someone, so files are ignored.
###### By phone number (since 5.3.0)
```html
<button onclick="window.plugins.socialsharing.shareViaWhatsAppToReceiver(receiver, 'Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')})">msg via WhatsApp for Addressbook ID 101</button>
<button onclick="window.plugins.socialsharing.shareViaWhatsAppToPhone('+31611111111', 'Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')})">msg via WhatsApp to phone number +31611111111</button>
```
For `receiver` on iOS pass in the Addressbook ID (or 'abid'). You can find those abid's by using the [Cordova Contacts Plugin](https://github.com/apache/cordova-plugin-contacts).
###### By abid (iOS) or phone number (Android)
```html
<button onclick="window.plugins.socialsharing.shareViaWhatsAppToReceiver('101', 'Message via WhatsApp', null /* img */, null /* url */, function() {console.log('share ok')})">msg via WhatsApp for Addressbook ID 101</button>
```
The first argument on iOS needs to be the Addressbook ID (or 'abid'). You can find those abid's by using the [Cordova Contacts Plugin](https://github.com/apache/cordova-plugin-contacts).
The result in the success callback of the `find` function is a JSON array of contact objects, use the 'id' you find in those objects.
Don't pass in an image on iOS because that can't be sent to someone directly unfortunately. Message and URL are fine though.
On Android pass in the phone number of the person you want to send a message to (untested at the moment).
On Android pass in the phone number of the person you want to send a message to.

@@ -436,5 +430,5 @@ #### SMS

#### Web Share API
## 5. Web Share API
Chrome is introducing a new [Web Share API](https://github.com/WICG/web-share) to share data.
Chrome introduced the [Web Share API](https://github.com/WICG/web-share) to share data:

@@ -455,3 +449,3 @@ ```js

## 4b. Usage on Windows Phone
## 6. Usage on Windows Phone
The available methods on WP8 are: `available`, `canShareViaEmail`, `share`, `shareViaEmail` and `shareViaSMS`.

@@ -479,3 +473,3 @@ Currently the first two always return true, but this may change in the future in case I can find a way to truly detect the availability.

## 4c. Share-popover on iPad
## 7. Share-popover on iPad
Carlos Sola-Llonch, a user of this plugin, pointed me at an [iOS document](https://developer.apple.com/library/ios/documentation/uikit/reference/UIActivityViewController_Class/Reference/Reference.html)

@@ -518,5 +512,5 @@ stating "On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally."

## 4d. Whitelisting on iOS 9
## 8. Whitelisting on iOS 9+
On iOS 9 you have to make sure to whitelist the applications you want to use for sharing. Without whitelisting "query schemes", you may get the error callback invoked when calling the `canShareVia` function (and possibly the `shareVia`). You can verify this is a permissions issue by observing the output in XCode for something like:
On iOS 9 and newer you have to make sure to whitelist the applications you want to use for sharing. Without whitelisting "query schemes", you may get the error callback invoked when calling the `canShareVia` function (and possibly the `shareVia`). You can verify this is a permissions issue by observing the output in XCode for something like:

@@ -561,7 +555,1 @@ > -canOpenURL: failed for URL: "whatsapp://app" - error: "This app is not allowed to query for scheme whatsapp"

The advantage with this method is that editing is done in the config.xml file which will most often be in your source control anyway and hence, changes to it will be reserved.
## 5. Credits ##
This plugin was enhanced for Plugman / PhoneGap Build by [Eddy Verbruggen](http://www.x-services.nl).
The Android and Windows Phone code was entirely created by the author.
The first iteration of the iOS code was inspired by [Cameron Lerch](https://github.com/bfcam/phonegap-ios-social-plugin).

@@ -72,12 +72,16 @@ function SocialSharing() {

SocialSharing.prototype.shareViaWhatsApp = function (message, fileOrFileArray, url, successCallback, errorCallback) {
cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsApp"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, null]);
cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsApp"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, null, null]);
};
SocialSharing.prototype.shareViaWhatsAppToReceiver = function (receiver, message, fileOrFileArray, url, successCallback, errorCallback) {
cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsAppToReceiver"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, receiver]);
cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsAppToReceiver"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, receiver, null]);
};
SocialSharing.prototype.shareViaWhatsAppToPhone = function (phone, message, fileOrFileArray, url, successCallback, errorCallback) {
cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareViaWhatsAppToPhone"), "SocialSharing", "shareViaWhatsApp", [message, null, this._asArray(fileOrFileArray), url, null, phone]);
};
SocialSharing.prototype.shareViaSMS = function (options, phonenumbers, successCallback, errorCallback) {
var opts = options;
if (typeof options == "string") {
if (typeof options === "string") {
opts = {"message":options}; // for backward compatibility as the options param used to be the message

@@ -84,0 +88,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc