gitawego / cordova-screenshot

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

iOS return URI #48

Open tbh726 opened 9 years ago

tbh726 commented 9 years ago

Hi, great plugin... i saw that iOS did not have URI, this was what i needed for bot android and iOS... not saying this is perfect (not an objective c type but can play), but it works great for me for URI.

in Screenshot.h

in Screenshot.m

}

roblav96 commented 9 years ago

sooo can someone please implement this!?!?!?!

gitawego commented 9 years ago

it exists already if you check the ios code.

navigator.screenshot.URI(function(error,res){
  if(error){
    console.error(error);
  }else{
    html = '<img style="width:50%;" src="'+res.URI+'">';
    document.body.innerHTML = html;
  }
},50);
roblav96 commented 9 years ago

omg you just saved my project!

I'm using this plugin to do native like transitions using Famous Engine to achieve 60fps transitions. I'll post the proof of concept when I'm done.

Thank you!!!

roblav96 commented 9 years ago

Actually I can't seem to get this working now.

All it does is return the same image no matter what view I change on the page :/

android 5.1

roblav96 commented 9 years ago

I'm trying to edit your code here, not too much Java experience. I'm not using crosswalk btw.

I see we are cacheing the bitmap:

            View view = webView.getView().getRootView();
        view.setDrawingCacheEnabled(true);
        bitmap = Bitmap.createBitmap(view.getDrawingCache());
        view.setDrawingCacheEnabled(false);

I'm pretty sure this is where my problem of the same image returning every time.

roblav96 commented 9 years ago

OK so I fixed it by changing

View view = webView.getView().getRootView();

to

View view = webView.getView()

:D