gitawego / cordova-screenshot

screenshot plugin for cordova/phonegap
Other
211 stars 168 forks source link

Getting an absolute path to the saved image #4

Closed gabrielecirulli closed 10 years ago

gabrielecirulli commented 10 years ago

Would it be possible to have the plugin return a path to the saved image? I think this would be very useful, especially when integrating with other plugins, as highlighted here: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/92

gitawego commented 10 years ago

sure it's possible, I will add this feature asap. thanks for the feedback.

gabrielecirulli commented 10 years ago

No, thank you! :+1:

gabrielecirulli commented 10 years ago

I see your commits, awesome! Is it usable? :smile:

gitawego commented 10 years ago

I've modified only for android. iOS modification will be coming later.

gabrielecirulli commented 10 years ago

I see, thanks!

gabrielecirulli commented 10 years ago

I'll see if I can try forking and adding it for iOS, if it works I might send you a Pull Request. How does that sound?

gitawego commented 10 years ago

that would be awesome !! :) thanks any way ^^

gabrielecirulli commented 10 years ago

Just wondering, does the iOS version display an alert once the screenshot is saved? The Android version doesn't seem to (judging solely from the code). Does it make sense to have this?

gitawego commented 10 years ago

I didn't have time to rewrite the ios part, it's in fact quite obsolete. if you could update ios code, that would be cool :)

gabrielecirulli commented 10 years ago

I'm not an iOS developer so I'll probably barely be able to make the change I need, but I'll see if I can remove the alert :smile:

gitawego commented 10 years ago

hehe. ok then. I will work on iOS version when I have time. thanks :)

gabrielecirulli commented 10 years ago

I'll share my progress, because I can't proceed further. I don't know how to send the results back to the calling function as a JSON object, as you did in the android version.

I found a seemingly valid solution in this StackOverflow answer.

It's untested, but here's a diff of the changes I've made that you could maybe use to get started: https://gist.github.com/gabrielecirulli/884f79e668401d5dc7d5

To get the AssetsLibrary framework you also need to add the following before the header-file and source-file tags for iOS:

<framework src="AssetsLibrary.framework" />

Please let me know if you manage to get this working, and thanks for the support so far! :smile:

gabrielecirulli commented 10 years ago

Here's the full file, because I just noticed that the line where the save is requested got cut off: https://gist.github.com/gabrielecirulli/ef94c95b3b18c0b9d940

sebastianzillessen commented 10 years ago

Whats about the changes for iOS? Is it already working in the latest version?

mikowals commented 10 years ago

Any chance this will be working in iOS sometime soon?

sebastianzillessen commented 10 years ago

+1

droizman commented 10 years ago

Just posted a fix for iOS callback in the wiki issues.