Permalink
Browse files

latest 7am to 2pm..

  • Loading branch information...
1 parent 691b4c6 commit e224e5adc1c1c78b8ebcbf6e7283ed478192fe75 @jovhenni19 committed Feb 8, 2014
@@ -21,6 +21,8 @@
6E483EF1186303200071691D /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 6E483EEB1863031F0071691D /* README.md */; };
6E483EF2186303200071691D /* release_notes.md in Resources */ = {isa = PBXBuildFile; fileRef = 6E483EEC1863031F0071691D /* release_notes.md */; };
6E503B94186BE88D00E0F329 /* ABridge_UILabelInset.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E503B93186BE88D00E0F329 /* ABridge_UILabelInset.m */; };
+ 6E54D2D018A5BFC2009F6ECB /* MyImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E54D2CF18A5BFC1009F6ECB /* MyImage.m */; };
+ 6E54D2D618A5EF7A009F6ECB /* UIImage+ImageResize.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E54D2D518A5EF7A009F6ECB /* UIImage+ImageResize.m */; };
6E5A0A2C1867EEC30030F2FF /* ABridge_AutocompleteTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E5A0A2B1867EEC30030F2FF /* ABridge_AutocompleteTextField.m */; };
6E5A0A35186818490030F2FF /* MLPAutoCompleteTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E5A0A2F186818490030F2FF /* MLPAutoCompleteTextField.m */; };
6E5A0A36186818490030F2FF /* NSString+Levenshtein.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E5A0A34186818490030F2FF /* NSString+Levenshtein.m */; };
@@ -132,6 +134,10 @@
6E483EEF1863031F0071691D /* TestFlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestFlight.h; sourceTree = "<group>"; };
6E503B92186BE88C00E0F329 /* ABridge_UILabelInset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABridge_UILabelInset.h; sourceTree = "<group>"; };
6E503B93186BE88D00E0F329 /* ABridge_UILabelInset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABridge_UILabelInset.m; sourceTree = "<group>"; };
+ 6E54D2CE18A5BFC1009F6ECB /* MyImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyImage.h; sourceTree = "<group>"; };
+ 6E54D2CF18A5BFC1009F6ECB /* MyImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyImage.m; sourceTree = "<group>"; };
+ 6E54D2D418A5EF7A009F6ECB /* UIImage+ImageResize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+ImageResize.h"; sourceTree = "<group>"; };
+ 6E54D2D518A5EF7A009F6ECB /* UIImage+ImageResize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+ImageResize.m"; sourceTree = "<group>"; };
6E5A0A2A1867EEC30030F2FF /* ABridge_AutocompleteTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABridge_AutocompleteTextField.h; sourceTree = "<group>"; };
6E5A0A2B1867EEC30030F2FF /* ABridge_AutocompleteTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABridge_AutocompleteTextField.m; sourceTree = "<group>"; };
6E5A0A2E186818490030F2FF /* MLPAutoCompleteTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLPAutoCompleteTextField.h; sourceTree = "<group>"; };
@@ -507,6 +513,10 @@
6E503B93186BE88D00E0F329 /* ABridge_UILabelInset.m */,
6EB32BDC1848328C00F291AF /* HTTPURLConnection.h */,
6EB32BDD1848328C00F291AF /* HTTPURLConnection.m */,
+ 6E54D2CE18A5BFC1009F6ECB /* MyImage.h */,
+ 6E54D2CF18A5BFC1009F6ECB /* MyImage.m */,
+ 6E54D2D418A5EF7A009F6ECB /* UIImage+ImageResize.h */,
+ 6E54D2D518A5EF7A009F6ECB /* UIImage+ImageResize.m */,
6EEF586918337E6B00C3214E /* Main.storyboard */,
6EEF5883183396AB00C3214E /* Constants.h */,
6EEF584818337E4000C3214E /* AgentBridge.xcdatamodeld */,
@@ -803,6 +813,7 @@
6E28ACBA1835ED2D007E0C63 /* LoginDetails.m in Sources */,
6E791B49183CD28200BB76B3 /* Referral.m in Sources */,
6E47185D186456B60016B407 /* Activity.m in Sources */,
+ 6E54D2D018A5BFC2009F6ECB /* MyImage.m in Sources */,
6EFF61401851BB5700A5A86A /* ASIDownloadCache.m in Sources */,
6E697995187541DF0037F564 /* Property.m in Sources */,
6EFCFC611846F053004EB0B7 /* ABridge_AccountSettingsViewController.m in Sources */,
@@ -830,6 +841,7 @@
6E40004F1856C8D6000B78E6 /* ABridge_AgentInvitesViewController.m in Sources */,
6EDF11B91845D5FA001BFC6B /* AgentProfile.m in Sources */,
6E5AEF8D184C7C2800FE7B9E /* RequestAccess.m in Sources */,
+ 6E54D2D618A5EF7A009F6ECB /* UIImage+ImageResize.m in Sources */,
6EFF613E1851BB5700A5A86A /* ASIDataCompressor.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -15,6 +15,9 @@
@property (strong, nonatomic) UIPageViewController *pageController;
@property (strong, nonatomic) NSString *user_id;
+@property (strong, nonatomic) NSString *listing_id;
@property (strong, nonatomic) NSString *user_name;
+@property (assign, nonatomic) BOOL fromSearch;
+
@end
@@ -32,6 +32,8 @@ @implementation ABridge_ActivityAgentPOPsViewController
@synthesize scrollToListingId;
@synthesize user_id;
@synthesize user_name;
+@synthesize listing_id;
+@synthesize fromSearch;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -52,6 +54,17 @@ - (void)viewDidLoad
self.labelNumberOfProperty.text = [NSString stringWithFormat:@"%@ POPs™",self.user_name];
+ if (fromSearch) {
+ self.labelNumberOfProperty.hidden = YES;
+ self.activityIndicator.hidden = YES;
+ self.buttonSave.hidden = YES;
+ }
+ else {
+ self.labelNumberOfProperty.hidden = NO;
+ self.activityIndicator.hidden = NO;
+ self.buttonSave.hidden = NO;
+ }
+
[self.labelNumberOfProperty sizeToFit];
CGRect frame = self.activityIndicator.frame;
@@ -79,18 +92,104 @@ - (void)viewDidLoad
self.loginDetail = (LoginDetails*)[fetchedObjects firstObject];
- NSString *parameters = [NSString stringWithFormat:@"?user_id=%@",self.user_id];
- __block NSError *errorData = nil;
- __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/getpops.php%@",parameters]]];
- [request setCompletionBlock:^{
+ if (fromSearch) {
+ NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&listing_id=%@",self.user_id,self.listing_id];
- // Use when fetching text data
- // NSString *responseString = [request responseString];
- // Use when fetching binary data
- NSData *responseData = [request responseData];
- NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
+ __block NSError *errorData = nil;
+ __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/getpops_byid.php%@",parameters]]];
+ [request setCompletionBlock:^{
+
+ // Use when fetching text data
+ // NSString *responseString = [request responseString];
+ // 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;
+ for (NSDictionary *entry in [json objectForKey:@"data"]) {
+ Property *property = nil;
+
+ NSPredicate * predicate = [NSPredicate predicateWithFormat:@"listing_id == %@", [entry objectForKey:@"listing_id"]];
+ NSArray *result = [self fetchObjectsWithEntityName:@"Property" andPredicate:predicate];
+ if ([result count]) {
+ property = (Property*)[result firstObject];
+ }
+ else {
+ property = [NSEntityDescription insertNewObjectForEntityForName: @"Property" inManagedObjectContext: context];
+ }
+
+ [property setValuesForKeysWithDictionary:entry];
+
+ NSError *error = nil;
+ if (![context save:&error]) {
+ //NSLog(@"Error on saving Property:%@",[error localizedDescription]);
+ }
+ else {
+ if (self.arrayOfProperty == nil) {
+ self.arrayOfProperty = [[NSMutableArray alloc] init];
+ }
+
+ [self.arrayOfProperty addObject:property];
+ }
+ }
+
+ self.numberOfProperty = [self.arrayOfProperty count];
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
+
+ self.pageController.dataSource = self;
+ CGRect pageControllerFrame = self.viewForPages.frame;
+ pageControllerFrame.origin.x = 0.0f;
+ pageControllerFrame.origin.y = 1.0f;
+ self.pageController.view.frame = pageControllerFrame;
+
+ [self.labelNumberOfProperty sizeToFit];
+
+ CGRect frame = self.activityIndicator.frame;
+ frame.origin.x = self.labelNumberOfProperty.frame.origin.x + self.labelNumberOfProperty.frame.size.width + 10.0f;
+ self.activityIndicator.frame = frame;
+
+ ABridge_PropertyPagesViewController *initialViewController = [self viewControllerAtIndex:0];
+
+ NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
+
+ [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
+
+ [self addChildViewController:self.pageController];
+ [[self viewForPages] addSubview:[self.pageController view]];
+ [self.pageController didMoveToParentViewController:self];
+
+
+ });
+
+ }
+
+
+ }];
+ [request setFailedBlock:^{
+ NSError *error = [request error];
+ NSLog(@" error:%@",error);
+ }];
+
+ [request startAsynchronous];
+ }
+ else {
+
+ NSString *parameters = [NSString stringWithFormat:@"?user_id=%@",self.user_id];
+ __block NSError *errorData = nil;
+ __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/getpops.php%@",parameters]]];
+ [request setCompletionBlock:^{
+
+ // Use when fetching text data
+ // NSString *responseString = [request responseString];
+ // 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;
for (NSDictionary *entry in [json objectForKey:@"data"]) {
@@ -162,14 +261,16 @@ - (void)viewDidLoad
self.buttonSave.hidden = YES;
[self showOverlayWithMessage:@"You currently don't have any POPs™." withIndicator:NO];
}
+
+ }];
+ [request setFailedBlock:^{
+ NSError *error = [request error];
+ NSLog(@" error:%@",error);
+ }];
- }];
- [request setFailedBlock:^{
- NSError *error = [request error];
- NSLog(@" error:%@",error);
- }];
+ [request startAsynchronous];
+ }
- [request startAsynchronous];
}
@@ -262,6 +363,16 @@ - (void)scrollViewDidZoom:(UIScrollView *)scrollView {
- (IBAction)goBack:(id)sender {
- [self.navigationController popViewControllerAnimated:YES];
+
+ if (self.fromSearch) {
+
+ [self dismissViewControllerAnimated:YES completion:^{
+
+
+ }];
+ }
+ else {
+ [self.navigationController popViewControllerAnimated:YES];
+ }
}
@end
@@ -13,5 +13,6 @@
@interface ABridge_ActivityAgentProfileViewController : ABridge_ParentViewController <UITableViewDataSource, UITableViewDelegate, MFMailComposeViewControllerDelegate>
@property (strong, nonatomic) NSString *user_id;
+@property (assign, nonatomic) BOOL fromSearch;
@end
@@ -30,6 +30,7 @@ @implementation ABridge_ActivityAgentProfileViewController
@synthesize profileData;
@synthesize arrayKTableKeys;
@synthesize user_id;
+@synthesize fromSearch;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -45,9 +46,6 @@ - (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
- self.slidingViewController.underRightViewController = nil;
-
-
NSString *parameters = [NSString stringWithFormat:@"?user_id=%@",self.user_id];
__block NSError *errorData = nil;
@@ -60,6 +58,7 @@ - (void)viewDidLoad
NSData *responseData = [request responseData];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
+ NSLog(@"json:%@",json);
if ([[json objectForKey:@"data"] count]) {
NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
for (NSDictionary *entry in [json objectForKey:@"data"]) {
@@ -490,6 +489,13 @@ -(void)mailComposeController:(MFMailComposeViewController*)controller didFinishW
}
- (IBAction)goBack:(id)sender {
- [self.navigationController popViewControllerAnimated:YES];
+ if (self.fromSearch) {
+ [self dismissViewControllerAnimated:YES completion:^{
+
+ }];
+ }
+ else {
+ [self.navigationController popViewControllerAnimated:YES];
+ }
}
@end
Oops, something went wrong.

0 comments on commit e224e5a

Please sign in to comment.