From 4cb28c41c84399d56015fcc02dd264873955b6bd Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 6 Apr 2018 22:54:11 +0200 Subject: [PATCH] feat(social-sharing): add missing function fix: #2209 --- .../plugins/social-sharing/index.ts | 118 +++++++++++++++--- 1 file changed, 101 insertions(+), 17 deletions(-) diff --git a/src/@ionic-native/plugins/social-sharing/index.ts b/src/@ionic-native/plugins/social-sharing/index.ts index f9665a9a9..720732acf 100644 --- a/src/@ionic-native/plugins/social-sharing/index.ts +++ b/src/@ionic-native/plugins/social-sharing/index.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; - +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; /** * @name Social Sharing @@ -53,7 +52,14 @@ export class SocialSharing extends IonicNativePlugin { successIndex: 4, errorIndex: 5 }) - share(message?: string, subject?: string, file?: string | string[], url?: string): Promise { return; } + share( + message?: string, + subject?: string, + file?: string | string[], + url?: string + ): Promise { + return; + } /** * Shares using the share sheet with additional options and returns a result object or an error message (requires plugin version 5.1.0+) @@ -63,7 +69,15 @@ export class SocialSharing extends IonicNativePlugin { @Cordova({ platforms: ['iOS', 'Android'] }) - shareWithOptions(options: { message?: string, subject?: string, files?: string | string[], url?: string, chooserTitle?: string }): Promise { return; } + shareWithOptions(options: { + message?: string; + subject?: string; + files?: string | string[]; + url?: string; + chooserTitle?: string; + }): Promise { + return; + } /** * Checks if you can share via a specific app. @@ -79,7 +93,15 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 6, platforms: ['iOS', 'Android'] }) - canShareVia(appName: string, message?: string, subject?: string, image?: string, url?: string): Promise { return; } + canShareVia( + appName: string, + message?: string, + subject?: string, + image?: string, + url?: string + ): Promise { + return; + } /** * Shares directly to Twitter @@ -93,7 +115,9 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 4, platforms: ['iOS', 'Android'] }) - shareViaTwitter(message: string, image?: string, url?: string): Promise { return; } + shareViaTwitter(message: string, image?: string, url?: string): Promise { + return; + } /** * Shares directly to Facebook @@ -107,8 +131,13 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 4, platforms: ['iOS', 'Android'] }) - shareViaFacebook(message: string, image?: string, url?: string): Promise { return; } - + shareViaFacebook( + message: string, + image?: string, + url?: string + ): Promise { + return; + } /** * Shares directly to Facebook with a paste message hint @@ -123,7 +152,14 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 5, platforms: ['iOS', 'Android'] }) - shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise { return; } + shareViaFacebookWithPasteMessageHint( + message: string, + image?: string, + url?: string, + pasteMessageHint?: string + ): Promise { + return; + } /** * Shares directly to Instagram @@ -134,7 +170,9 @@ export class SocialSharing extends IonicNativePlugin { @Cordova({ platforms: ['iOS', 'Android'] }) - shareViaInstagram(message: string, image: string): Promise { return; } + shareViaInstagram(message: string, image: string): Promise { + return; + } /** * Shares directly to WhatsApp @@ -148,7 +186,13 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 4, platforms: ['iOS', 'Android'] }) - shareViaWhatsApp(message: string, image?: string, url?: string): Promise { return; } + shareViaWhatsApp( + message: string, + image?: string, + url?: string + ): Promise { + return; + } /** * Shares directly to a WhatsApp Contact @@ -163,7 +207,14 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 5, platforms: ['iOS', 'Android'] }) - shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise { return; } + shareViaWhatsAppToReceiver( + receiver: string, + message: string, + image?: string, + url?: string + ): Promise { + return; + } /** * Share via SMS @@ -174,7 +225,9 @@ export class SocialSharing extends IonicNativePlugin { @Cordova({ platforms: ['iOS', 'Android'] }) - shareViaSMS(messge: string, phoneNumber: string): Promise { return; } + shareViaSMS(messge: string, phoneNumber: string): Promise { + return; + } /** * Checks if you can share via email @@ -183,7 +236,9 @@ export class SocialSharing extends IonicNativePlugin { @Cordova({ platforms: ['iOS', 'Android'] }) - canShareViaEmail(): Promise { return; } + canShareViaEmail(): Promise { + return; + } /** * Share via Email @@ -200,7 +255,16 @@ export class SocialSharing extends IonicNativePlugin { successIndex: 6, errorIndex: 7 }) - shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string | string[]): Promise { return; } + shareViaEmail( + message: string, + subject: string, + to: string[], + cc?: string[], + bcc?: string[], + files?: string | string[] + ): Promise { + return; + } /** * Share via AppName @@ -216,7 +280,15 @@ export class SocialSharing extends IonicNativePlugin { errorIndex: 6, platforms: ['iOS', 'Android'] }) - shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise { return; } + shareVia( + appName: string, + message: string, + subject?: string, + image?: string, + url?: string + ): Promise { + return; + } /** * defines the popup position before call the share method. @@ -226,5 +298,17 @@ export class SocialSharing extends IonicNativePlugin { sync: true, platforms: ['iOS'] }) - setIPadPopupCoordinates(targetBounds: string): void { } + setIPadPopupCoordinates(targetBounds: string): void {} + + /** + * Save an array of images to the camera roll + * @param {string|string[]} fileOrFileArray Single or multiple files + * @returns {Promise } + */ + @Cordova({ + platforms: ['iOS'] + }) + saveToPhotoAlbum(fileOrFileArray: string | string[]): Promise { + return; + } }