cordova-plugin-mserviceinterface-2.0 1.0.105 → 1.0.106

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.105",
3
+ "version": "1.0.106",
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.105">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.106">
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>
@@ -559,10 +559,7 @@ public class mInterfaceService extends Service implements com.google.android.gms
559
559
  }
560
560
  String[] fileName = queueFiles[queueIndex].toString().split("/");
561
561
  String queueURL = clientUrl + "/common/components/QueueManager/QueueUpload.aspx?file_path=queue&client_id=" + clientID + "&country_code=" + countryCode + "&user_id=" + userID + "&file_name=" + fileName[fileName.length - 1];
562
- statusIndication = new mInterfaceUtil().sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL, () -> isCancelled() || !running);
563
- if (statusIndication.equals("true")) {
564
- break;
565
- }
562
+ new mInterfaceUtil().sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL, () -> isCancelled() || !running);
566
563
  }
567
564
  }
568
565
  }
@@ -634,11 +634,7 @@ public class mInterfaceUtil {
634
634
  }
635
635
  String[] fileName = queueFiles[queueIndex].toString().split("/");
636
636
  String queueURL = clientUrl + "/common/components/QueueManager/QueueUpload.aspx?file_path=queue&client_id=" + clientID + "&country_code=" + countryCode + "&user_id=" + userID + "&file_name=" + fileName[fileName.length - 1];
637
- statusIndication = sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
638
- if (statusIndication.equals("true")) {
639
- breakIndication = "true";
640
- break;
641
- }
637
+ sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
642
638
  }
643
639
  }
644
640
  }
@@ -2513,11 +2513,7 @@
2513
2513
  for( int queueIndex = 0; queueIndex < [queueFilesMutArr count]; queueIndex++ ) {
2514
2514
  NSString *queueFilesPath = [NSString stringWithFormat:@"%@/%@", queueFolderPath, queueFilesMutArr[queueIndex]];
2515
2515
  NSString *queueURL = [NSString stringWithFormat:@"%@/common/components/QueueManager/QueueUpload.aspx?file_path=queue&client_id=%@&country_code=%@&user_id=%@&file_name=%@", clientUrl, clientId, countryCode, userID, queueFilesMutArr[queueIndex]];
2516
- statusIndication = [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2517
- if ([statusIndication isEqualToString:@"true"]) {
2518
- breakIndication = @"true";
2519
- break;
2520
- }
2516
+ [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2521
2517
  }
2522
2518
  }
2523
2519
  } else {
@@ -2606,10 +2602,7 @@
2606
2602
  for( int queueIndex = 0; queueIndex < [queueFilesMutArr count]; queueIndex++ ) {
2607
2603
  NSString *queueFilesPath = [NSString stringWithFormat:@"%@/%@", queueFolderPath, queueFilesMutArr[queueIndex]];
2608
2604
  NSString *queueURL = [NSString stringWithFormat:@"%@/common/components/QueueManager/QueueUpload.aspx?file_path=queue&client_id=%@&country_code=%@&user_id=%@&file_name=%@", clientUrl, clientId, countryCode, userID, queueFilesMutArr[queueIndex]];
2609
- statusIndication = [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2610
- if ([statusIndication isEqualToString:@"true"]) {
2611
- break;
2612
- }
2605
+ [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2613
2606
  }
2614
2607
  }
2615
2608
  } else {
@@ -3282,43 +3275,33 @@
3282
3275
 
3283
3276
  - (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command {
3284
3277
  self.fileOpenCallbackId = command.callbackId;
3285
-
3286
- CDVPluginResult *commandResult = nil;
3287
- NSString *filePath = [command.arguments objectAtIndex:0];
3288
-
3289
- if (filePath != nil && [filePath length] > 0) {
3290
- NSURL *url = [NSURL URLWithString:filePath];
3291
-
3292
- NSError *err = nil;
3293
- if (url.isFileURL && [url checkResourceIsReachableAndReturnError:&err]) {
3294
- self.fileUrl = url;
3295
-
3296
- dispatch_async(dispatch_get_main_queue(), ^{
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;
3297
3286
  QLPreviewController *previewCtrl = [[QLPreviewController alloc] init];
3298
3287
  previewCtrl.delegate = self;
3299
3288
  previewCtrl.dataSource = self;
3300
3289
  [previewCtrl.navigationItem setRightBarButtonItem:nil];
3301
-
3302
- [self.viewController presentViewController:previewCtrl
3303
- animated:YES
3304
- completion:nil];
3305
- });
3306
-
3307
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
3308
- messageAsString:@"Success"];
3309
- [commandResult setKeepCallback:@(YES)];
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
+ }
3310
3299
  } else {
3311
- NSLog(@"Invalid file URL: %@", err);
3312
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
3313
- messageAsString:@"Invalid file URL"];
3300
+ NSLog(@"Missing URL argument");
3301
+ commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Missing URL argument"];
3314
3302
  }
3315
- } else {
3316
- NSLog(@"Missing URL argument");
3317
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
3318
- messageAsString:@"Missing URL argument"];
3319
- }
3320
-
3321
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3303
+ [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3304
+ }];
3322
3305
  }
3323
3306
 
3324
3307
  #pragma - QLPreviewControllerDataSource Protocol