diff --git a/WPI Calendar Event Creator/Base.lproj/Main.storyboard b/WPI Calendar Event Creator/Base.lproj/Main.storyboard index 522ab6c6c3e55c793a4d9b1bb37221c93385d8cf..296aff601eb316f275f70960d7fd6818479a38d8 100644 --- a/WPI Calendar Event Creator/Base.lproj/Main.storyboard +++ b/WPI Calendar Event Creator/Base.lproj/Main.storyboard @@ -424,6 +424,7 @@ <outlet property="notesCell" destination="w5F-k8-fu6" id="hjd-mU-7kO"/> <outlet property="notesCellSubtitleLabel" destination="jnc-UL-L4a" id="3s8-J8-ktN"/> <outlet property="segmentedCell" destination="hKt-ue-2Ex" id="xRh-7A-851"/> + <outlet property="segmentedControll" destination="dh2-zX-vdz" id="USm-lD-uz4"/> <segue destination="ZH9-7k-a96" kind="push" identifier="TypeToFriendSegue" id="ON9-Of-yNd"/> <segue destination="WCo-rf-QLU" kind="push" identifier="TypeToCustomSegue" id="BNU-uE-JBB"/> <segue destination="izA-I5-AI8" kind="push" identifier="TypeToProfessorSegue" id="SuI-1w-32F"/> @@ -722,7 +723,7 @@ <action selector="writeEmail:" destination="fzL-WR-GQj" eventType="touchUpInside" id="rGf-Yu-ufH"/> </connections> </button> - <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Write email to developer about professor building" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="Ivl-W4-T18"> + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Write email to developer about missing professor" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="Ivl-W4-T18"> <rect key="frame" x="20" y="214" width="280" height="47"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> @@ -1023,7 +1024,7 @@ <color key="backgroundColor" red="0.0" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> - <textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/> + <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters" enablesReturnKeyAutomatically="YES"/> <connections> <outlet property="delegate" destination="EuZ-uN-7jh" id="YEV-pP-pWO"/> </connections> @@ -2017,7 +2018,7 @@ AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA <simulatedScreenMetrics key="destination" type="retina4"/> </simulatedMetricsContainer> <inferredMetricsTieBreakers> + <segue reference="axh-4G-zRI"/> <segue reference="a1q-7a-6BE"/> - <segue reference="h2T-3x-Eyw"/> </inferredMetricsTieBreakers> </document> diff --git a/WPI Calendar Event Creator/WPIFriendViewController.m b/WPI Calendar Event Creator/WPIFriendViewController.m index 74c576b481ec8b4fc4d08433dd51c0e7f75b1540..f51e5391d147b9727f1ad61b73e46f637cd12589 100644 --- a/WPI Calendar Event Creator/WPIFriendViewController.m +++ b/WPI Calendar Event Creator/WPIFriendViewController.m @@ -29,6 +29,15 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. + +} + +-(void)viewDidAppear:(BOOL)animated { + if ([(NSNumber*)[[WPIModel sharedDataModel].data valueForKey:@"Type"] integerValue] == 1) { + [self.textField becomeFirstResponder]; + } else { + [self.textView becomeFirstResponder]; + } } -(void) viewWillDisappear:(BOOL)animated { diff --git a/WPI Calendar Event Creator/WPIMissingBuildingViewController.m b/WPI Calendar Event Creator/WPIMissingBuildingViewController.m index 119662f16efc14a08f32d8ada16c8deafe3694de..99d72821ff41f5ff0492628738db687e66b80398 100644 --- a/WPI Calendar Event Creator/WPIMissingBuildingViewController.m +++ b/WPI Calendar Event Creator/WPIMissingBuildingViewController.m @@ -32,10 +32,15 @@ [model.data setObject:[NSNumber numberWithBool:YES] forKey:@"Use Custom Building"]; } +-(void)viewDidAppear:(BOOL)animated { + [self.buildingName becomeFirstResponder]; +} + - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + } - (void)didReceiveMemoryWarning diff --git a/WPI Calendar Event Creator/WPIMissingProfessorViewController.m b/WPI Calendar Event Creator/WPIMissingProfessorViewController.m index a5512462507ecf29490b897daf5fd355b3ebb3c2..2d04874fc3c4f7540f1388bf2253d746b6af678d 100644 --- a/WPI Calendar Event Creator/WPIMissingProfessorViewController.m +++ b/WPI Calendar Event Creator/WPIMissingProfessorViewController.m @@ -31,6 +31,12 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. + + +} + +-(void)viewDidAppear:(BOOL)animated { + [self.textField becomeFirstResponder]; } -(void) viewWillDisappear:(BOOL)animated { diff --git a/WPI Calendar Event Creator/WPIModel.m b/WPI Calendar Event Creator/WPIModel.m index 0ff4d0f43e7723246f2a9fa001517a4c62ec1a6c..a89359aeef69c5706256cdbdfaa3a70b1bae1dc2 100644 --- a/WPI Calendar Event Creator/WPIModel.m +++ b/WPI Calendar Event Creator/WPIModel.m @@ -308,7 +308,7 @@ static WPIModel *sharedDataModel = nil; NSError* error; - [self.eventStore saveEvent:event span:EKSpanThisEvent error:&error]; + //[self.eventStore saveEvent:event span:EKSpanThisEvent error:&error]; @@ -318,8 +318,8 @@ static WPIModel *sharedDataModel = nil; [self configureData]; } else { if ([(NSNumber*)[self.data valueForKey:@"Use Custom Professor"] boolValue]) { - alert = [[UIAlertView alloc] initWithTitle:@"Your event" message:@"Your event is successfully added to your default calendar." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil]; - [self configureData]; + alert = [[UIAlertView alloc] initWithTitle:@"Your event" message:@"Your event is successfully added to your default calendar. Would you like to send out an email with this event?" delegate:self cancelButtonTitle:@"No" otherButtonTitles: @"Yes", nil]; + //[self configureData]; } else { NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]]; NSString *message = [NSString stringWithFormat:@"Your event is successfully added to your default calendar. Would you like to send an email to professor %@ with a reminder? You will confirm it.", [prof objectForKey:@"Name"]]; @@ -358,13 +358,23 @@ static WPIModel *sharedDataModel = nil; MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init]; mailViewController.mailComposeDelegate = self.mainTable; + + NSString *message = @""; - NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]]; - NSString *email = [prof valueForKey:@"Email"]; + if (![(NSNumber*)[self.data valueForKey:@"Use Custom Professor"] boolValue]) { + + NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]]; + NSString *email = [prof valueForKey:@"Email"]; + + [mailViewController setToRecipients:@[email]]; + [mailViewController setSubject:@"Appointment reminder"]; + message = [NSString stringWithFormat:@"Dear Professor %@:\n\n I am just writing you a reminder about an appointment we set on %@. \n\n Thank you!", [prof valueForKey:@"Name"], [self getDateForPurpose:4]]; + } else { + [mailViewController setSubject:[self getTitleForPurpose:1]]; + } + + message = [message stringByAppendingString:[NSString stringWithFormat:@"\n\nAttached is an event file. You may add this event to your calendar.\n\n(This is an automated email from WPI Calendar Events Creator app)\n"]]; - [mailViewController setToRecipients:@[email]]; - [mailViewController setSubject:@"Appointment reminder"]; - NSString *message = [NSString stringWithFormat:@"Dear Professor %@:\n\n I am just writing you a reminder about an appointment we set on %@. \n\n Thank you!\n\n(This is an automated email from WPI Calendar Events Creator app)\n", [prof valueForKey:@"Name"], [self getDateForPurpose:4]]; [mailViewController setMessageBody:message isHTML:NO]; diff --git a/WPI Calendar Event Creator/WPINotesViewController.m b/WPI Calendar Event Creator/WPINotesViewController.m index 9c921e210eb49c716f6c154b39033273ed0a6672..ee3a8b919bbca9aeea7f2dd62e96020b71b10ce8 100644 --- a/WPI Calendar Event Creator/WPINotesViewController.m +++ b/WPI Calendar Event Creator/WPINotesViewController.m @@ -36,6 +36,11 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. + +} + +-(void)viewDidAppear:(BOOL)animated { + [self.notesTextField becomeFirstResponder]; } - (void)didReceiveMemoryWarning diff --git a/WPI Calendar Event Creator/WPIRoomViewController.m b/WPI Calendar Event Creator/WPIRoomViewController.m index f07c407eb6f5b20a68a97de89855314f10452c79..baab2cec7e3b70534992e39fb26b775d079a9eab 100644 --- a/WPI Calendar Event Creator/WPIRoomViewController.m +++ b/WPI Calendar Event Creator/WPIRoomViewController.m @@ -41,11 +41,17 @@ [model.data setValue:self.specificPlaceTextField.text forKey:@"Specific Place"]; } +-(void)viewDidAppear:(BOOL)animated { + [self.roomNumberTextField becomeFirstResponder]; +} + - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + + UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)]; numberToolbar.barStyle = UIBarStyleDefault; numberToolbar.items = [NSArray arrayWithObjects: diff --git a/WPI Calendar Event Creator/WPITableViewController.m b/WPI Calendar Event Creator/WPITableViewController.m index 6832f8091d89670b7aec488a406c5133886ab207..e17902bd210dee8e2df0fff3e36737f669db1cb1 100644 --- a/WPI Calendar Event Creator/WPITableViewController.m +++ b/WPI Calendar Event Creator/WPITableViewController.m @@ -18,6 +18,7 @@ @property (weak, nonatomic) IBOutlet UILabel *buildingCellSubtitleLabel; @property (weak, nonatomic) IBOutlet UILabel *alertCellSubtitleLabel; @property (weak, nonatomic) IBOutlet UILabel *notesCellSubtitleLabel; +@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControll; @property (weak, nonatomic) IBOutlet UILabel *dateCellConflictLabel; - (IBAction)favoritesButtonPressed:(id)sender; @@ -131,6 +132,7 @@ -(void)configureDetailsCell { WPIModel *model = [WPIModel sharedDataModel]; + [self.segmentedControll setSelectedSegmentIndex:[(NSNumber*)[model.data valueForKey:@"Type"] integerValue]]; switch ([(NSNumber*)[model.data valueForKey:@"Type"] integerValue]) { case 0: self.detailsCellMainLabel.text = @"Professor...";