Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

network request fixes

  • Loading branch information...
commit aa58c6f1ce206882668485db74023b1048565e82 1 parent 37ae35a
@jovhenni19 authored
View
BIN  ...j/project.xcworkspace/xcuserdata/host24_iosdev.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
8 AgentBridge/ABridge_ActivityPagesViewController.m
@@ -284,19 +284,21 @@ - (void)viewDidLoad
// NSLog(@"[28]%@ user:%@ - %@ --- %@",self.loginDetail.user_id,self.activityDetail.user_id, self.activityDetail.other_user_id, self.activityDetail.user_name);
- if ([self.activityDetail.user_id integerValue] == [self.loginDetail.user_id integerValue]) {
+ if ([self.activityDetail.other_user_id integerValue] == [self.loginDetail.user_id integerValue]) {
message = [NSString stringWithFormat:@"You have been invited to join %@'s Network. If you accept this request, you will be able to view %@'s public POPs™.",self.activityDetail.user_name,self.activityDetail.user_name];
+
}
else {
- message = [NSString stringWithFormat:@"%@ is now added to your Network and will be able to view your public POPs™.",self.activityDetail.user_name];
+ message = [NSString stringWithFormat:@"You requested to join %@'s Network.",self.activityDetail.user_name];
+// message = [NSString stringWithFormat:@"%@ is now added to your Network and will be able to view your public POPs™.",self.activityDetail.user_name];
}
dispatch_async(dispatch_get_main_queue(), ^{
self.labelActivityName.text = @"Request Network Access";
self.labelDateTime.text = self.activityDetail.date;
- if ([self.activityDetail.user_id integerValue] == [self.loginDetail.user_id integerValue]) {
+ if ([self.activityDetail.other_user_id integerValue] == [self.loginDetail.user_id integerValue]) {
self.viewForDescription.hidden = NO;
self.labelDescription.text = @"";
self.buttonDescription.hidden = NO;
View
110 AgentBridge/ABridge_ActivityViewController.m
@@ -196,12 +196,10 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
for (NSDictionary *entryActivities in [jsonActivities objectForKey:@"data"]) {
-
NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&activities_id=%@", self.loginDetail.user_id, [entryActivities valueForKey:@"activities_id"]];
- // NSLog(@"25 parameters:%@",parameters);
+
NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/getactivity-%@.php%@", [entryActivities valueForKey:@"activity_type"], parameters];
-// NSLog(@"url:%@",urlString);
self.activityIndicator.hidden = NO;
[self.activityIndicator startAnimating];
__block NSError *errorData = nil;
@@ -212,23 +210,24 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
// Use when fetching binary data
NSData *responseData = [request responseData];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
- if ([[json objectForKey:@"data"] count]) {
- NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
-
- NSDictionary *entry = [[json objectForKey:@"data"] firstObject];
- Activity *activity = nil;
-
- NSPredicate * predicate = [NSPredicate predicateWithFormat:@"activities_id == %@", [entry objectForKey:@"activities_id"]];
- NSArray *result = [self fetchObjectsWithEntityName:@"Activity" andPredicate:predicate];
- if ([result count]) {
- activity = (Activity*)[result firstObject];
- }
- else {
- activity = [NSEntityDescription insertNewObjectForEntityForName: @"Activity" inManagedObjectContext: context];
- }
+
+ for (NSDictionary *entry in [json objectForKey:@"data"]) {
- if ([[entryActivities valueForKey:@"activity_type"] integerValue] == 11) {
+ if ([[json objectForKey:@"data"] count]) {
+
+ NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
+ Activity *activity = nil;
+
+ NSPredicate * predicate = [NSPredicate predicateWithFormat:@"activities_id == %@", [entry objectForKey:@"activities_id"]];
+ NSArray *result = [self fetchObjectsWithEntityName:@"Activity" andPredicate:predicate];
if ([result count]) {
+ activity = (Activity*)[result firstObject];
+ }
+ else {
+ activity = [NSEntityDescription insertNewObjectForEntityForName: @"Activity" inManagedObjectContext: context];
+ }
+
+ if ([result count] && [[entryActivities valueForKey:@"activity_type"] integerValue] == 11) {
if (![self compareLatestStatusFrom:[entry valueForKey:@"referral_status"] To:[activity valueForKey:@"referral_status"]]) {
[activity setValuesForKeysWithDictionary:entry];
@@ -237,59 +236,58 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
else {
[activity setValuesForKeysWithDictionary:entry];
}
- }
- else {
- [activity setValuesForKeysWithDictionary:entry];
- }
-
- NSError *error = nil;
- if (![context save:&error]) {
- NSLog(@"Error on saving Activity:%@",[error localizedDescription]);
- }
- else {
- if (self.arrayOfActivity == nil) {
- self.arrayOfActivity = [NSMutableArray array];
- for(int i = 0; i<[[jsonActivities objectForKey:@"data"] count]; i++)
- [self.arrayOfActivity addObject: [NSNull null]];
+
+ NSError *error = nil;
+ if (![context save:&error]) {
+ NSLog(@"Error on saving Activity:%@",[error localizedDescription]);
+ }
+ else {
+ if (self.arrayOfActivity == nil) {
+ self.arrayOfActivity = [NSMutableArray array];
+ for(int i = 0; i<[[jsonActivities objectForKey:@"data"] count]; i++)
+ [self.arrayOfActivity addObject: [NSNull null]];
+ }
+
+ [self.arrayOfActivity replaceObjectAtIndex:[[jsonActivities objectForKey:@"data"] indexOfObject:entryActivities] withObject:activity];
}
- // [self.arrayOfActivity addObject:activity];
- [self.arrayOfActivity replaceObjectAtIndex:[[jsonActivities objectForKey:@"data"] indexOfObject:entryActivities] withObject:activity];
- }
-
- NSSortDescriptor *sortDescriptor;
- sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date"
- ascending:NO];
- NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
- NSArray *sortedArray;
- sortedArray = [self.arrayOfActivity sortedArrayUsingDescriptors:sortDescriptors];
-
- self.numberOfActivity = [self.arrayOfActivity count];
- self.labelNumberOfActivity.text = [NSString stringWithFormat:@"My Activity (%li)",(long)self.numberOfActivity];
- [self.labelNumberOfActivity sizeToFit];
-
- CGRect frame = self.activityIndicator.frame;
- frame.origin.x = self.labelNumberOfActivity.frame.origin.x + self.labelNumberOfActivity.frame.size.width + 10.0f;
- self.activityIndicator.frame = frame;
-
- if (![[[self.arrayOfActivity objectAtIndex:0] class] isSubclassOfClass:[NSNull class]]) {
- [self reloadPages];
+ NSSortDescriptor *sortDescriptor;
+ sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date"
+ ascending:NO];
+ NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
+ NSArray *sortedArray;
+ sortedArray = [self.arrayOfActivity sortedArrayUsingDescriptors:sortDescriptors];
+
+ self.numberOfActivity = [self.arrayOfActivity count];
+ self.labelNumberOfActivity.text = [NSString stringWithFormat:@"My Activity (%li)",(long)self.numberOfActivity];
+ [self.labelNumberOfActivity sizeToFit];
+
+ CGRect frame = self.activityIndicator.frame;
+ frame.origin.x = self.labelNumberOfActivity.frame.origin.x + self.labelNumberOfActivity.frame.size.width + 10.0f;
+ self.activityIndicator.frame = frame;
+
+ if (![[[self.arrayOfActivity objectAtIndex:0] class] isSubclassOfClass:[NSNull class]]) {
+ [self reloadPages];
+ }
}
}
[self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES;
-
}];
[request setFailedBlock:^{
NSError *error = [request error];
- NSLog(@"error:%@",error);
+ NSLog(@"11 error:%@",error);
[self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES;
}];
[request startAsynchronous];
+
+
+
+
// if ([[entryActivities valueForKey:@"activity_type"] integerValue] == 25) {
// NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&activities_id=%@", self.loginDetail.user_id, [entryActivities valueForKey:@"activities_id"]];
@@ -488,7 +486,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
// }];
// [request startAsynchronous];
//
-//
+//
// }
// else if ([[entryActivities valueForKey:@"activity_type"] integerValue] == 6) {
// NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&activities_id=%@", self.loginDetail.user_id, [entryActivities valueForKey:@"activities_id"]];
View
2  AgentBridge/ABridge_BuyerViewController.m
@@ -263,6 +263,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
});
});
+ [self dismissOverlay];
}
else {
[self.pageController.view removeFromSuperview];
@@ -275,7 +276,6 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
}
}
- [self dismissOverlay];
[self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
View
2  AgentBridge/AgentBridge-Info.plist
@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0.17</string>
+ <string>1.0.18</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
Please sign in to comment.
Something went wrong with that request. Please try again.