cordova-plugin-mserviceinterface-2.0 1.0.54 → 1.0.55

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.54",
3
+ "version": "1.0.55",
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
@@ -2,7 +2,7 @@
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
3
  xmlns:android="http://schemas.android.com/apk/res/android"
4
4
  id="cordova-plugin-mserviceinterface-2.0"
5
- version="1.0.54">
5
+ version="1.0.55">
6
6
  <name>mserviceinterface-2.0</name>
7
7
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
8
8
  <author>selfservit@gmail.com</author>
@@ -89,6 +89,7 @@
89
89
  - (void)GetPackageName:(CDVInvokedUrlCommand*)command;
90
90
  - (void)UpdateNew:(CDVInvokedUrlCommand*)command;
91
91
  - (void)StartService:(CDVInvokedUrlCommand*)command;
92
+ - (void)SendAttachmentToServer:(CDVInvokedUrlCommand*)command;
92
93
  - (void)SendLocation;
93
94
  - (void)GetLocation:(CDVInvokedUrlCommand*)command;
94
95
  - (void)timeReader;
@@ -38,6 +38,36 @@
38
38
  [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
39
39
  }
40
40
 
41
+ - (void)SendAttachmentToServer:(CDVInvokedUrlCommand *)command {
42
+ NSString *statusIndication = @"false";
43
+ NSMutableArray *argumentsList = [command arguments];
44
+ CDVPluginResult *result;
45
+ NSDictionary *argumentObject;
46
+ NSString *filePath;
47
+ NSString *serverPath;
48
+ NSString *fileName;
49
+ NSString *attachURL;
50
+ for(int index = 0; index < [argumentsList count]; index++) {
51
+ argumentObject = [argumentsList objectAtIndex:index];
52
+ filePath = argumentObject[@"filePath"];
53
+ serverPath = argumentObject[@"serverPath"];
54
+ fileName = argumentObject[@"fileName"];
55
+ attachURL = [NSString stringWithFormat: @"%@/common/components/msvFileHandler/UploadFiles.aspx?client_id=%@&country_code=%@&path=%@", clientUrl, clientID, countryCode, serverPath];
56
+ statusIndication = [self sendFilesToServer:filePath fileName:fileName requestURL:attachURL];
57
+ if ([statusIndication isEqualToString:@"false"]) {
58
+ break;
59
+ }
60
+ }
61
+ if ([statusIndication isEqualToString:@"true"]) {
62
+ NSString *serviceResult = [NSString stringWithFormat:@"%s", "success"];
63
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:serviceResult];
64
+ } else {
65
+ NSString *serviceResult = [NSString stringWithFormat:@"%s", "failure"];
66
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:serviceResult];
67
+ }
68
+ [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
69
+ }
70
+
41
71
  -(void)GetBase64String:(CDVInvokedUrlCommand *)command {
42
72
  NSMutableDictionary *dict = [[command arguments] objectAtIndex:0];
43
73
  NSString *directory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];