IPad+iOS8 incompatibility (Fixes #26)

This commit is contained in:
Sebastián Katzer 2014-10-07 21:20:09 +02:00
parent ca51a0712c
commit 268f1b652d
3 changed files with 28 additions and 8 deletions

View File

@ -1,6 +1,7 @@
## ChangeLog ## ChangeLog
#### Version 0.7.0 (not yet released) #### Version 0.7.1 (not yet released)
- [bugfix:] `isAvailable` does not block the main thread anymore. - [bugfix:] `isAvailable` does not block the main thread anymore.
- [bugfix:] iPad+iOS8 incompatibility (Thanks to __zmagyar__)
#### Version 0.7.0 (12.09.2014) #### Version 0.7.0 (12.09.2014)
- Android Printing Framework support - Android Printing Framework support

View File

@ -95,6 +95,10 @@ cordova plugin rm de.appplant.cordova.plugin.printer
## ChangeLog ## ChangeLog
#### Version 0.7.1 (not yet released)
- [bugfix:] `isAvailable` does not block the main thread anymore.
- [bugfix:] iPad+iOS8 incompatibility (Thanks to __zmagyar__)
#### Version 0.7.0 (12.09.2014) #### Version 0.7.0 (12.09.2014)
- Android Printing Framework support - Android Printing Framework support
- [__change__:] Renamed `isServiceAvailable` to `isAvailable` - [__change__:] Renamed `isServiceAvailable` to `isAvailable`

View File

@ -20,6 +20,7 @@
*/ */
#import "APPPrinter.h" #import "APPPrinter.h"
#import <Cordova/CDVAvailability.h>
@interface APPPrinter () @interface APPPrinter ()
@ -184,6 +185,19 @@
*/ */
- (void) presentPrintController:(UIPrintInteractionController*)controller - (void) presentPrintController:(UIPrintInteractionController*)controller
{ {
if(CDV_IsIPad()) {
CGRect rect = CGRectMake(40, 30, 0, 0);
[controller presentFromRect:rect inView:self.webView animated:YES completionHandler:
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
CDVPluginResult* pluginResult =
[CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:pluginResult
callbackId:_callbackId];
}];
}
else {
[controller presentAnimated:YES completionHandler: [controller presentAnimated:YES completionHandler:
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) { ^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
CDVPluginResult* pluginResult = CDVPluginResult* pluginResult =
@ -192,6 +206,7 @@
[self.commandDelegate sendPluginResult:pluginResult [self.commandDelegate sendPluginResult:pluginResult
callbackId:_callbackId]; callbackId:_callbackId];
}]; }];
}
} }
/** /**