UNPKG

5.35 kBTypeScriptView Raw
1/**
2 * @name Social Sharing
3 * @description
4 * Share text, files, images, and links via social networks, sms, and email.
5 * @usage
6 * ```typescript
7 * import { SocialSharing } from 'ionic-native';
8 *
9 * // Check if sharing via email is supported
10 * SocialSharing.canShareViaEmail().then(() => {
11 * // Sharing via email is possible
12 * }).catch(() => {
13 * // Sharing via email is not possible
14 * });
15 *
16 * // Share via email
17 * SocialSharing.shareViaEmail('Body', 'Subject', 'recipient@example.org').then(() => {
18 * // Success!
19 * }).catch(() => {
20 * // Error!
21 * });
22 * ```
23 */
24export declare class SocialSharing {
25 /**
26 * Shares using the share sheet
27 * @param message {string} The message you would like to share.
28 * @param subject {string} The subject
29 * @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.
30 * @param url {string} A URL to share
31 * @returns {Promise<any>}
32 */
33 static share(message?: string, subject?: string, file?: string | string[], url?: string): Promise<any>;
34 /**
35 * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
36 * @param options {object} The options object with the message, subject, files, url and chooserTitle properties.
37 * @returns {Promise<any>}
38 */
39 static shareWithOptions(options: {
40 message?: string;
41 subject?: string;
42 files?: string | string[];
43 url?: string;
44 chooserTitle?: string;
45 }): Promise<any>;
46 /**
47 * Checks if you can share via a specific app.
48 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
49 * @param message {string}
50 * @param subject {string}
51 * @param image {string}
52 * @param url {string}
53 * @returns {Promise<any>}
54 */
55 static canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise<any>;
56 /**
57 * Shares directly to Twitter
58 * @param message {string}
59 * @param image {string}
60 * @param url {string}
61 * @returns {Promise<any>}
62 */
63 static shareViaTwitter(message: string, image?: string, url?: string): Promise<any>;
64 /**
65 * Shares directly to Facebook
66 * @param message {string}
67 * @param image {string}
68 * @param url {string}
69 * @returns {Promise<any>}
70 */
71 static shareViaFacebook(message: string, image?: string, url?: string): Promise<any>;
72 /**
73 * Shares directly to Facebook with a paste message hint
74 * @param message {string}
75 * @param image {string}
76 * @param url {string}
77 * @param pasteMessageHint {string}
78 * @returns {Promise<any>}
79 */
80 static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any>;
81 /**
82 * Shares directly to Instagram
83 * @param message {string}
84 * @param image {string}
85 * @returns {Promise<any>}
86 */
87 static shareViaInstagram(message: string, image: string): Promise<any>;
88 /**
89 * Shares directly to WhatsApp
90 * @param message {string}
91 * @param image {string}
92 * @param url {string}
93 * @returns {Promise<any>}
94 */
95 static shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any>;
96 /**
97 * Shares directly to a WhatsApp Contact
98 * @param receiver {string} Pass phone number on Android, and Addressbook ID (abid) on iOS
99 * @param message {string} Message to send
100 * @param image {string} Image to send (does not work on iOS
101 * @param url {string} Link to send
102 * @returns {Promise<any>}
103 */
104 static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any>;
105 /**
106 * Share via SMS
107 * @param messge {string} message to send
108 * @param phoneNumber {string} Number or multiple numbers seperated by commas
109 * @returns {Promise<any>}
110 */
111 static shareViaSMS(messge: string, phoneNumber: string): Promise<any>;
112 /**
113 * Checks if you can share via email
114 * @returns {Promise<any>}
115 */
116 static canShareViaEmail(): Promise<any>;
117 /**
118 * Share via Email
119 * @param message {string}
120 * @param subject {string}
121 * @param to {string[]}
122 * @param cc {string[]} Optional
123 * @param bcc {string[]} Optional
124 * @param files {string|string[]} Optional URL or local path to file(s) to attach
125 * @returns {Promise<any>}
126 */
127 static shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string | string[]): Promise<any>;
128 /**
129 * Share via AppName
130 * @param appName {string} App name or package name. Examples: instagram or com.apple.social.facebook
131 * @param message {string}
132 * @param subject {string}
133 * @param image {string}
134 * @param url {string}
135 * @returns {Promise<any>}
136 */
137 static shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise<any>;
138}