From ec4f3c69ecff712c3eb412c0275d385c9cfd8375 Mon Sep 17 00:00:00 2001 From: Rajkiran Panuganti Date: Thu, 28 Apr 2016 22:06:21 -0700 Subject: [PATCH 1/2] Screenshot Plugin --- src/index.ts | 3 +++ src/plugins/screenshot.ts | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/plugins/screenshot.ts diff --git a/src/index.ts b/src/index.ts index 6044e5dea..9754a7730 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,6 +38,7 @@ import {LaunchNavigator} from './plugins/launchnavigator'; import {LocalNotifications} from './plugins/localnotifications'; import {Network, Connection} from './plugins/network'; import {Push} from './plugins/push'; +import {Screenshot} from './plugins/screenshot'; import {SMS} from './plugins/sms'; import {SocialSharing} from './plugins/socialsharing'; import {SpinnerDialog} from './plugins/spinnerdialog'; @@ -82,6 +83,7 @@ export { LocalNotifications, Network, Push, + Screenshot, SMS, SocialSharing, SpinnerDialog, @@ -130,6 +132,7 @@ window['IonicNative'] = { LocalNotifications: LocalNotifications, Network: Network, Push: Push, + Screenshot: Screenshot, SMS: SMS, SocialSharing: SocialSharing, SpinnerDialog: SpinnerDialog, diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts new file mode 100644 index 000000000..5ed761e1b --- /dev/null +++ b/src/plugins/screenshot.ts @@ -0,0 +1,36 @@ +import {Cordova, Plugin} from './plugin'; +@Plugin({ + plugin: 'https://github.com/gitawego/cordova-screenshot.git', + pluginRef: 'navigator.screenshot', + repo: 'https://github.com/gitawego/cordova-screenshot.git' +}) +export class Screenshot { + +/** + * Takes screenshot and saves the image + * + * @param {string} format. Format can take the value of either 'jpg' or 'png' + * On ios, only 'jpg' format is supported + * @param {number} quality. Determines the quality of the screenshot. + * Default quality is set to 100. + * @param {string} filename. Name of the file as stored on the storage + */ + @Cordova({ + successIndex: 1, + errorIndex: 0 + }) + static save (format: string, quality: number, filename: string) : Promise {return} + +/** + * Takes screenshot and returns the image as an URI + * + * @param {number} quality. Determines the quality of the screenshot. + * Default quality is set to 100. + */ + + @Cordova({ + successIndex: 1, + errorIndex: 0 + }) + static URI (quality: number) : Promise {return} +} \ No newline at end of file From e73c99b28a1e8a5edddcef1ce49db5ef7e6a37c1 Mon Sep 17 00:00:00 2001 From: Rajkiran Panuganti Date: Thu, 28 Apr 2016 22:38:59 -0700 Subject: [PATCH 2/2] make params optional --- src/plugins/screenshot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/screenshot.ts b/src/plugins/screenshot.ts index 5ed761e1b..6c34543d4 100644 --- a/src/plugins/screenshot.ts +++ b/src/plugins/screenshot.ts @@ -19,7 +19,7 @@ export class Screenshot { successIndex: 1, errorIndex: 0 }) - static save (format: string, quality: number, filename: string) : Promise {return} + static save (format?: string, quality?: number, filename?: string) : Promise {return} /** * Takes screenshot and returns the image as an URI @@ -32,5 +32,5 @@ export class Screenshot { successIndex: 1, errorIndex: 0 }) - static URI (quality: number) : Promise {return} + static URI (quality?: number) : Promise {return} } \ No newline at end of file