mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
feat(base64-to-gallery): add options interface
feat(base64-to-gallery): add options interface
This commit is contained in:
commit
50ae6f0888
@ -1,5 +1,15 @@
|
|||||||
import { Injectable } from '@angular/core';
|
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
|
* @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)
|
* err => console.log('Error saving image to gallery ', err)
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
|
* @interfaces
|
||||||
|
* Base64ToGalleryOptions
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'Base64ToGallery',
|
pluginName: 'Base64ToGallery',
|
||||||
@ -29,19 +41,20 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
|||||||
})
|
})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Base64ToGallery extends IonicNativePlugin {
|
export class Base64ToGallery extends IonicNativePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a base64 string to an image file in the device gallery
|
* 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 {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<any>} returns a promise that resolves when the image is saved.
|
* @returns {Promise<any>} returns a promise that resolves when the image is saved.
|
||||||
*/
|
*/
|
||||||
@Cordova({
|
@Cordova({
|
||||||
successIndex: 2,
|
successIndex: 2,
|
||||||
errorIndex: 3
|
errorIndex: 3
|
||||||
})
|
})
|
||||||
base64ToGallery(data: string, options?: { prefix?: string; mediaScanner?: boolean }): Promise<any> {
|
base64ToGallery(
|
||||||
|
data: string,
|
||||||
|
options?: Base64ToGalleryOptions
|
||||||
|
): Promise<any> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user