mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
feat(social-sharing): add canShareViaEmail (#333)
* - Add support for canShareViaEmail - Make the following parameters in shareViaEmail method optional: cc, bcc, files - Add usage for canShareViaEmail and shareViaEmail - Fix some formatting to be more consistent - Fix pluginRef * Fix import
This commit is contained in:
parent
a8fa61ddb9
commit
5807dd7f09
@ -1,35 +1,44 @@
|
||||
import { Cordova, Plugin } from './plugin';
|
||||
|
||||
|
||||
/**
|
||||
* @name Social Sharing
|
||||
* @description
|
||||
* Share text, files, images, and links via social networks, sms, and email.
|
||||
* @usage
|
||||
* ```js
|
||||
* ```ts
|
||||
* import {SocialSharing} from 'ionic-native';
|
||||
*
|
||||
* ...
|
||||
* // TODO add usage info
|
||||
* // 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!
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-x-socialsharing',
|
||||
pluginRef: 'window.plugins.socialsharing',
|
||||
pluginRef: 'plugins.socialsharing',
|
||||
repo: 'https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin',
|
||||
platforms: ['iOS', 'Android', 'Windows Phone']
|
||||
})
|
||||
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 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
|
||||
*/
|
||||
@Cordova()
|
||||
static share(message?: string, subject?: string, file?: string | Array<string>, url?: string): Promise<any> { return; }
|
||||
static share(message?: string, subject?: string, file?: string|string[], url?: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+)
|
||||
@ -38,7 +47,7 @@ export class SocialSharing {
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareWithOptions(options: { message?: string, subject?: string, file?: string | Array<string>, url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
static shareWithOptions(options: { message?: string, subject?: string, file?: string|string[], url?: string, chooserTitle?: string }): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Checks if you can share via a specific app.
|
||||
@ -128,17 +137,25 @@ export class SocialSharing {
|
||||
static shareViaSMS(messge: string, phoneNumber: string): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Checks if you can share via email
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareViaEmail(message: string, subject: string, to: Array<string>, cc: Array<string>, bcc: Array<string>, files: string | Array<string>): Promise<any> { return; }
|
||||
static canShareViaEmail(): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* Share via Email
|
||||
* @param message {string}
|
||||
* @param subject {string}
|
||||
* @param to {string[]}
|
||||
* @param cc {string[]}
|
||||
* @param bcc {string[]}
|
||||
* @param files {string|string[]} URL or local path to file(s) to attach
|
||||
*/
|
||||
@Cordova({
|
||||
platforms: ['iOS', 'Android']
|
||||
})
|
||||
static shareViaEmail(message: string, subject: string, to: string[], cc: string[] = [], bcc: string[] = [], files: string|string[] = []): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user