Ionic-native: can you please add the typescript for plugin-photo-library

Created on 28 Oct 2016  路  5Comments  路  Source: ionic-team/ionic-native

Hey can you please add the typescript https://github.com/terikon/cordova-plugin-photo-library

Regards

plugin request

Most helpful comment

@joshstrange yes what you have there should work

All 5 comments

@ezazwar1 It looks like the plugin itself added Typescript definitions after you asked for this. I'd take a swing at adding this to ionic-native but after looking at the method signatures I'm not sure how best to approach it. There are multiple things I don't see an easy way to do in the way ionic-native wraps plugins. For an example of the different types of function signatures:

  1. getLibrary(successCallback, failureCallback, config, progressCallback)
  2. saveImage(param1, param2, successCallback, failureCallback)
  3. requestAuthorization(successCallback, failureCallback, config?)
  4. getThumbnailURL(param1, successCallback, failureCallback, config?)
  5. getPhotoURL(param1, successCallback, failureCallback)

@ihadeed Am I understanding that I can use errorIndex and successIndex to solve the more challenging ones? I've never used them and I don't know if they will work like I want them to in this situation. For example is this (as a final product) possible:

````

//callbackOrder: 'reverse'
PhotoLibrary.getLibrary(config, progressCallback).then(() => {}, () => {});

//No special config
PhotoLibrary.saveImage(param1, param2).then(() => {}, () => {});

//callbackOrder: 'reverse'
PhotoLibrary.requestAuthorization(config?).then(() => {}, () => {});

//successIndex: 1, errorIndex: 2
PhotoLibrary.getThumbnailURL(param1, config?).then(() => {}, () => {});

//No special config
PhotoLibrary.getPhotoURL(param1).then(() => {}, () => {});

````

If it is I can take a shot at this.

@joshstrange yes what you have there should work

Im also in deep need of this plugin to work with typescript. IMHO Im kind of surprised why this plugin is not yet part of ionic-native?! It touches lots of use-cases and gives the control of the app to developer

@arberK While I have no use (ATM) of this plugin I was going to take a swing at writing up the code for it. However I've been extremely busy as of late and I'm not sure when I'll be able to get around to it. I'd encourage you to look at some of the other plugins to get a feel for how to write the required "wiring up code". It's really rather simple and the biggest hurdle (IMHO) is testing what you wrote works.

Also like I mentioned about this plugin does have TS definitions built into it and you can always use the plugin directly even without it being in Ionic Native.

While I'm neither part of the ionic or ionic-native team and don't speak for them I'd say it isn't in ionic-native because there aren't enough people asking for it and/or no one has stepped up to write it.

Plugin added

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyleap picture kyleap  路  4Comments

goleary picture goleary  路  3Comments

hobbydevs picture hobbydevs  路  3Comments

lycwed picture lycwed  路  4Comments

ghost picture ghost  路  3Comments