Skip to content

Commit f57a52e

Browse files
Removed debug code, and update conditional statement to be more readable
1 parent afa8c86 commit f57a52e

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

APCAppCore/APCAppCore/UI/TabBarControllers/Profile/APCProfileViewController.m

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,27 +1211,33 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
12111211

12121212
case kAPCUserInfoItemTypeDateOfBirth:
12131213
{
1214-
if (self.canEditBirthDate &&
1215-
![self isEditingAllowedForHealthKitProperty:HKCharacteristicTypeIdentifierDateOfBirth])
1216-
{
1217-
[self showEditingNotAllowedAlertForHealthKitProperty:HKCharacteristicTypeIdentifierDateOfBirth];
1218-
[tableView deselectRowAtIndexPath:indexPath animated:YES];
1219-
}
1220-
else
1214+
if (self.canEditBirthDate)
12211215
{
12221216
APCTableViewItem *field = [self itemForIndexPath:indexPath];
1223-
if (self.isEditing && field.isEditable) {
1217+
// Check for if we grabbed this value from HealthKit, because if we did, it can't be edited from our app
1218+
if (![self isEditingAllowedForHealthKitProperty:HKCharacteristicTypeIdentifierDateOfBirth])
1219+
{
1220+
[self showEditingNotAllowedAlertForHealthKitProperty:HKCharacteristicTypeIdentifierDateOfBirth];
1221+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
1222+
}
1223+
// only allow to be selected if we are in edit mode
1224+
else if (self.isEditing && field.isEditable)
1225+
{
12241226
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
12251227
}
1228+
// if we cant edit it, simply deselect the row
1229+
else
1230+
{
1231+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
1232+
}
1233+
}
1234+
else
1235+
{
1236+
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
12261237
}
12271238
}
12281239
break;
1229-
1230-
case kAPCUserInfoItemTypeHeight:
1231-
{
1232-
[self setEditing:!self.isEditing];
1233-
}
1234-
1240+
12351241
default:{
12361242
[super tableView:tableView didSelectRowAtIndexPath:indexPath];
12371243
}

0 commit comments

Comments
 (0)