Skip to content

Commit

Permalink
Fixed Settings options selections.
Browse files Browse the repository at this point in the history
  • Loading branch information
emelleme committed Feb 16, 2015
1 parent 46c809c commit 152df7b
Show file tree
Hide file tree
Showing 14 changed files with 857 additions and 127 deletions.
138 changes: 101 additions & 37 deletions Classes/PersonalInfoViewController.m
Expand Up @@ -184,6 +184,12 @@ - (void)viewDidLoad
pickerView.dataSource = self;
pickerView.delegate = self;

actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; //as we want to display a subview we won't be using the default buttons but rather we're need to create a toolbar to display the buttons on

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
[actionSheet setActionSheetStyle:UIActionSheetStyleAutomatic];



// initialize text fields
self.age = [self initTextFieldAlpha];
Expand Down Expand Up @@ -291,65 +297,90 @@ - (void)textFieldDidBeginEditing:(UITextField *)myTextField{
[myTextField resignFirstResponder];
}
NSLog(@"currentTextfield: picker");*/
NSLog(@"beginedit");
currentTextField = myTextField;

if(myTextField == gender || myTextField == age || myTextField == ethnicity || myTextField == income || myTextField == cyclingFreq || myTextField == riderType || myTextField == riderHistory){

[myTextField resignFirstResponder];

actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; //as we want to display a subview we won't be using the default buttons but rather we're need to create a toolbar to display the buttons on

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

[actionSheet addSubview:pickerView];

doneToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
doneToolbar.barStyle = UIBarStyleBlackOpaque;
[doneToolbar sizeToFit];

NSMutableArray *barItems = [[[NSMutableArray alloc] init] autorelease];

UIBarButtonItem *flexSpace = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil] autorelease];
[barItems addObject:flexSpace];

UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonPressed:)];
[barItems addObject:cancelBtn];

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)];
[barItems addObject:doneBtn];
[actionSheet setActionSheetStyle:UIActionSheetStyleAutomatic];
// actionSheet.release;
// actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; //as we want to display a subview we won't be using the default buttons but rather we're need to create a toolbar to display the buttons on
//
// [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
// [actionSheet setActionSheetStyle:UIActionSheetStyleAutomatic];

// [actionSheet addSubview:pickerView];

// doneToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
// doneToolbar.barStyle = UIBarStyleBlackOpaque;
// [doneToolbar sizeToFit];

// NSMutableArray *barItems = [[[NSMutableArray alloc] init] autorelease];
//
// UIBarButtonItem *flexSpace = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil] autorelease];
// [barItems addObject:flexSpace];
//
// UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonPressed:)];
// [barItems addObject:cancelBtn];
//
// UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)];
// [barItems addObject:doneBtn];

//TODO add a next and previous button to left side to take us to the next/previous thing. and switch to the right kind of input mode.

[doneToolbar setItems:barItems animated:YES];

[actionSheet addSubview:doneToolbar];
// [doneToolbar setItems:barItems animated:YES];
//
// [actionSheet addSubview:doneToolbar];

selectedItem = 0;

// Iterate over fields and populate uiactionsheet
if(myTextField == gender){
selectedItem = [user.gender integerValue];
for(NSString *title in genderArray){
[actionSheet addButtonWithTitle:title];
}
}else if (myTextField == age){
for(NSString *title in ageArray){
[actionSheet addButtonWithTitle:title];
}
selectedItem = [user.age integerValue];
}else if (myTextField == ethnicity){
selectedItem = [user.ethnicity integerValue];
for(NSString *title in ethnicityArray){
[actionSheet addButtonWithTitle:title];
}
}else if (myTextField == income){
selectedItem = [user.income integerValue];
for(NSString *title in incomeArray){
[actionSheet addButtonWithTitle:title];
}
}else if (myTextField == cyclingFreq){
selectedItem = [user.cyclingFreq integerValue];
for(NSString *title in cyclingFreqArray){
[actionSheet addButtonWithTitle:title];
}
}else if (myTextField == riderType){
selectedItem = [user.rider_type integerValue];
for(NSString *title in riderTypeArray){
[actionSheet addButtonWithTitle:title];
}
}else if (myTextField == riderHistory){
selectedItem = [user.rider_history integerValue];
for(NSString *title in riderHistoryArray){
[actionSheet addButtonWithTitle:title];
}

}
// [actionSheet release];

[pickerView selectRow:selectedItem inComponent:0 animated:NO];

[pickerView reloadAllComponents];

[actionSheet addSubview:pickerView];
// [pickerView selectRow:selectedItem inComponent:0 animated:NO];

// [pickerView reloadAllComponents];
//
// [actionSheet addSubview:pickerView];
//
[actionSheet showInView:self.view];

[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
[actionSheet release];
//
// [actionSheet setBounds:CGRectMake(0, 0, 320, 485)];

}
}
Expand Down Expand Up @@ -662,7 +693,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
switch ([indexPath indexAtPosition:1])
{
case 0:
cell.textLabel.text = @"Age";
cell.textLabel.text = @"Age Range";
[cell.contentView addSubview:age];
break;
case 1:
Expand Down Expand Up @@ -995,6 +1026,39 @@ - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
return 1;
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if(currentTextField == gender){
currentTextField.text = [genderArray objectAtIndex:buttonIndex];
genderSelectedRow = buttonIndex;
}
else if(currentTextField == age){
currentTextField.text = [ageArray objectAtIndex:buttonIndex];
ageSelectedRow = buttonIndex;
}
else if(currentTextField == ethnicity){
currentTextField.text = [ethnicityArray objectAtIndex:buttonIndex];
ethnicitySelectedRow = buttonIndex;
}
else if(currentTextField == income){
currentTextField.text = [incomeArray objectAtIndex:buttonIndex];
incomeSelectedRow = buttonIndex;
}
else if(currentTextField == cyclingFreq){
currentTextField.text = [cyclingFreqArray objectAtIndex:buttonIndex];
cyclingFreqSelectedRow = buttonIndex;
}
else if(currentTextField == riderType){
currentTextField.text = [riderTypeArray objectAtIndex:buttonIndex];
riderTypeSelectedRow = buttonIndex;
}
else if(currentTextField == riderHistory){
currentTextField.text = [riderHistoryArray objectAtIndex:buttonIndex];
riderHistorySelectedRow = buttonIndex;
}
self.navigationItem.rightBarButtonItem.enabled = YES;
}

// deprecated
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
if(currentTextField == gender){
return [genderArray count];
Expand Down
12 changes: 8 additions & 4 deletions Cycle Philly.xcodeproj/project.pbxproj
Expand Up @@ -12,7 +12,6 @@
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
28D801B40F44B63D00FB423F /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28D801B30F44B63D00FB423F /* CoreData.framework */; };
461A123D190091A300BBDBB6 /* Firebase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 461A123C190091A300BBDBB6 /* Firebase.framework */; };
4688ACA81902B8EF00A67FAF /* TookTransitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4688ACA61902B8EF00A67FAF /* TookTransitViewController.m */; };
4688ACAB1902CF1B00A67FAF /* TookTransitViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4688ACAA1902CF1B00A67FAF /* TookTransitViewController.xib */; };
6411996210683D7500C201F0 /* RecordTripViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6411996110683D7500C201F0 /* RecordTripViewController.m */; };
Expand Down Expand Up @@ -173,6 +172,8 @@
9D6D31AE16D7C189007A2497 /* noteBlankPicker@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9D6D31AC16D7C189007A2497 /* noteBlankPicker@2x.png */; };
9DD65FBB16FEA3CC00F2EB63 /* ImageResize.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD65FBA16FEA3CC00F2EB63 /* ImageResize.m */; };
9FC3C01C1798DE89009238FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
DA2D78331A91F36200C54FB9 /* migrate.c in Sources */ = {isa = PBXBuildFile; fileRef = DA2D78321A91F36200C54FB9 /* migrate.c */; };
DA2D78351A91F7B200C54FB9 /* Firebase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA2D78341A91F7B200C54FB9 /* Firebase.framework */; };
DA78811F18DF417C008A5BE9 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DA78811E18DF417C008A5BE9 /* libicucore.dylib */; };
DA78812118DF418A008A5BE9 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA78812018DF418A008A5BE9 /* CFNetwork.framework */; };
DA78812518DF46DE008A5BE9 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DA78812418DF46DE008A5BE9 /* libc++.dylib */; };
Expand All @@ -190,7 +191,6 @@
28D801B30F44B63D00FB423F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* Cycle Philly_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Cycle Philly_Prefix.pch"; sourceTree = "<group>"; };
461A123C190091A300BBDBB6 /* Firebase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Firebase.framework; sourceTree = "<group>"; };
4688ACA51902B8EF00A67FAF /* TookTransitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TookTransitViewController.h; sourceTree = "<group>"; };
4688ACA61902B8EF00A67FAF /* TookTransitViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TookTransitViewController.m; sourceTree = "<group>"; };
4688ACAA1902CF1B00A67FAF /* TookTransitViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TookTransitViewController.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -385,6 +385,8 @@
9D6D31AC16D7C189007A2497 /* noteBlankPicker@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "noteBlankPicker@2x.png"; path = "TripPurposePickerIcons V3/noteBlankPicker@2x.png"; sourceTree = SOURCE_ROOT; };
9DD65FB916FEA3CC00F2EB63 /* ImageResize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageResize.h; sourceTree = "<group>"; };
9DD65FBA16FEA3CC00F2EB63 /* ImageResize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageResize.m; sourceTree = "<group>"; };
DA2D78321A91F36200C54FB9 /* migrate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = migrate.c; sourceTree = "<group>"; };
DA2D78341A91F7B200C54FB9 /* Firebase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Firebase.framework; sourceTree = "<group>"; };
DA78811E18DF417C008A5BE9 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
DA78812018DF418A008A5BE9 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
DA78812418DF46DE008A5BE9 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; };
Expand All @@ -403,7 +405,6 @@
buildActionMask = 2147483647;
files = (
DA78812718DF46EC008A5BE9 /* SystemConfiguration.framework in Frameworks */,
461A123D190091A300BBDBB6 /* Firebase.framework in Frameworks */,
DA78812518DF46DE008A5BE9 /* libc++.dylib in Frameworks */,
DA78812118DF418A008A5BE9 /* CFNetwork.framework in Frameworks */,
DA78811F18DF417C008A5BE9 /* libicucore.dylib in Frameworks */,
Expand All @@ -416,6 +417,7 @@
28D801B40F44B63D00FB423F /* CoreData.framework in Frameworks */,
6411996D10683DCD00C201F0 /* CoreLocation.framework in Frameworks */,
64F823C6106AB42B001413F8 /* Security.framework in Frameworks */,
DA2D78351A91F7B200C54FB9 /* Firebase.framework in Frameworks */,
642F151C1071D9DD0050BCB9 /* MapKit.framework in Frameworks */,
642647FD107435A200E43DEF /* AudioToolbox.framework in Frameworks */,
64ED1621112F364200E617E1 /* QuartzCore.framework in Frameworks */,
Expand Down Expand Up @@ -516,6 +518,7 @@
64F823B6106AB402001413F8 /* constants.h */,
32CA4F630368D1EE00C91783 /* Cycle Philly_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
DA2D78321A91F36200C54FB9 /* migrate.c */,
);
name = "Other Sources";
sourceTree = "<group>";
Expand Down Expand Up @@ -550,9 +553,9 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
DA2D78341A91F7B200C54FB9 /* Firebase.framework */,
DA78812618DF46EC008A5BE9 /* SystemConfiguration.framework */,
DA78812418DF46DE008A5BE9 /* libc++.dylib */,
461A123C190091A300BBDBB6 /* Firebase.framework */,
DA78812018DF418A008A5BE9 /* CFNetwork.framework */,
DA78811E18DF417C008A5BE9 /* libicucore.dylib */,
8FD696E81655E36600324E6E /* MediaPlayer.framework */,
Expand Down Expand Up @@ -966,6 +969,7 @@
8F9C086416DC9479003EA308 /* Note.m in Sources */,
8F9C086716DC9479003EA308 /* Trip.m in Sources */,
8F9C086A16DC947A003EA308 /* User.m in Sources */,
DA2D78331A91F36200C54FB9 /* migrate.c in Sources */,
4688ACA81902B8EF00A67FAF /* TookTransitViewController.m in Sources */,
8F9C086D16DC947A003EA308 /* Coord.m in Sources */,
8FBCD3CA16E0E58100C11EBE /* NoteViewController.m in Sources */,
Expand Down
Expand Up @@ -10,24 +10,36 @@
<string>Cycle Philly</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>6110CC6252755727643E36F2E3E0B2B306648F28</key>
<string>https://github.com/PhillyOpen/Cycle-Philly-iOS.git</string>
<key>71F631D7-15F7-4B2D-8E42-853890540A56</key>
<string>https://github.com/PhillyOpen/Cycle-Philly-iOS.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Cycle Philly.xcodeproj/project.xcworkspace</string>
<string>Cycle Philly.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>6110CC6252755727643E36F2E3E0B2B306648F28</key>
<string>../../..</string>
<key>71F631D7-15F7-4B2D-8E42-853890540A56</key>
<string>../..</string>
<string>../../Cycle-Philly-iOS</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/PhillyOpen/Cycle-Philly-iOS.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>71F631D7-15F7-4B2D-8E42-853890540A56</string>
<string>6110CC6252755727643E36F2E3E0B2B306648F28</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>6110CC6252755727643E36F2E3E0B2B306648F28</string>
<key>IDESourceControlWCCName</key>
<string></string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
Expand All @@ -36,6 +48,14 @@
<key>IDESourceControlWCCName</key>
<string>Cycle-Philly-iOS</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>6110CC6252755727643E36F2E3E0B2B306648F28</string>
<key>IDESourceControlWCCName</key>
<string>CyclePhilly-iOS</string>
</dict>
</array>
</dict>
</plist>
Binary file modified Firebase.framework/Versions/A/Firebase
Binary file not shown.
55 changes: 55 additions & 0 deletions Firebase.framework/Versions/A/Headers/FAuthData.h
@@ -0,0 +1,55 @@
//
// FAuthData.h
// Firebase
//
// Created by Katherine Fang on 7/30/14.
//

#import <Accounts/Accounts.h>
#import "FAuthType.h"


/**
* The FAuthData class is a wrapper around the user metadata returned from the Firebase auth server.
* It includes the provider authenticated against, a uid (with the possible exception of authenticating against a custom
* backend), and a token used to authenticate with Firebase.
*
* It may include other metadata about the user, depending on the provider used to do the authentication.
*/
@interface FAuthData : NSObject

/**
* @return Raw authentication token payload returned by the server
*/
@property (nonatomic, strong, readonly) NSDictionary *auth;

/**
* @return Authentication token expiration timestamp (seconds since epoch) returned by the server
*/
@property (nonatomic, strong, readonly) NSNumber *expires;

/**
* @return A uid for this user. It is unique across all auth providers.
*/
@property (nonatomic, strong, readonly) NSString *uid;


/**
* @return The provider that authenticated this user
*/
@property (nonatomic, readonly) NSString *provider;


/**
* @return The token that was used to authenticate this user with Firebase
*/
@property (nonatomic, strong, readonly) NSString *token;


/**
* @return Provider data keyed by provider. Includes cached data from third-party providers
*/
@property (nonatomic, strong, readonly) NSDictionary *providerData;


@end

0 comments on commit 152df7b

Please sign in to comment.