UNPKG

6.43 kBTypeScriptView Raw
1import { IonicNativePlugin } from '@ionic-native/core';
2/**
3 * @name Social Sharing
4 * @premier social-sharing
5 * @description
6 * Share text, files, images, and links via social networks, sms, and email.
7 *
8 * For Browser usage check out the Web Share API docs: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#5-web-share-api
9 *
10 * @usage
11 * ```typescript
12 * import { SocialSharing } from '@ionic-native/social-sharing/ngx';
13 *
14 * constructor(private socialSharing: SocialSharing) { }
15 *
16 * ...
17 *
18 * // Check if sharing via email is supported
19 * this.socialSharing.canShareViaEmail().then(() => {
20 * // Sharing via email is possible
21 * }).catch(() => {
22 * // Sharing via email is not possible
23 * });
24 *
25 * // Share via email
26 * this.socialSharing.shareViaEmail('Body', 'Subject', ['recipient@example.org']).then(() => {
27 * // Success!
28 * }).catch(() => {
29 * // Error!
30 * });
31 * ```
32 */
33export declare class SocialSharingOriginal extends IonicNativePlugin {
34 /**
35 * Shares using the share sheet
36 * @param message {string} The message you would like to share.
37 * @param subject {string} The subject
38 * @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.
39 * @param url {string} A URL to share
40 * @returns {Promise<any>}
41 */
42 share(message?: string, subject?: string, file?: string | string[], url?: string): Promise<any>;
43 /**
44 * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
45 * @param options {object} The options object with the message, subject, files, url and chooserTitle properties.
46 * @returns {Promise<any>}
47 */
48 shareWithOptions(options: {
49 message?: string;
50 subject?: string;
51 files?: string | string[];
52 url?: string;
53 chooserTitle?: string;
54 }): Promise<any>;
55 /**
56 * Checks if you can share via a specific app.
57 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
58 * @param message {string}
59 * @param subject {string}
60 * @param image {string}
61 * @param url {string}
62 * @returns {Promise<any>}
63 */
64 canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise<any>;
65 /**
66 * Shares directly to Twitter
67 * @param message {string}
68 * @param image {string}
69 * @param url {string}
70 * @returns {Promise<any>}
71 */
72 shareViaTwitter(message: string, image?: string, url?: string): Promise<any>;
73 /**
74 * Shares directly to Facebook
75 * @param message {string}
76 * @param image {string}
77 * @param url {string}
78 * @returns {Promise<any>}
79 */
80 shareViaFacebook(message: string, image?: string, url?: string): Promise<any>;
81 /**
82 * Shares directly to Facebook with a paste message hint
83 * @param message {string}
84 * @param image {string}
85 * @param url {string}
86 * @param pasteMessageHint {string}
87 * @returns {Promise<any>}
88 */
89 shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any>;
90 /**
91 * Shares directly to Instagram
92 * @param message {string}
93 * @param image {string}
94 * @returns {Promise<any>}
95 */
96 shareViaInstagram(message: string, image: string): Promise<any>;
97 /**
98 * Shares directly to WhatsApp
99 * @param message {string}
100 * @param image {string}
101 * @param url {string}
102 * @returns {Promise<any>}
103 */
104 shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any>;
105 /**
106 * Shares directly to a WhatsApp Contact
107 * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS
108 * @param message {string} Message to send
109 * @param image {string} Image to send (does not work on iOS
110 * @param url {string} Link to send
111 * @returns {Promise<any>}
112 */
113 shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any>;
114 /**
115 * Share via SMS
116 * @param messge {string} message to send
117 * @param phoneNumber {string} Number or multiple numbers seperated by commas
118 * @returns {Promise<any>}
119 */
120 shareViaSMS(messge: string, phoneNumber: string): Promise<any>;
121 /**
122 * Checks if you can share via email
123 * @returns {Promise<any>}
124 */
125 canShareViaEmail(): Promise<any>;
126 /**
127 * Share via Email
128 * @param message {string}
129 * @param subject {string}
130 * @param to {string[]}
131 * @param cc {string[]} Optional
132 * @param bcc {string[]} Optional
133 * @param files {string|string[]} Optional URL or local path to file(s) to attach
134 * @returns {Promise<any>}
135 */
136 shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string | string[]): Promise<any>;
137 /**
138 * Share via AppName
139 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
140 * @param message {string}
141 * @param subject {string}
142 * @param image {string}
143 * @param url {string}
144 * @returns {Promise<any>}
145 */
146 shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise<any>;
147 /**
148 * defines the popup position before call the share method.
149 * @param targetBounds {string} left, top, width, height
150 */
151 setIPadPopupCoordinates(targetBounds: string): void;
152 /**
153 * Save an array of images to the camera roll
154 * @param {string|string[]} fileOrFileArray Single or multiple files
155 * @returns {Promise<any> }
156 */
157 saveToPhotoAlbum(fileOrFileArray: string | string[]): Promise<any>;
158 /**
159 * Shares directly to a WhatsApp Contact with phone number.
160 * @param phone {string} Pass phone number
161 * @param message {string} Message to send
162 * @param fileOrFileArray fileOrFileArray Single or multiple files
163 * @param url {string} Link to send
164 * @returns {Promise<any>}
165 */
166 shareViaWhatsAppToPhone(phone: string, message: string, fileOrFileArray: string | string[], url?: string): Promise<any>;
167}
168
169export declare const SocialSharing: SocialSharingOriginal;
\No newline at end of file