Cache UIPrinter (#128)
* Cache UIPrinter This speeds up printing time from 25 seconds to < 5 * Switching to isEqualToString
This commit is contained in:
committed by
Sebastián Katzer
parent
99f50db26e
commit
d2486217f0
@@ -195,8 +195,15 @@
|
||||
printer:(NSString*)printerId
|
||||
{
|
||||
NSURL* url = [NSURL URLWithString:printerId];
|
||||
UIPrinter* printer = [UIPrinter printerWithURL:url];
|
||||
|
||||
|
||||
// check to see if we have previously created this printer to reduce printing/"contacting" time
|
||||
if(self.previousPrinter == nil || ![[[self.previousPrinter URL] absoluteString] isEqualToString: printerId]) {
|
||||
self.previousPrinter = [UIPrinter printerWithURL:url];
|
||||
}
|
||||
|
||||
UIPrinter* printer = self.previousPrinter;
|
||||
|
||||
|
||||
[controller printToPrinter:printer completionHandler:
|
||||
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
|
||||
CDVPluginResult* pluginResult =
|
||||
|
||||
Reference in New Issue
Block a user