Skip to content

Commit 557a89f

Browse files
committed
@satgi 「Mod」bug fix for address of text search
@satgi add cancel requests & address components manGoweb#16 --------------------------- added place photos to result
1 parent b35b1d1 commit 557a89f

5 files changed

Lines changed: 21 additions & 1 deletion

FTGooglePlacesAPI/FTGooglePlacesAPIDetailResponse.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,7 @@
9999
@property (nonatomic, strong, readonly) NSURL *websiteUrl;
100100

101101
@property (nonatomic, assign, readonly) NSTimeInterval utcOffset;
102+
@property (nonatomic, copy, readonly) NSArray *addressComponents;
103+
@property (nonatomic, strong, readonly) NSArray *photos;
102104

103105
@end

FTGooglePlacesAPI/FTGooglePlacesAPIDetailResponse.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ - (void)ftgp_importDictionary:(NSDictionary *)dictionary
103103
_websiteUrl = [NSURL URLWithString:[dictionary ftgp_nilledObjectForKey:@"website"]];
104104

105105
_utcOffset = [[dictionary ftgp_nilledObjectForKey:@"utc_offset"] doubleValue];
106+
_addressComponents = [dictionary ftgp_nilledObjectForKey:@"address_components"];
107+
_photos = [dictionary ftgp_nilledObjectForKey:@"photos"];
108+
106109
}
107110

108111
@end

FTGooglePlacesAPI/FTGooglePlacesAPISearchResultItem.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ - (void)ftgpi_importDictionary:(NSDictionary *)dictionary
134134

135135
}
136136

137-
_addressString = [dictionary ftgp_nilledObjectForKey:@"vicinity"];
137+
if (dictionary[@"vicinity"]) {
138+
_addressString = [dictionary ftgp_nilledObjectForKey:@"vicinity"];
139+
} else if (dictionary[@"formatted_address"]) {
140+
_addressString = [dictionary ftgp_nilledObjectForKey:@"formatted_address"];
141+
}
138142

139143
// Openeed state may or may not be present
140144
NSNumber *openedState = [dictionary ftgp_nilledValueForKeyPath:@"opening_hours.open_now"];

FTGooglePlacesAPI/FTGooglePlacesAPIService.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,9 @@ typedef void (^FTGooglePlacesAPIDetailRequestCompletionhandler)(FTGooglePlacesAP
9696
*/
9797
+ (void)setDebugLoggingEnabled:(BOOL)enabled;
9898

99+
/**
100+
* Cancel all the running Places requests.
101+
*/
102+
+ (void)cancelAllRequests;
103+
99104
@end

FTGooglePlacesAPI/FTGooglePlacesAPIService.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ + (void)setDebugLoggingEnabled:(BOOL)enabled
214214
FTGooglePlacesAPIDebugLoggingEnabled = enabled;
215215
}
216216

217+
+ (void)cancelAllRequests
218+
{
219+
[[FTGooglePlacesAPIService sharedService].httpRequestOperationManager.operationQueue cancelAllOperations];
220+
}
221+
222+
217223
#pragma mark - Private class methods
218224

219225
+ (void)executeRequest:(id<FTGooglePlacesAPIRequest>)request

0 commit comments

Comments
 (0)