diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd0962..373ab7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [__change__:] Plugin requires Android KitKat or newer - [__change__:] `isAvailable` returns false if no enabled print services can be found (Android) - [enhancement:] `isAvailable` returns additional list of available print services (Android) +- [enhancement:] `print` returns bool value to indicate the result - [enhancement:] Support `duplex` attribute (Android) diff --git a/src/android/Printer.java b/src/android/Printer.java index fb4d646..8a5aaa4 100644 --- a/src/android/Printer.java +++ b/src/android/Printer.java @@ -229,7 +229,10 @@ public class Printer extends CordovaPlugin { public void run() { for (;;) { if (job.isCancelled() || job.isCompleted() || job.isFailed()) { - command.success(); + PluginResult res = new PluginResult( + PluginResult.Status.OK, job.isCompleted()); + + command.sendPluginResult(res); break; } } diff --git a/src/ios/APPPrinter.m b/src/ios/APPPrinter.m index 88b193b..b3f10c1 100755 --- a/src/ios/APPPrinter.m +++ b/src/ios/APPPrinter.m @@ -206,7 +206,8 @@ [controller presentFromRect:rect inView:self.webView animated:YES completionHandler: ^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) { CDVPluginResult* pluginResult = - [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [CDVPluginResult resultWithStatus:CDVCommandStatus_OK + messageAsBool:ok]; [self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId]; @@ -216,7 +217,8 @@ [controller presentAnimated:YES completionHandler: ^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) { CDVPluginResult* pluginResult = - [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [CDVPluginResult resultWithStatus:CDVCommandStatus_OK + messageAsBool:ok]; [self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId]; @@ -241,7 +243,8 @@ [controller printToPrinter:printer completionHandler: ^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) { CDVPluginResult* pluginResult = - [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [CDVPluginResult resultWithStatus:CDVCommandStatus_OK + messageAsBool:ok]; [self.commandDelegate sendPluginResult:pluginResult callbackId:_callbackId];