cordova-plugin-mserviceinterface-2.0 1.0.97 → 1.0.99

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.99",
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.99">
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>
@@ -372,7 +372,10 @@ public class mInterfaceService extends Service implements com.google.android.gms
372
372
  }
373
373
  String[] fileName = queueFiles[queueIndex].toString().split("/");
374
374
  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];
375
- new mInterfaceUtil().sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
375
+ statusIndication = new mInterfaceUtil().sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
376
+ if (statusIndication.equals("true")) {
377
+ break;
378
+ }
376
379
  }
377
380
  }
378
381
  }
@@ -634,7 +634,11 @@ 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
- sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
637
+ statusIndication = sendFilesToServer(queueFiles[queueIndex].toString(), fileName[fileName.length - 1], queueURL);
638
+ if (statusIndication.equals("true")) {
639
+ breakIndication = "true";
640
+ break;
641
+ }
638
642
  }
639
643
  }
640
644
  }
@@ -2513,7 +2513,11 @@
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
- [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2516
+ statusIndication = [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2517
+ if ([statusIndication isEqualToString:@"true"]) {
2518
+ breakIndication = @"true";
2519
+ break;
2520
+ }
2517
2521
  }
2518
2522
  }
2519
2523
  } else {
@@ -2602,7 +2606,10 @@
2602
2606
  for( int queueIndex = 0; queueIndex < [queueFilesMutArr count]; queueIndex++ ) {
2603
2607
  NSString *queueFilesPath = [NSString stringWithFormat:@"%@/%@", queueFolderPath, queueFilesMutArr[queueIndex]];
2604
2608
  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]];
2605
- [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2609
+ statusIndication = [self sendFilesToServer:queueFilesPath fileName:queueFilesMutArr[queueIndex] requestURL:queueURL];
2610
+ if ([statusIndication isEqualToString:@"true"]) {
2611
+ break;
2612
+ }
2606
2613
  }
2607
2614
  }
2608
2615
  } else {
@@ -3275,33 +3282,43 @@
3275
3282
 
3276
3283
  - (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command {
3277
3284
  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;
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(), ^{
3286
3297
  QLPreviewController *previewCtrl = [[QLPreviewController alloc] init];
3287
3298
  previewCtrl.delegate = self;
3288
3299
  previewCtrl.dataSource = self;
3289
3300
  [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
- }
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)];
3299
3310
  } else {
3300
- NSLog(@"Missing URL argument");
3301
- commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Missing URL argument"];
3311
+ NSLog(@"Invalid file URL: %@", err);
3312
+ commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
3313
+ messageAsString:@"Invalid file URL"];
3302
3314
  }
3303
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
3304
- }];
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];
3305
3322
  }
3306
3323
 
3307
3324
  #pragma - QLPreviewControllerDataSource Protocol