cordova-plugin-mserviceinterface-2.0 1.0.53 → 1.0.54

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.53",
3
+ "version": "1.0.54",
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.53">
5
+ version="1.0.54">
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>
@@ -937,9 +937,12 @@
937
937
  [self.locationManager setHeadingFilter:kCLHeadingFilterNone];
938
938
  [self.locationManager requestAlwaysAuthorization];
939
939
  [self.locationManager requestWhenInUseAuthorization];
940
- // Allow background Update
941
- if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
942
- _locationManager.allowsBackgroundLocationUpdates = YES;
940
+ CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
941
+ if (status == kCLAuthorizationStatusAuthorizedAlways) {
942
+ // Location permission is granted, enable background location updates
943
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
944
+ _locationManager.allowsBackgroundLocationUpdates = YES;
945
+ }
943
946
  }
944
947
  [self.locationManager startUpdatingLocation];
945
948
  double lat = self.locationManager.location.coordinate.latitude;
@@ -1015,13 +1018,12 @@
1015
1018
  if(networkStatus == NotReachable){
1016
1019
  } else {
1017
1020
  NSError *error;
1018
- NSArray *myAccountsArray = [NSJSONSerialization JSONObjectWithData:[[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/my_accounts.txt", directory, [self GetAppName]] encoding:NSUTF8StringEncoding error:&error] dataUsingEncoding:NSUTF8StringEncoding] options: NSJSONReadingMutableContainers error:&error];
1021
+ NSArray *myAccountsArray = [NSJSONSerialization JSONObjectWithData:[[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/my_accounts_encrypted.txt", directory, [self GetAppName]] encoding:NSUTF8StringEncoding error:&error] dataUsingEncoding:NSUTF8StringEncoding] options: NSJSONReadingMutableContainers error:&error];
1019
1022
  for( int index = 0; index < [myAccountsArray count]; index++ ) {
1020
1023
  NSString *locationUpdateInd = [myAccountsArray[index] valueForKey:@"location_update_ind"];
1021
1024
  if([locationUpdateInd isEqual: @"true"]) {
1022
1025
  NSString *clientId = [myAccountsArray[index] valueForKey:@"client_id"];
1023
1026
  NSString *countryCode = [myAccountsArray[index] valueForKey:@"country_code"];
1024
- NSString *deviceID = [myAccountsArray[index] valueForKey:@"device_id"];
1025
1027
  NSString *clientUrl = [myAccountsArray[index] valueForKey:@"client_url"];
1026
1028
  NSString *locationData = [NSString stringWithContentsOfFile:locationFilePath encoding:NSUTF8StringEncoding error:&error];
1027
1029
  NSString *baseURL = [NSString stringWithFormat:@"%@/common/components/GeoLocation/update_device_location_offline.aspx", clientUrl];
@@ -1031,7 +1033,12 @@
1031
1033
  [request setValue:@"text/xml" forHTTPHeaderField:@"Content-type"];
1032
1034
  [request setHTTPMethod : @"POST"];
1033
1035
  [request setHTTPBody : inputData];
1034
- [NSURLConnection connectionWithRequest:request delegate:self];
1036
+ NSError *jsonError;
1037
+ NSURLResponse *response = nil;
1038
+ //[NSURLConnection connectionWithRequest:fileRequest delegate:self];
1039
+ NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&jsonError];
1040
+ NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
1041
+
1035
1042
  } else {
1036
1043
  NSLog(@"The locationUpdateInd indication is set to false");
1037
1044
  }
@@ -1566,10 +1573,13 @@
1566
1573
  [self.locationManager setHeadingFilter:kCLHeadingFilterNone];
1567
1574
  [self.locationManager requestAlwaysAuthorization];
1568
1575
  [self.locationManager requestWhenInUseAuthorization];
1569
- // Allow background Update
1570
- if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
1571
- _locationManager.allowsBackgroundLocationUpdates = YES;
1572
- }
1576
+ CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
1577
+ if (status == kCLAuthorizationStatusAuthorizedAlways) {
1578
+ // Location permission is granted, enable background location updates
1579
+ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
1580
+ _locationManager.allowsBackgroundLocationUpdates = YES;
1581
+ }
1582
+ }
1573
1583
  [self.locationManager startUpdatingLocation];
1574
1584
  [self KillTimers];
1575
1585
  self.LocationTimer = [NSTimer scheduledTimerWithTimeInterval:locationInterval