2016-07-18 02:10:11 +08:00
|
|
|
import { Cordova, Plugin } from './plugin';
|
|
|
|
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @name Social Sharing
|
|
|
|
* @description
|
|
|
|
* Share text, files, images, and links via social networks, sms, and email.
|
|
|
|
* @usage
|
|
|
|
* ```js
|
|
|
|
* import {SocialSharing} from 'ionic-native';
|
|
|
|
*
|
|
|
|
* ...
|
|
|
|
* // TODO add usage info
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
@Plugin({
|
|
|
|
plugin: 'cordova-plugin-x-socialsharing',
|
|
|
|
pluginRef: 'window.plugins.socialsharing',
|
|
|
|
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android', 'Windows Phone']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
|
|
|
export class SocialSharing {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares using the share sheet
|
|
|
|
* @param message {string} The message you would like to share.
|
|
|
|
* @param subject {string} The subject
|
|
|
|
* @param file {string|Array<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
|
|
|
|
*/
|
2016-07-12 05:20:11 +08:00
|
|
|
@Cordova()
|
2016-07-18 02:10:11 +08:00
|
|
|
static share(message?: string, subject?: string, file?: string | Array<string>, url?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
2016-06-14 01:13:58 +08:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
@Cordova({
|
|
|
|
platforms: ['iOS', 'Android']
|
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareWithOptions(options: { message?: string, subject?: string, file?: string | Array<string>, url?: string, chooserTitle?: string }): Promise<any> { return; }
|
2016-06-14 01:13:58 +08:00
|
|
|
|
2016-03-26 08:11:28 +08:00
|
|
|
/**
|
|
|
|
* Checks if you can share via a specific app.
|
|
|
|
* @param appName App name or package name. Examples: instagram or com.apple.social.facebook
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static canShareVia(appName: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares directly to Twitter
|
|
|
|
* @param message
|
|
|
|
* @param image
|
|
|
|
* @param url
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaTwitter(message: string, image?: string, url?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares directly to Facebook
|
|
|
|
* @param message {string}
|
|
|
|
* @param image {string}
|
|
|
|
* @param url {string}
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaFacebook(message: string, image?: string, url?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares directly to Facebook with a paste message hint
|
|
|
|
* @param message {string}
|
|
|
|
* @param image {string}
|
|
|
|
* @param url {string}
|
|
|
|
* @param pasteMessageHint {string}
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares directly to Instagram
|
|
|
|
* @param message {string}
|
|
|
|
* @param image {string}
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaInstagram(message: string, image: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shares directly to WhatsApp
|
|
|
|
* @param message {string}
|
|
|
|
* @param image {string}
|
|
|
|
* @param url {string}
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Share via SMS
|
|
|
|
* @param messge {string} message to send
|
2016-04-30 11:56:49 +08:00
|
|
|
* @param phoneNumber {string} Number or multiple numbers seperated by commas
|
2016-03-26 08:11:28 +08:00
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Share via Email
|
|
|
|
* @param message {string}
|
|
|
|
* @param subject {string}
|
|
|
|
* @param to {Array<string>}
|
|
|
|
* @param cc {Array<string>}
|
|
|
|
* @param bcc {Array<string>}
|
|
|
|
* @param files {string|Array<string>} URL or local path to file(s) to attach
|
|
|
|
*/
|
|
|
|
@Cordova({
|
2016-04-30 11:56:49 +08:00
|
|
|
platforms: ['iOS', 'Android']
|
2016-03-26 08:11:28 +08:00
|
|
|
})
|
2016-07-18 02:10:11 +08:00
|
|
|
static shareViaEmail(message: string, subject: string, to: Array<string>, cc: Array<string>, bcc: Array<string>, files: string | Array<string>): Promise<any> { return; }
|
2016-03-26 08:11:28 +08:00
|
|
|
|
2016-06-14 01:13:58 +08:00
|
|
|
}
|