isAvailable does not block the main thread anymore

This commit is contained in:
Sebastián Katzer 2014-09-12 10:53:44 +02:00
parent 15870f8a4e
commit 5493c652fd
3 changed files with 11 additions and 7 deletions

View File

@ -5,4 +5,5 @@
- [__change__:] Renamed `isServiceAvailable` to `isAvailable`
- [enhancement:] New print options like `name`, `landscape` or `duplex`
- [enhancement:] Ability to print remote content via URI
- [enhancement:] Callback support
- [enhancement:] Callback support
- [bugfix:] `isAvailable` does not block the main thread anymore.

View File

@ -100,6 +100,7 @@ cordova plugin rm de.appplant.cordova.plugin.printer
- [enhancement:] New print options like `name`, `landscape` or `duplex`
- [enhancement:] Ability to print remote content via URI
- [enhancement:] Callback support
- [bugfix:] `isAvailable` does not block the main thread anymore.
#### Further informations
- See [CHANGELOG.md][changelog] to get the full changelog for the plugin.

View File

@ -38,14 +38,16 @@
*/
- (void) isAvailable:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult;
BOOL isAvailable = [self isPrintingAvailable];
[self.commandDelegate runInBackground:^{
CDVPluginResult* pluginResult;
BOOL isAvailable = [self isPrintingAvailable];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsBool:isAvailable];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsBool:isAvailable];
[self.commandDelegate sendPluginResult:pluginResult
callbackId:command.callbackId];
[self.commandDelegate sendPluginResult:pluginResult
callbackId:command.callbackId];
}];
}
/**