From 11d516fb28ac3220abd05798ccaa6cb1bad284f8 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 14:23:50 +0100 Subject: [PATCH] feat(base64-to-gallery): add options interface --- .../plugins/base64-to-gallery/index.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/@ionic-native/plugins/base64-to-gallery/index.ts b/src/@ionic-native/plugins/base64-to-gallery/index.ts index 0acc4da069..c4ac50c78c 100644 --- a/src/@ionic-native/plugins/base64-to-gallery/index.ts +++ b/src/@ionic-native/plugins/base64-to-gallery/index.ts @@ -1,5 +1,15 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface Base64ToGalleryOptions { + /** Saved file name prefix */ + prefix: string; + /** + * On Android runs Media Scanner after file creation. + * On iOS if true the file will be added to camera roll, otherwise will be saved to a library folder. + */ + mediaScanner: boolean; +} /** * @name Base64 To Gallery @@ -19,6 +29,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; * err => console.log('Error saving image to gallery ', err) * ); * ``` + * @interfaces + * Base64ToGalleryOptions */ @Plugin({ pluginName: 'Base64ToGallery', @@ -29,19 +41,20 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class Base64ToGallery extends IonicNativePlugin { - /** * Converts a base64 string to an image file in the device gallery * @param {string} data The actual base64 string that you want to save - * @param {any} [options] An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS. + * @param {any} [options] An object with properties * @returns {Promise} returns a promise that resolves when the image is saved. */ @Cordova({ successIndex: 2, errorIndex: 3 }) - base64ToGallery(data: string, options?: { prefix?: string; mediaScanner?: boolean }): Promise { + base64ToGallery( + data: string, + options?: Base64ToGalleryOptions + ): Promise { return; } - }