UNPKG

8.58 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 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;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name Social Sharing
11 * @description
12 * Share text, files, images, and links via social networks, sms, and email.
13 * @usage
14 * ```typescript
15 * import { SocialSharing } from 'ionic-native';
16 *
17 * // Check if sharing via email is supported
18 * SocialSharing.canShareViaEmail().then(() => {
19 * // Sharing via email is possible
20 * }).catch(() => {
21 * // Sharing via email is not possible
22 * });
23 *
24 * // Share via email
25 * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
26 * // Success!
27 * }).catch(() => {
28 * // Error!
29 * });
30 * ```
31 */
32var SocialSharing = (function () {
33 function SocialSharing() {
34 }
35 /**
36 * Shares using the share sheet
37 * @param message {string} The message you would like to share.
38 * @param subject {string} The subject
39 * @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.
40 * @param url {string} A URL to share
41 * @returns {Promise<any>}
42 */
43 SocialSharing.share = function (message, subject, file, url) { return; };
44 /**
45 * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
46 * @param options {object} The options object with the message, subject, files, url and chooserTitle properties.
47 * @returns {Promise<any>}
48 */
49 SocialSharing.shareWithOptions = function (options) { return; };
50 /**
51 * Checks if you can share via a specific app.
52 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
53 * @param message {string}
54 * @param subject {string}
55 * @param image {string}
56 * @param url {string}
57 * @returns {Promise<any>}
58 */
59 SocialSharing.canShareVia = function (appName, message, subject, image, url) { return; };
60 /**
61 * Shares directly to Twitter
62 * @param message {string}
63 * @param image {string}
64 * @param url {string}
65 * @returns {Promise<any>}
66 */
67 SocialSharing.shareViaTwitter = function (message, image, url) { return; };
68 /**
69 * Shares directly to Facebook
70 * @param message {string}
71 * @param image {string}
72 * @param url {string}
73 * @returns {Promise<any>}
74 */
75 SocialSharing.shareViaFacebook = function (message, image, url) { return; };
76 /**
77 * Shares directly to Facebook with a paste message hint
78 * @param message {string}
79 * @param image {string}
80 * @param url {string}
81 * @param pasteMessageHint {string}
82 * @returns {Promise<any>}
83 */
84 SocialSharing.shareViaFacebookWithPasteMessageHint = function (message, image, url, pasteMessageHint) { return; };
85 /**
86 * Shares directly to Instagram
87 * @param message {string}
88 * @param image {string}
89 * @returns {Promise<any>}
90 */
91 SocialSharing.shareViaInstagram = function (message, image) { return; };
92 /**
93 * Shares directly to WhatsApp
94 * @param message {string}
95 * @param image {string}
96 * @param url {string}
97 * @returns {Promise<any>}
98 */
99 SocialSharing.shareViaWhatsApp = function (message, image, url) { return; };
100 /**
101 * Shares directly to a WhatsApp Contact
102 * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS
103 * @param message {string} Message to send
104 * @param image {string} Image to send (does not work on iOS
105 * @param url {string} Link to send
106 * @returns {Promise<any>}
107 */
108 SocialSharing.shareViaWhatsAppToReceiver = function (receiver, message, image, url) { return; };
109 /**
110 * Share via SMS
111 * @param messge {string} message to send
112 * @param phoneNumber {string} Number or multiple numbers seperated by commas
113 * @returns {Promise<any>}
114 */
115 SocialSharing.shareViaSMS = function (messge, phoneNumber) { return; };
116 /**
117 * Checks if you can share via email
118 * @returns {Promise<any>}
119 */
120 SocialSharing.canShareViaEmail = function () { return; };
121 /**
122 * Share via Email
123 * @param message {string}
124 * @param subject {string}
125 * @param to {string[]}
126 * @param cc {string[]} Optional
127 * @param bcc {string[]} Optional
128 * @param files {string|string[]} Optional URL or local path to file(s) to attach
129 * @returns {Promise<any>}
130 */
131 SocialSharing.shareViaEmail = function (message, subject, to, cc, bcc, files) { return; };
132 /**
133 * Share via AppName
134 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
135 * @param message {string}
136 * @param subject {string}
137 * @param image {string}
138 * @param url {string}
139 * @returns {Promise<any>}
140 */
141 SocialSharing.shareVia = function (appName, message, subject, image, url) { return; };
142 __decorate([
143 plugin_1.Cordova()
144 ], SocialSharing, "share", null);
145 __decorate([
146 plugin_1.Cordova({
147 platforms: ['iOS', 'Android']
148 })
149 ], SocialSharing, "shareWithOptions", null);
150 __decorate([
151 plugin_1.Cordova({
152 successIndex: 5,
153 errorIndex: 6,
154 platforms: ['iOS', 'Android']
155 })
156 ], SocialSharing, "canShareVia", null);
157 __decorate([
158 plugin_1.Cordova({
159 successIndex: 3,
160 errorIndex: 4,
161 platforms: ['iOS', 'Android']
162 })
163 ], SocialSharing, "shareViaTwitter", null);
164 __decorate([
165 plugin_1.Cordova({
166 successIndex: 3,
167 errorIndex: 4,
168 platforms: ['iOS', 'Android']
169 })
170 ], SocialSharing, "shareViaFacebook", null);
171 __decorate([
172 plugin_1.Cordova({
173 successIndex: 4,
174 errorIndex: 5,
175 platforms: ['iOS', 'Android']
176 })
177 ], SocialSharing, "shareViaFacebookWithPasteMessageHint", null);
178 __decorate([
179 plugin_1.Cordova({
180 platforms: ['iOS', 'Android']
181 })
182 ], SocialSharing, "shareViaInstagram", null);
183 __decorate([
184 plugin_1.Cordova({
185 successIndex: 3,
186 errorIndex: 4,
187 platforms: ['iOS', 'Android']
188 })
189 ], SocialSharing, "shareViaWhatsApp", null);
190 __decorate([
191 plugin_1.Cordova({
192 successIndex: 4,
193 errorIndex: 5,
194 platforms: ['iOS', 'Android']
195 })
196 ], SocialSharing, "shareViaWhatsAppToReceiver", null);
197 __decorate([
198 plugin_1.Cordova({
199 platforms: ['iOS', 'Android']
200 })
201 ], SocialSharing, "shareViaSMS", null);
202 __decorate([
203 plugin_1.Cordova({
204 platforms: ['iOS', 'Android']
205 })
206 ], SocialSharing, "canShareViaEmail", null);
207 __decorate([
208 plugin_1.Cordova({
209 platforms: ['iOS', 'Android'],
210 successIndex: 6,
211 errorIndex: 7
212 })
213 ], SocialSharing, "shareViaEmail", null);
214 __decorate([
215 plugin_1.Cordova({
216 successIndex: 5,
217 errorIndex: 6,
218 platforms: ['iOS', 'Android']
219 })
220 ], SocialSharing, "shareVia", null);
221 SocialSharing = __decorate([
222 plugin_1.Plugin({
223 pluginName: 'SocialSharing',
224 plugin: 'cordova-plugin-x-socialsharing',
225 pluginRef: 'plugins.socialsharing',
226 repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
227 platforms: ['iOS', 'Android', 'Windows Phone']
228 })
229 ], SocialSharing);
230 return SocialSharing;
231}());
232exports.SocialSharing = SocialSharing;
233//# sourceMappingURL=socialsharing.js.map
\No newline at end of file