From a6fb4ba15d6d90ca675af2e7b5fdb3cd12d06507 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 28 Sep 2015 12:30:15 -0500 Subject: [PATCH] CameraRoll docs --- ionic/platform/camera-roll/camera-roll.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ionic/platform/camera-roll/camera-roll.ts b/ionic/platform/camera-roll/camera-roll.ts index 26c19d57a9..2f4f1b614d 100644 --- a/ionic/platform/camera-roll/camera-roll.ts +++ b/ionic/platform/camera-roll/camera-roll.ts @@ -4,7 +4,15 @@ import * as util from 'ionic/util'; import {NativePlugin} from '../plugin'; /** - * Save and load photos from the Camera Roll + * Save and load photos from the Camera Roll (currently iOS only). + * + * Requires the Cordiva plugin `cordova-plugin-camera-roll` + * + * @usage + * ```js + * CameraRoll.save(base64EncodedImage).then(() => { + * // success + * }, (err) => {}) */ @NativePlugin({ name: 'CameraRoll', @@ -19,6 +27,9 @@ import {NativePlugin} from '../plugin'; export class CameraRoll { /** * Save the base64 encoded image to the camera roll. + * + * @param base64String {String} base-64 encoded image + * @return {Promise} */ static save(base64String) { return new Promise((resolve, reject) => { @@ -33,12 +44,14 @@ export class CameraRoll { } /** - * Get photos from the camera roll + * Get photos from the camera roll. */ static getPhotos(options) { return new Promise((resolve, reject) => { this.ifPlugin(() => { - window.CameraRoll.saveToCameraRoll(base64String); + window.CameraRoll.getPhotos((photos) => { + resolve(photos); + }); }) }); }