ScreenshotPlugin icon indicating copy to clipboard operation
ScreenshotPlugin copied to clipboard

CaptureAndSaveAsync doesn't always return the path

Open AltereD opened this issue 4 years ago • 0 comments

Hi,

Thank you for the plugin first of all.

The line below appears problematic to me as it will return an exception message instead of a file path and the caller won't even be aware of that. https://github.com/wilsonvargas/ScreenshotPlugin/blob/484d646935bb86669919dae577b5ff31285b4ebb/src/Screenshot/Screenshot.android.cs#L43

I would suggest not catching at all or rethrowing or even returning null to prevent a breaking change and keeping things simple.

Otherwise a new data structure could be used as well, such as a class that contains the path to the image and a status that tells if the capture was successful or not. But that would be a breaking change.

The same problem is present on iOS too: https://github.com/wilsonvargas/ScreenshotPlugin/blob/484d646935bb86669919dae577b5ff31285b4ebb/src/Screenshot/Screenshot.apple.cs#L25

I am willing to contribute for a fix.

Thanks.

AltereD avatar May 21 '20 15:05 AltereD