Taking in flow dates and updating your Calendar
The app starts and the user presses on the flow dates button on the top right.
User enters 2 different flow dates and clicks on “Save History” on the top left.
PeriodHistoryViewController’s “Save History” is a back button. Its responder is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
- (void)onBackButtonTouch:(UIBarButtonItem *)sender { //if there's only 1 flow date, we ask for an average cycle day length //which then hits if { } //if there's 2 flow dates, process as normal else { //if self.periodHistoryDates is 2 if( [self.delegate respondsToSelector:@selector(updateCalendarViewWithPeriodHistory:)]) { [self.delegate updateCalendarViewWithPeriodHistory:self.periodHistoryDates]; } [self.navigationController popViewControllerAnimated:YES]; } } |
After the user selects the average cycle length we hit:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
-(void)sendSelectedData:(NSString*)data withUnit:(NSString*)unitType { NSLog(@"PeriodHistoryViewController.m - sendSelectedData:%@, type:%@", data, unitType); //save into the database UserSettingsDB * settingsDB = [[UserSettingsDB alloc] init]; if([settingsDB updateColumn:@"ave_cycle_length" withValue:data usingEmail:APPDELEGATE.currentUser.email]) { NSLog(@"PeriodHistoryViewController.m - sendSelectedData - average cycle length updated"); } else { NSLog(@"PeriodHistoryViewController.m - sendSelectedData - ERROR! average cycle length NOT updated"); } //then we just let the app update itself with the data if( [self.delegate respondsToSelector:@selector(updateCalendarViewWithPeriodHistory:)]) { [self.delegate updateCalendarViewWithPeriodHistory:self.periodHistoryDates]; } [self.navigationController popViewControllerAnimated:YES]; } |
Then it goes to MainTabsViewController’s
1 |
-(void)updateCalendarViewWithPeriodHistory:(NSMutableArray*)historyArray |
Then, CalendarViewController’s
1 |
-(void)updateCalendarViewWithPeriodDates:(NSArray*)dates |