cordova-plugin-mserviceinterface-2.0 1.0.97 → 1.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.97",
3
+ "version": "1.0.98",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
- xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.97">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.98">
4
4
  <name>mserviceinterface-2.0</name>
5
5
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
6
6
  <author>selfservit@gmail.com</author>
@@ -3275,33 +3275,43 @@
3275
3275
 
3276
3276
  - (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command {
3277
3277
  self.fileOpenCallbackId = command.callbackId;
3278
- [self.commandDelegate runInBackground:^{
3279
- CDVPluginResult* commandResult = nil;
3280
- NSString *filePath = [command.arguments objectAtIndex:0];
3281
- if (filePath != nil && [filePath length] > 0) {
3282
- NSURL *url = [NSURL URLWithString:filePath];
3283
- NSError *err;
3284
- if (url.isFileURL && [url checkResourceIsReachableAndReturnError:&err] == YES) {
3285
- self.fileUrl = url;
3278
+
3279
+ CDVPluginResult *commandResult = nil;
3280
+ NSString *filePath = [command.arguments objectAtIndex:0];
3281
+
3282
+ if (filePath != nil && [filePath length] > 0) {
3283
+ NSURL *url = [NSURL URLWithString:filePath];
3284
+
3285
+ NSError *err = nil;
3286
+ if (url.isFileURL && [url checkResourceIsReachableAndReturnError:&err]) {
3287
+ self.fileUrl = url;
3288
+
3289
+ dispatch_async(dispatch_get_main_queue(), ^{
3286
3290
  QLPreviewController *previewCtrl = [[QLPreviewController alloc] init];
3287
3291
  previewCtrl.delegate = self;
3288
3292
  previewCtrl.dataSource = self;
3289
3293
  [previewCtrl.navigationItem setRightBarButtonItem:nil];
3290
- dispatch_async(dispatch_get_main_queue(), ^{
3291
- [self.viewController presentViewController:previewCtrl animated:YES completion:nil];
3292
- });
3293
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Success"];
3294
- [commandResult setKeepCallback:[NSNumber numberWithBool:YES]];
3295
- } else {
3296
- NSLog(@"Invalid file URL");
3297
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid file URL"];
3298
- }
3294
+
3295
+ [self.viewController presentViewController:previewCtrl
3296
+ animated:YES
3297
+ completion:nil];
3298
+ });
3299
+
3300
+ commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
3301
+ messageAsString:@"Success"];
3302
+ [commandResult setKeepCallback:@(YES)];
3299
3303
  } else {
3300
- NSLog(@"Missing URL argument");
3301
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Missing URL argument"];
3304
+ NSLog(@"Invalid file URL: %@", err);
3305
+ commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
3306
+ messageAsString:@"Invalid file URL"];
3302
3307
  }
3303
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3304
- }];
3308
+ } else {
3309
+ NSLog(@"Missing URL argument");
3310
+ commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
3311
+ messageAsString:@"Missing URL argument"];
3312
+ }
3313
+
3314
+ [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3305
3315
  }
3306
3316
 
3307
3317
  #pragma - QLPreviewControllerDataSource Protocol