Update Google+ integration.
[UPDATED] Google+ SDK to 1.1.0.
This commit is contained in:
@@ -516,14 +516,11 @@ static NSMutableDictionary *gKindMap = nil;
|
||||
defaultClass:(Class)defaultClass
|
||||
surrogates:(NSDictionary *)surrogates
|
||||
batchClassMap:(NSDictionary *)batchClassMap {
|
||||
if ([json isEqual:[NSNull null]]) {
|
||||
if ([json count] == 0 || [json isEqual:[NSNull null]]) {
|
||||
// no actual result, such as the response from a delete
|
||||
return nil;
|
||||
}
|
||||
|
||||
GTL_ASSERT([json count] != 0, @"Creating object from empty json");
|
||||
if ([json count] == 0) return nil;
|
||||
|
||||
// Determine the class to instantiate, based on the original fetch
|
||||
// request or by looking up "kind" string from the registration at
|
||||
// +load time of GTLObject subclasses
|
||||
@@ -629,9 +626,13 @@ static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
@end
|
||||
|
||||
@implementation GTLCollectionObject
|
||||
|
||||
// Subclasses must implement the items method dynamically.
|
||||
|
||||
- (void)dealloc {
|
||||
[identifierMap_ release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)itemAtIndex:(NSUInteger)idx {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
if (idx < [items count]) {
|
||||
@@ -640,6 +641,36 @@ static NSMutableDictionary *gArrayPropertyToClassMapCache = nil;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)objectAtIndexedSubscript:(NSInteger)idx {
|
||||
if (idx >= 0) {
|
||||
return [self itemAtIndex:(NSUInteger)idx];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)itemForIdentifier:(NSString *)key {
|
||||
if (identifierMap_ == nil) {
|
||||
NSArray *items = [self performSelector:@selector(items)];
|
||||
NSMutableDictionary *dict =
|
||||
[NSMutableDictionary dictionaryWithCapacity:[items count]];
|
||||
for (id item in items) {
|
||||
id identifier = [item valueForKey:@"identifier"];
|
||||
if (identifier != nil && identifier != [NSNull null]) {
|
||||
if ([dict objectForKey:identifier] == nil) {
|
||||
[dict setObject:item forKey:identifier];
|
||||
}
|
||||
}
|
||||
}
|
||||
identifierMap_ = [dict copy];
|
||||
}
|
||||
return [identifierMap_ objectForKey:key];
|
||||
}
|
||||
|
||||
- (void)resetIdentifierMap {
|
||||
[identifierMap_ release];
|
||||
identifierMap_ = nil;
|
||||
}
|
||||
|
||||
// NSFastEnumeration protocol
|
||||
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
|
||||
objects:(id *)stackbuf
|
||||
|
Reference in New Issue
Block a user