UNPKG

ionic-native

Version:

Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support

231 lines 8.41 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { Cordova, Plugin } from './plugin'; /** * @name Social Sharing * @description * Share text, files, images, and links via social networks, sms, and email. * @usage * ```typescript * import { SocialSharing } from 'ionic-native'; * * // Check if sharing via email is supported * SocialSharing.canShareViaEmail().then(() => { * // Sharing via email is possible * }).catch(() => { * // Sharing via email is not possible * }); * * // Share via email * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => { * // Success! * }).catch(() => { * // Error! * }); * ``` */ export var SocialSharing = (function () { function SocialSharing() { } /** * Shares using the share sheet * @param message {string} The message you would like to share. * @param subject {string} The subject * @param file {string|string[]} URL(s) to file(s) or image(s), local path(s) to file(s) or image(s), or base64 data of an image. Only the first file/image will be used on Windows Phone. * @param url {string} A URL to share * @returns {Promise<any>} */ SocialSharing.share = function (message, subject, file, url) { return; }; /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) * @param options {object} The options object with the message, subject, files, url and chooserTitle properties. * @returns {Promise<any>} */ SocialSharing.shareWithOptions = function (options) { return; }; /** * Checks if you can share via a specific app. * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook * @param message {string} * @param subject {string} * @param image {string} * @param url {string} * @returns {Promise<any>} */ SocialSharing.canShareVia = function (appName, message, subject, image, url) { return; }; /** * Shares directly to Twitter * @param message {string} * @param image {string} * @param url {string} * @returns {Promise<any>} */ SocialSharing.shareViaTwitter = function (message, image, url) { return; }; /** * Shares directly to Facebook * @param message {string} * @param image {string} * @param url {string} * @returns {Promise<any>} */ SocialSharing.shareViaFacebook = function (message, image, url) { return; }; /** * Shares directly to Facebook with a paste message hint * @param message {string} * @param image {string} * @param url {string} * @param pasteMessageHint {string} * @returns {Promise<any>} */ SocialSharing.shareViaFacebookWithPasteMessageHint = function (message, image, url, pasteMessageHint) { return; }; /** * Shares directly to Instagram * @param message {string} * @param image {string} * @returns {Promise<any>} */ SocialSharing.shareViaInstagram = function (message, image) { return; }; /** * Shares directly to WhatsApp * @param message {string} * @param image {string} * @param url {string} * @returns {Promise<any>} */ SocialSharing.shareViaWhatsApp = function (message, image, url) { return; }; /** * Shares directly to a WhatsApp Contact * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS * @param message {string} Message to send * @param image {string} Image to send (does not work on iOS * @param url {string} Link to send * @returns {Promise<any>} */ SocialSharing.shareViaWhatsAppToReceiver = function (receiver, message, image, url) { return; }; /** * Share via SMS * @param messge {string} message to send * @param phoneNumber {string} Number or multiple numbers seperated by commas * @returns {Promise<any>} */ SocialSharing.shareViaSMS = function (messge, phoneNumber) { return; }; /** * Checks if you can share via email * @returns {Promise<any>} */ SocialSharing.canShareViaEmail = function () { return; }; /** * Share via Email * @param message {string} * @param subject {string} * @param to {string[]} * @param cc {string[]} Optional * @param bcc {string[]} Optional * @param files {string|string[]} Optional URL or local path to file(s) to attach * @returns {Promise<any>} */ SocialSharing.shareViaEmail = function (message, subject, to, cc, bcc, files) { return; }; /** * Share via AppName * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook * @param message {string} * @param subject {string} * @param image {string} * @param url {string} * @returns {Promise<any>} */ SocialSharing.shareVia = function (appName, message, subject, image, url) { return; }; __decorate([ Cordova() ], SocialSharing, "share", null); __decorate([ Cordova({ platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareWithOptions", null); __decorate([ Cordova({ successIndex: 5, errorIndex: 6, platforms: ['iOS', 'Android'] }) ], SocialSharing, "canShareVia", null); __decorate([ Cordova({ successIndex: 3, errorIndex: 4, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaTwitter", null); __decorate([ Cordova({ successIndex: 3, errorIndex: 4, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaFacebook", null); __decorate([ Cordova({ successIndex: 4, errorIndex: 5, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaFacebookWithPasteMessageHint", null); __decorate([ Cordova({ platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaInstagram", null); __decorate([ Cordova({ successIndex: 3, errorIndex: 4, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaWhatsApp", null); __decorate([ Cordova({ successIndex: 4, errorIndex: 5, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaWhatsAppToReceiver", null); __decorate([ Cordova({ platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareViaSMS", null); __decorate([ Cordova({ platforms: ['iOS', 'Android'] }) ], SocialSharing, "canShareViaEmail", null); __decorate([ Cordova({ platforms: ['iOS', 'Android'], successIndex: 6, errorIndex: 7 }) ], SocialSharing, "shareViaEmail", null); __decorate([ Cordova({ successIndex: 5, errorIndex: 6, platforms: ['iOS', 'Android'] }) ], SocialSharing, "shareVia", null); SocialSharing = __decorate([ Plugin({ pluginName: 'SocialSharing', plugin: 'cordova-plugin-x-socialsharing', pluginRef: 'plugins.socialsharing', repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin', platforms: ['iOS', 'Android', 'Windows Phone'] }) ], SocialSharing); return SocialSharing; }()); //# sourceMappingURL=socialsharing.js.map