|
|
|
@ -31,7 +31,7 @@ NSString *const CLParseTimezoneSelectionClassIdentifier = @"CLTimezoneSelection"
|
|
|
|
|
NSString *const CLParseTimezoneNameProperty = @"areaName"; |
|
|
|
|
NSString *const CLMaxCharactersReachedError = @"Only 50 characters allowed!"; |
|
|
|
|
NSString *const CLNoInternetConnectivityError = @"You're offline, maybe?"; |
|
|
|
|
NSString *const CLLocationSearchURL = @"https://maps.googleapis.com/maps/api/geocode/json?address=%@&key=AIzaSyCyf2knCi6KiKuDJLYDBD3Odq5dt4c-_KI"; |
|
|
|
|
NSString *const CLLocationSearchURL = @"https://maps.googleapis.com/maps/api/geocode/json?address=%@&key=AIzaSyCyf2knCi6KiKuDJLYDBD3Odq5dt4c-_KI&language=%@"; |
|
|
|
|
NSString *const CLTimezoneSearchURL = @"https://maps.googleapis.com/maps/api/timezone/json?location=%@×tamp=%f&key=AIzaSyCyf2knCi6KiKuDJLYDBD3Odq5dt4c-_KI"; |
|
|
|
|
NSString *const CLTryAgainMessage = @"Try again, maybe?"; |
|
|
|
|
|
|
|
|
@ -222,6 +222,13 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
|
|
|
|
|
[self.selectedTimeZones replaceObjectAtIndex:row withObject:encodedObject]; |
|
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:self.selectedTimeZones forKey:CLDefaultPreferenceKey]; |
|
|
|
|
|
|
|
|
|
if ([dataObject.isFavourite isEqualToNumber:@1]) |
|
|
|
|
{ |
|
|
|
|
[[NSUserDefaults standardUserDefaults] setObject:encodedObject |
|
|
|
|
forKey:@"favouriteTimezone"]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self refreshMainTableview]; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -230,7 +237,7 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
|
|
|
|
|
|
|
|
|
|
[self.selectedTimeZones enumerateObjectsUsingBlock:^(NSData * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) |
|
|
|
|
{ |
|
|
|
|
CLTimezoneData *timezone = [CLTimezoneData getCustomObject:object]; |
|
|
|
|
CLTimezoneData *timezone = [CLTimezoneData getCustomObject:obj]; |
|
|
|
|
timezone.isFavourite = [NSNumber numberWithInt:0]; |
|
|
|
|
NSData *encodedObject = [NSKeyedArchiver archivedDataWithRootObject:timezone]; |
|
|
|
|
[newArray addObject:encodedObject]; |
|
|
|
@ -570,9 +577,7 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
|
|
|
|
|
[self.dataTask cancel]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NSString *preferredLanguage = [[[NSBundle mainBundle]preferredLocalizations][0] substringToIndex:2]; |
|
|
|
|
|
|
|
|
|
NSLog(@"Preferred Language:%@", preferredLanguage); |
|
|
|
|
NSString *preferredLanguage = [NSLocale preferredLanguages][0]; |
|
|
|
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
|
|
|
|
@ -589,7 +594,6 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
self.activityInProgress = YES; |
|
|
|
@ -599,7 +603,7 @@ NSString *const CLTryAgainMessage = @"Try again, maybe?";
|
|
|
|
|
NSArray* words = [searchString componentsSeparatedByCharactersInSet :[NSCharacterSet whitespaceAndNewlineCharacterSet]]; |
|
|
|
|
searchString = [words componentsJoinedByString:CLEmptyString]; |
|
|
|
|
|
|
|
|
|
NSString *urlString = [NSString stringWithFormat:CLLocationSearchURL, searchString]; |
|
|
|
|
NSString *urlString = [NSString stringWithFormat:CLLocationSearchURL, searchString, preferredLanguage]; |
|
|
|
|
|
|
|
|
|
[CLAPI dataTaskWithServicePath:urlString |
|
|
|
|
bySender:self |
|
|
|
|