Changeset 407
- Timestamp:
- 06/24/09 21:37:00 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
apps/iphone/superbook/trunk/Classes/MyCLController.m
r357 r407 129 129 int totalPeople = [friends.peopleCurrentList count]; 130 130 int nP = 0; 131 NSNumber *progress = 0; 132 for (personWithTel in peopleWithTel) { 133 nP++; 134 progress = [NSNumber numberWithFloat:(float)nP/(float)totalPeople]; 135 [self.delegate updateProgressView:progress]; 136 NSArray *personArray = (NSArray *)[friends.peopleCurrentList objectForKey:personWithTel]; 137 NSString *personName = [NSString stringWithString:(NSString *)[personArray objectAtIndex:0]]; 138 NSString *telUrl = [NSString stringWithString:(NSString *)[personArray objectAtIndex:5]]; 139 NSMutableArray *locArray = [NSMutableArray arrayWithCapacity:1]; 140 NSError *error; 141 NSUInteger locCount = [resolver getLOCForTel:telUrl inArray:locArray withError:&error]; 142 CLLocation *theLoc; 143 CLLocationDistance theDist = 0.0; 144 if (locCount == -1) { // Error 145 telStatus = FriendsDataSectionStatusUnknown; 146 theLoc = [[[CLLocation alloc] initWithLatitude:0 longitude:0] autorelease]; 147 // NSLog(@"Error finding location from domain: %@\n", [error localizedDescription]); 148 } else if (locCount == 0) { 149 telStatus = FriendsDataSectionWithoutLoc; 150 theLoc = [[[CLLocation alloc] initWithLatitude:0 longitude:0] autorelease]; 151 // NSLog(@"No LOC record in domain: %@\n", telUrl); 152 } else { 153 if (locCount > 1) { 154 //NSLog(@"Warning: %d LOC records in domain %@", locCount, telUrl); 155 } 156 telStatus = FriendsDataSectionWithLoc; 157 theLoc = (CLLocation *)[locArray objectAtIndex:0]; 158 theDist = [theLoc getDistanceFrom:self.myCurrentLoc]; 159 // NSLog(@"Found LOC record in domain: %@\n", telUrl); 131 NSNumber *progress = nil; 132 if (totalPeople == 0) { 133 // say we're done 134 [self.delegate updateProgressView:[NSNumber numberWithInt:1]]; 135 } else { 136 for (personWithTel in peopleWithTel) { 137 nP++; 138 progress = [NSNumber numberWithFloat:(float)nP/(float)totalPeople]; 139 [self.delegate updateProgressView:progress]; 140 NSArray *personArray = (NSArray *)[friends.peopleCurrentList objectForKey:personWithTel]; 141 NSString *personName = [NSString stringWithString:(NSString *)[personArray objectAtIndex:0]]; 142 NSString *telUrl = [NSString stringWithString:(NSString *)[personArray objectAtIndex:5]]; 143 NSMutableArray *locArray = [NSMutableArray arrayWithCapacity:1]; 144 NSError *error; 145 NSUInteger locCount = [resolver getLOCForTel:telUrl inArray:locArray withError:&error]; 146 CLLocation *theLoc; 147 CLLocationDistance theDist = 0.0; 148 if (locCount == -1) { // Error 149 telStatus = FriendsDataSectionStatusUnknown; 150 theLoc = [[[CLLocation alloc] initWithLatitude:0 longitude:0] autorelease]; 151 // NSLog(@"Error finding location from domain: %@\n", [error localizedDescription]); 152 } else if (locCount == 0) { 153 telStatus = FriendsDataSectionWithoutLoc; 154 theLoc = [[[CLLocation alloc] initWithLatitude:0 longitude:0] autorelease]; 155 // NSLog(@"No LOC record in domain: %@\n", telUrl); 156 } else { 157 if (locCount > 1) { 158 //NSLog(@"Warning: %d LOC records in domain %@", locCount, telUrl); 159 } 160 telStatus = FriendsDataSectionWithLoc; 161 theLoc = (CLLocation *)[locArray objectAtIndex:0]; 162 theDist = [theLoc getDistanceFrom:self.myCurrentLoc]; 163 // NSLog(@"Found LOC record in domain: %@\n", telUrl); 164 } 165 // the Loc might mean nothing. Make sure you check which group the person is in 166 // Only those that are in peopleWithTelAndLoc have a meaningful loc 167 168 NSArray *personInfoRow = [NSArray arrayWithObjects:personName, 169 [NSNumber numberWithInt:telStatus], 170 theLoc, 171 [NSDate date], 172 [NSNumber numberWithInt:theDist], // convert to int 173 telUrl, 174 nil]; 175 176 [(NSMutableDictionary *)friends.peopleNewList setObject:personInfoRow forKey:personWithTel]; 160 177 } 161 // the Loc might mean nothing. Make sure you check which group the person is in162 // Only those that are in peopleWithTelAndLoc have a meaningful loc163 164 NSArray *personInfoRow = [NSArray arrayWithObjects:personName,165 [NSNumber numberWithInt:telStatus],166 theLoc,167 [NSDate date],168 [NSNumber numberWithInt:theDist], // convert to int169 telUrl,170 nil];171 172 [(NSMutableDictionary *)friends.peopleNewList setObject:personInfoRow forKey:personWithTel];173 178 } 174 179








