Commit 1cb2937a authored by Deployer's avatar Deployer

Internal fixes for future features.

parent 656262f4
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'CedarMaps'
s.version = '3.1.1'
s.version = '3.1.2'
s.summary = 'CedarMaps iOS SDK'
# This description is used to generate tags and improve search results.
......
......@@ -103,6 +103,22 @@
/**
This method will search for an address using the provided string query.
@param addressString The address query to search.
@param type The placemark types to include in search results. This can be a combination of values.
@param limit The maximum number of results to return.
@param parameters For internal usage
@param completionHandler This handler is called when the process of fetching forward geocode
* results is completed. The block will be called on the main_queue.
*/
- (void)geocodeAddressString:(nonnull NSString *)addressString
withType:(CSPlacemarkType)type
limit:(NSInteger)limit
customParameters:(nullable NSDictionary<NSString *, NSString *> *)parameters
completionHandler:(nonnull CSForwardGeocodeCompletionHandler)completionHandler;
/**
This method will search for an address using the provided string query.
@param addressString The address query to search.
@param region The circular region consisting of a center coordinate and a radius to limit the search results.
......@@ -168,6 +184,7 @@
inProximity:(CLLocationCoordinate2D)coordinate
withType:(CSPlacemarkType)type
limit:(NSInteger)limit
customParameters:(nullable NSDictionary<NSString *, NSString *> *)parameters
completionHandler:(nonnull CSForwardGeocodeCompletionHandler)completionHandler;
/**
......
......@@ -167,23 +167,35 @@ typedef void (^CSNetworkResponseCompletionHandler)(NSData * _Nullable data, NSUR
- (void)geocodeAddressString:(NSString *)addressString
completionHandler:(CSForwardGeocodeCompletionHandler)completionHandler {
[self geocodeAddressString:addressString
withType:CSPlacemarkTypeAll
limit:30
completionHandler:completionHandler];
[self geocodeAddressString:addressString withType:CSPlacemarkTypeAll limit:30 completionHandler:completionHandler];
}
- (void)geocodeAddressString:(NSString *)addressString
withType:(CSPlacemarkType)type
limit:(NSInteger)limit
completionHandler:(CSForwardGeocodeCompletionHandler)completionHandler {
[self geocodeAddressString:addressString withType:type limit:limit completionHandler:completionHandler];
}
- (void)geocodeAddressString:(NSString *)addressString
inRegion:(CLCircularRegion *)region
completionHandler:(CSForwardGeocodeCompletionHandler)completionHandler {
[self geocodeAddressString:addressString inRegion:region withType:CSPlacemarkTypeAll limit:30 completionHandler:completionHandler];
}
- (void)geocodeAddressString:(nonnull NSString *)addressString
withType:(CSPlacemarkType)type
limit:(NSInteger)limit
customParameters:(nullable NSDictionary<NSString *, NSString *> *)parameters
completionHandler:(nonnull CSForwardGeocodeCompletionHandler)completionHandler {
if (addressString.length == 0) {
completionHandler(nil, [CSError errorWithDescription:@"Empty input"]);
return;
}
int limitParam = MIN(MAX((int)limit, 1), 30);
NSString *urlStr = [NSString stringWithFormat:@"%@geocode/%@/%@?limit=%i",
__block NSString *urlStr = [NSString stringWithFormat:@"%@geocode/%@/%@?limit=%i",
[CSAuthenticationManager.sharedAuthenticationManager baseURL],
self.mapID,
addressString,
......@@ -193,15 +205,12 @@ typedef void (^CSNetworkResponseCompletionHandler)(NSData * _Nullable data, NSUR
if (typeParam.length > 0) {
urlStr = [urlStr stringByAppendingFormat:@"&type=%@", typeParam];
}
[self parseGeocodingResponseForURLString:urlStr completionHandler:completionHandler];
}
- (void)geocodeAddressString:(NSString *)addressString
inRegion:(CLCircularRegion *)region
completionHandler:(CSForwardGeocodeCompletionHandler)completionHandler {
[self geocodeAddressString:addressString inRegion:region withType:CSPlacemarkTypeAll limit:30 completionHandler:completionHandler];
[parameters enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
urlStr = [urlStr stringByAppendingFormat:@"&%@=%@", key, obj];
}];
[self parseGeocodingResponseForURLString:urlStr completionHandler:completionHandler];
}
- (void)geocodeAddressString:(NSString *)addressString
......@@ -275,6 +284,7 @@ typedef void (^CSNetworkResponseCompletionHandler)(NSData * _Nullable data, NSUR
inProximity:(CLLocationCoordinate2D)coordinate
withType:(CSPlacemarkType)type
limit:(NSInteger)limit
customParameters:(nullable NSDictionary<NSString *, NSString *> *)parameters
completionHandler:(CSForwardGeocodeCompletionHandler)completionHandler {
if (addressString.length == 0) {
......@@ -284,7 +294,7 @@ typedef void (^CSNetworkResponseCompletionHandler)(NSData * _Nullable data, NSUR
int limitParam = MIN(MAX((int)limit, 1), 30);
NSString *urlStr = [NSString stringWithFormat:@"%@geocode/%@/%@?limit=%i&proximity=%f,%f",
__block NSString *urlStr = [NSString stringWithFormat:@"%@geocode/%@/%@?limit=%i&proximity=%f,%f",
[CSAuthenticationManager.sharedAuthenticationManager baseURL],
self.mapID,
addressString,
......@@ -297,6 +307,10 @@ typedef void (^CSNetworkResponseCompletionHandler)(NSData * _Nullable data, NSUR
urlStr = [urlStr stringByAppendingFormat:@"&type=%@", typeParam];
}
[parameters enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
urlStr = [urlStr stringByAppendingFormat:@"&%@=%@", key, obj];
}];
[self parseGeocodingResponseForURLString:urlStr completionHandler:completionHandler];
}
......
PODS:
- CedarMaps (3.1.1):
- CedarMaps (3.1.2):
- Mantle (~> 2.1)
- Mapbox-iOS-SDK (~> 4.0)
- Mantle (2.1.0):
......@@ -20,7 +20,7 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
CedarMaps: 8ec531d1ce64ee3fea8dedb082c20fd3fe4c4257
CedarMaps: bcdfbaba6cbb00420e636ee40bab7849442c7693
Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b
Mapbox-iOS-SDK: e6a4f236c77f914ca2e19b929c6cc6b077ba1c4c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment