Permalink
Browse files

Finally the crash is fixed

  • Loading branch information...
1 parent 6aaf0c8 commit c62e4d4a2f13caeaf92dfc19e0ecdc52a18d7fa6 @jovhenni19 committed Dec 19, 2013
Showing 901 changed files with 2,482 additions and 104,833 deletions.
Oops, something went wrong.
@@ -805,6 +805,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
}
- (IBAction)buttonActionPressed:(id)sender {
+ NSLog(@"pressed");
switch ([((UIButton*)sender) tag]) {
case 1001:{
@@ -191,8 +191,8 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
NSDictionary *jsonActivities = [NSJSONSerialization JSONObjectWithData:self.dataReceived options:NSJSONReadingAllowFragments error:&error];
+// NSLog(@"Did Finish:%@", jsonActivities);
if ([[jsonActivities objectForKey:@"data"] count]) {
-// NSLog(@"Did Finish:%@", jsonActivities);
// NSLog(@"total:%i",[[json objectForKey:@"data"] count]);
for (NSDictionary *entryActivities in [jsonActivities objectForKey:@"data"]) {
@@ -7,6 +7,7 @@
//
#import "ABridge_AppDelegate.h"
+#import "TestFlight.h"
@implementation ABridge_AppDelegate
@@ -29,14 +30,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
- nil] forState:UIControlStateNormal];
- UIColor *titleHighlightedColor = [UIColor colorWithRed:44.0f/255.0 green:153.0f/255.0 blue:206.0f/255.0 alpha:1.0];
+ nil] forState:UIControlStateSelected];
+ UIColor *titleHighlightedColor = [UIColor whiteColor];//[UIColor colorWithRed:44.0f/255.0 green:153.0f/255.0 blue:206.0f/255.0 alpha:1.0];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
titleHighlightedColor, UITextAttributeTextColor,
- nil] forState:UIControlStateSelected];
-
+ nil] forState:UIControlStateNormal];
+ [self.window makeKeyAndVisible];
_initalStoryboard = self.window.rootViewController.storyboard;
+ [TestFlight takeOff:@"c6b4d58a-dd3a-4c8f-8b39-d76c46aaeeef"];
+
return YES;
}
@@ -8,12 +8,18 @@
#import "ABridge_BrokerageViewController.h"
#import "AgentProfile.h"
+#import "HTAutocompleteTextField.h"
+#import "HTAutocompleteManager.h"
+#import "ASIHTTPRequest.h"
+#import "Brokerage.h"
+#import "Designation.h"
+#import "ABridge_AppDelegate.h"
@interface ABridge_BrokerageViewController ()
@property (weak, nonatomic) IBOutlet UILabel *aboutMeTitle;
@property (weak, nonatomic) IBOutlet UILabel *brokerageHeader;
@property (weak, nonatomic) IBOutlet UILabel *designationHeader;
-@property (weak, nonatomic) IBOutlet UITextField *textFieldBrokerage;
+@property (weak, nonatomic) IBOutlet HTAutocompleteTextField *textFieldBrokerage;
@property (weak, nonatomic) IBOutlet UIButton *buttonSave;
@property (weak, nonatomic) IBOutlet UIScrollView *scrollViewDesignations;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
@@ -22,6 +28,7 @@ @interface ABridge_BrokerageViewController ()
@property (strong, nonatomic) NSURLConnection *urlConnectionDesignation;
@property (strong, nonatomic) NSMutableData *dataReceived;
@property (strong, nonatomic) NSMutableArray *arrayOfDesignation;
+@property (strong, nonatomic) NSMutableArray *arrayOfDesignationAutocomplete;
- (IBAction)saveBrokerage:(id)sender;
- (IBAction)backButton:(id)sender;
@@ -31,6 +38,7 @@ @implementation ABridge_BrokerageViewController
@synthesize urlConnectionDesignation;
@synthesize dataReceived;
@synthesize arrayOfDesignation;
+@synthesize arrayOfDesignationAutocomplete;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -59,6 +67,71 @@ - (void)viewDidLoad
[self addPaddingAndBorder:self.textFieldBrokerage color:[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0f]];
+ __block NSMutableArray *arrayOfBroker = nil;
+
+ NSMutableString *urlStringBroker = [NSMutableString stringWithString:@"http://keydiscoveryinc.com/agent_bridge/webservice/get_broker_list.php"];
+
+ __block NSError *errorDataBroker = nil;
+ __block ASIHTTPRequest *requestBroker = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlStringBroker]];
+ [requestBroker setCompletionBlock:
+ ^{
+ NSData *responseData = [requestBroker responseData];
+ NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorDataBroker];
+
+ if ([[json objectForKey:@"data"] count]) {
+ // NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
+ for(NSDictionary *entry in [json objectForKey:@"data"]){
+ // Brokerage *broker = nil;
+ //
+ // NSPredicate * predicate = [NSPredicate predicateWithFormat:@"broker_id == %@", [entry objectForKey:@"broker_id"]];
+ //
+ // NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] init];
+ // [fetchRequest setPredicate:predicate];
+ // [fetchRequest setEntity:[NSEntityDescription entityForName:@"Brokerage" inManagedObjectContext:context]];
+ // NSError * error = nil;
+ // NSArray * result = [context executeFetchRequest:fetchRequest error:&error];
+ // if ([result count]) {
+ // broker = (Brokerage*)[result firstObject];
+ // }
+ // else {
+ // broker = [NSEntityDescription insertNewObjectForEntityForName: @"Brokerage" inManagedObjectContext: context];
+ //
+ // NSError *errorSave = nil;
+ // if (![context save:&errorSave]) {
+ // NSLog(@"Error on saving RequestNetwork:%@",[errorSave localizedDescription]);
+ // }
+ // }
+ //
+ // [broker setValuesForKeysWithDictionary:entry];
+
+ if(arrayOfBroker == nil) {
+ arrayOfBroker = [NSMutableArray array];
+ }
+
+ // [arrayOfBroker addObject:broker.broker_name];
+ [arrayOfBroker addObject:[entry valueForKey:@"broker_name"]];
+ }
+
+ // Set a default data source for all instances. Otherwise, you can specify the data source on individual text fields via the autocompleteDataSource property
+
+ HTAutocompleteManager *manager = [HTAutocompleteManager sharedManager];
+ manager.arrayOfBroker = arrayOfBroker;
+ [HTAutocompleteTextField setDefaultAutocompleteDataSource:manager];
+
+ self.textFieldBrokerage.autocompleteType = HTAutocompleteTypeBrokerage;
+
+ }
+
+ }];
+ [requestBroker setFailedBlock:^{
+ NSError *error = [requestBroker error];
+ NSLog(@" error:%@",error);
+ }];
+
+ [requestBroker startAsynchronous];
+
+
+
NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
@@ -192,6 +265,40 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
[self.arrayOfDesignation addObject:[entry objectForKey:@"designation_name"]];
}
+ NSMutableString *urlString = [NSMutableString stringWithString:@"http://keydiscoveryinc.com/agent_bridge/webservice/get_designation_list.php"];
+
+ __block NSError *errorData = nil;
+ __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
+ [request setCompletionBlock:
+ ^{
+ NSData *responseData = [request responseData];
+ NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
+
+ if ([[json objectForKey:@"data"] count]) {
+
+ for(NSDictionary *entry in [json objectForKey:@"data"]){
+
+ if(self.arrayOfDesignationAutocomplete == nil) {
+ self.arrayOfDesignationAutocomplete = [NSMutableArray array];
+ }
+
+
+ [self.arrayOfDesignationAutocomplete addObject:[entry valueForKey:@"designations"]];
+ }
+
+ // Set a default data source for all instances. Otherwise, you can specify the data source on individual text fields via the autocompleteDataSource property
+
+
+ }
+
+ }];
+ [request setFailedBlock:^{
+ NSError *error = [request error];
+ NSLog(@" error:%@",error);
+ }];
+
+ [request startAsynchronous];
+
dispatch_async(dispatch_get_main_queue(), ^{
CGFloat yOffset = 0.0f;
if ([self.arrayOfDesignation count] > 2) {
@@ -204,7 +311,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
self.buttonSave.frame = frame;
}
for (NSString *designation in self.arrayOfDesignation) {
- UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, yOffset, 280.0f, 30.0f)];
+ HTAutocompleteTextField *textField = [[HTAutocompleteTextField alloc] initWithFrame:CGRectMake(0.0f, yOffset, 280.0f, 30.0f)];
textField.font = FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR);
[self addPaddingAndBorder:textField color:[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0f]];
textField.borderStyle = UITextBorderStyleNone;
@@ -219,6 +326,13 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
yOffset += textField.frame.size.height + 10.0f;
self.scrollViewDesignations.contentSize = CGSizeMake(0.0f, yOffset);
+
+
+ HTAutocompleteManager *manager = [HTAutocompleteManager sharedManager];
+ manager.arrayOfDesignation = self.arrayOfDesignation;
+ [HTAutocompleteTextField setDefaultAutocompleteDataSource:manager];
+
+ textField.autocompleteType = HTAutocompleteTypeDesignation;
}
if ([self.arrayOfDesignation count] == 0) {
@@ -230,7 +344,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
self.labelNoneSpecified.hidden = YES;
}
- UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, yOffset, 280.0f, 30.0f)];
+ HTAutocompleteTextField *textField = [[HTAutocompleteTextField alloc] initWithFrame:CGRectMake(0.0f, yOffset, 280.0f, 30.0f)];
textField.font = FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR);
[self addPaddingAndBorder:textField color:[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0f]];
textField.borderStyle = UITextBorderStyleNone;
@@ -240,6 +354,12 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
textField.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
+ HTAutocompleteManager *manager = [HTAutocompleteManager sharedManager];
+ manager.arrayOfDesignation = self.arrayOfDesignation;
+ [HTAutocompleteTextField setDefaultAutocompleteDataSource:manager];
+
+ textField.autocompleteType = HTAutocompleteTypeDesignation;
+
[self.scrollViewDesignations addSubview:textField];
self.scrollViewDesignations.contentSize = CGSizeMake(self.scrollViewDesignations.contentSize.width, self.scrollViewDesignations.contentSize.height + 35.0f);
Oops, something went wrong.

0 comments on commit c62e4d4

Please sign in to comment.