cordova-plugin-mserviceinterface-2.0 1.0.96 → 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.96",
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.96">
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>
@@ -2358,6 +2358,7 @@
2358
2358
  - (void)StartService:(CDVInvokedUrlCommand*)command
2359
2359
  {
2360
2360
  @try {
2361
+ [self KillTimers];
2361
2362
  [self ValidateAppStateInfo];
2362
2363
  self.QueueToServerTimer = [NSTimer scheduledTimerWithTimeInterval:5.0
2363
2364
  target:self
@@ -2399,7 +2400,7 @@
2399
2400
 
2400
2401
  // No allowsBackgroundLocationUpdates here
2401
2402
 
2402
- [self KillTimers];
2403
+
2403
2404
  self.LocationTimer = [NSTimer scheduledTimerWithTimeInterval:locationInterval
2404
2405
  target:self
2405
2406
  selector:@selector(SendLocation)
@@ -3274,33 +3275,43 @@
3274
3275
 
3275
3276
  - (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command {
3276
3277
  self.fileOpenCallbackId = command.callbackId;
3277
- [self.commandDelegate runInBackground:^{
3278
- CDVPluginResult* commandResult = nil;
3279
- NSString *filePath = [command.arguments objectAtIndex:0];
3280
- if (filePath != nil && [filePath length] > 0) {
3281
- NSURL *url = [NSURL URLWithString:filePath];
3282
- NSError *err;
3283
- if (url.isFileURL && [url checkResourceIsReachableAndReturnError:&err] == YES) {
3284
- 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(), ^{
3285
3290
  QLPreviewController *previewCtrl = [[QLPreviewController alloc] init];
3286
3291
  previewCtrl.delegate = self;
3287
3292
  previewCtrl.dataSource = self;
3288
3293
  [previewCtrl.navigationItem setRightBarButtonItem:nil];
3289
- dispatch_async(dispatch_get_main_queue(), ^{
3290
- [self.viewController presentViewController:previewCtrl animated:YES completion:nil];
3291
- });
3292
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Success"];
3293
- [commandResult setKeepCallback:[NSNumber numberWithBool:YES]];
3294
- } else {
3295
- NSLog(@"Invalid file URL");
3296
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid file URL"];
3297
- }
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)];
3298
3303
  } else {
3299
- NSLog(@"Missing URL argument");
3300
- 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"];
3301
3307
  }
3302
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3303
- }];
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];
3304
3315
  }
3305
3316
 
3306
3317
  #pragma - QLPreviewControllerDataSource Protocol