From 154c029f79ef6768452fdfbdd52e47e9cb81c37c Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 11 Aug 2016 07:28:52 -0400 Subject: [PATCH] feat(photo-viewer): add wrapper for plugin (#359) * feat(photo-viewer): add wrapper for plugin * tslint --- src/index.ts | 3 +++ src/plugins/photo-viewer.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/plugins/photo-viewer.ts diff --git a/src/index.ts b/src/index.ts index 6a9073982..c53bb8872 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,7 @@ import {NativeStorage} from './plugins/nativestorage'; import {MediaPlugin} from './plugins/media'; import {Network} from './plugins/network'; import {OneSignal} from './plugins/onesignal'; +import { PhotoViewer } from './plugins/photo-viewer'; import {ScreenOrientation} from './plugins/screen-orientation'; import {PinDialog} from './plugins/pin-dialog'; import {Printer} from './plugins/printer'; @@ -148,6 +149,7 @@ export { NativeStorage, Network, OneSignal, + PhotoViewer, ScreenOrientation, PinDialog, Screenshot, @@ -223,6 +225,7 @@ window['IonicNative'] = { Printer: Printer, Push: Push, OneSignal: OneSignal, + PhotoViewer: PhotoViewer, ScreenOrientation: ScreenOrientation, PinDialog: PinDialog, SafariViewController: SafariViewController, diff --git a/src/plugins/photo-viewer.ts b/src/plugins/photo-viewer.ts new file mode 100644 index 000000000..2c61a77d5 --- /dev/null +++ b/src/plugins/photo-viewer.ts @@ -0,0 +1,28 @@ +import { Plugin, Cordova } from './plugin'; +/** + * @name Photo Viewer + * @description This plugin can display your image in full screen with the ability to pan, zoom, and share the image. + * @usage + * ```typescript + * import { PhotoViewer } from 'ionic-native'; + * + * PhotoViewer.show('https://mysite.com/path/to/image.jpg'); + * + * PhotoViewer.show('https://mysite.com/path/to/image.jpg', 'My image title', {share: false}); + * ``` + */ +@Plugin({ + plugin: 'com-sarriaroman-photoviewer', + pluginRef: 'PhotoViewer', + repo: 'https://github.com/sarriaroman/photoviewer' +}) +export class PhotoViewer { + /** + * Shows an image in full screen + * @param url {string} URL or path to image + * @param title {string} + * @param options {any} + */ + @Cordova({sync: true}) + show(url: string, title?: string, options?: {share?: boolean; }): void { } +}