Skip to content

Commit

Permalink
Merge pull request #143 from CareEvolution/mmertsock/target-14
Browse files Browse the repository at this point in the history
Update deployment target to iOS 14
  • Loading branch information
mmertsock authored Aug 9, 2023
2 parents 0539887 + 2ffd085 commit 3af47c4
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 103 deletions.
4 changes: 2 additions & 2 deletions ORK1Kit/ORK1Kit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3553,7 +3553,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
Expand Down Expand Up @@ -3601,7 +3601,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
Expand Down
14 changes: 2 additions & 12 deletions ORK1Kit/ORK1Kit/ActiveTasks/ORK1LocationRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ - (void)start {

self.locationManager = [self createLocationManager];

CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = self.locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = self.locationManager.authorizationStatus;

if (status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusNotDetermined) {
[self.locationManager requestWhenInUseAuthorization];
Expand Down Expand Up @@ -164,12 +159,7 @@ - (void)finishRecordingWithError:(NSError *)error {
}

- (BOOL)isRecording {
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = self.locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = self.locationManager.authorizationStatus;

return [CLLocationManager locationServicesEnabled] && (self.locationManager != nil) && (status > kCLAuthorizationStatusDenied);
}
Expand Down
4 changes: 1 addition & 3 deletions ORK1Kit/ORK1Kit/Common/ORK1DateTimePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ - (instancetype)initWithAnswerFormat:(ORK1AnswerFormat *)answerFormat answer:(id
- (UIDatePicker *)pickerView {
if (_pickerView == nil) {
_pickerView = [[UIDatePicker alloc] init];
if (@available(iOS 14, *)) {
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
}
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
[_pickerView addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventValueChanged];
self.answerFormat = _answerFormat;
self.answer = _answer;
Expand Down
35 changes: 3 additions & 32 deletions ORK1Kit/ORK1Kit/Common/ORK1DocumentSelectionStepViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ - (void)setUpViews {

if (self.documentSelectionStep.allowPhotoLibrary && self.isPhotoLibraryAvailable) {
ORK1ContinueButton *button = [[ORK1ContinueButton alloc] initWithTitle:ORK1LocalizedString(@"CHOOSE_PHOTO_BUTTON_TITLE", nil) isDoneButton:NO];
[button addTarget:self action:@selector(choosePhoto) forControlEvents:UIControlEventTouchUpInside];
[button addTarget:self action:@selector(presentPhotoPicker) forControlEvents:UIControlEventTouchUpInside];
[sourceStackView addArrangedSubview:button];
}

Expand Down Expand Up @@ -206,36 +206,7 @@ - (void)takePhoto {
}
}

- (void)choosePhoto {
// iOS 14 photo library picker does not require authorization prompt
if (@available(iOS 14, *)) {
[self presentPhotoPicker];
return;
}

ORK1WeakTypeOf(self) weakSelf = self;
switch ([PHPhotoLibrary authorizationStatus]) {
case PHAuthorizationStatusDenied:
case PHAuthorizationStatusRestricted:
[self handleError:[NSError errorWithDomain:NSCocoaErrorDomain code:NSFeatureUnsupportedError userInfo:@{NSLocalizedDescriptionKey:ORK1LocalizedString(@"DOCUMENT_SELECTION_ERROR_NO_PHOTO_PERMISSIONS", nil)}] showSettingsButton:YES];
break;
case PHAuthorizationStatusNotDetermined:
case PHAuthorizationStatusAuthorized:
case PHAuthorizationStatusLimited:
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
dispatch_async(dispatch_get_main_queue(), ^{
if (status == PHAuthorizationStatusAuthorized) {
[weakSelf presentAuthorizedPicker:UIImagePickerControllerSourceTypePhotoLibrary];
} else {
[weakSelf handleError:[NSError errorWithDomain:NSCocoaErrorDomain code:NSFeatureUnsupportedError userInfo:@{NSLocalizedDescriptionKey:ORK1LocalizedString(@"DOCUMENT_SELECTION_ERROR_NO_PHOTO_PERMISSIONS", nil)}] showSettingsButton:YES];
}
});
}];
break;
}
}

- (void)presentPhotoPicker API_AVAILABLE(ios(14)) {
- (void)presentPhotoPicker {
PHPickerConfiguration *configuration = [[PHPickerConfiguration alloc] init];
configuration.selectionLimit = 1;
configuration.filter = [PHPickerFilter imagesFilter];
Expand Down Expand Up @@ -388,7 +359,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking

#pragma mark - PHPickerViewControllerDelegate

- (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results API_AVAILABLE(ios(14)) {
- (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results {
NSItemProvider *provider = results.firstObject.itemProvider;
if ([provider canLoadObjectOfClass:[UIImage class]]) {
[provider loadObjectOfClass:[UIImage class] completionHandler:^(UIImage * _Nullable image, NSError * _Nullable error) {
Expand Down
7 changes: 1 addition & 6 deletions ORK1Kit/ORK1Kit/Common/ORK1LocationSelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,7 @@ - (void)showMapViewIfNecessary {
- (void)loadCurrentLocationIfNecessary {
if (_useCurrentLocation) {

CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = _locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = _locationManager.authorizationStatus;

if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse) {
_userLocationNeedsUpdate = YES;
Expand Down
11 changes: 3 additions & 8 deletions ORK1Kit/ORK1Kit/Common/ORK1TaskViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ - (void)resume {
NSString *allowedAlways = (NSString *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];

if (_manager) {

CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = _manager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = _manager.authorizationStatus;

if ((status == kCLAuthorizationStatusNotDetermined) && (allowedWhenInUse || allowedAlways)) {
if (allowedAlways) {
Expand All @@ -134,7 +128,8 @@ - (void)finishWithResult:(BOOL)result {
}
}

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {
CLAuthorizationStatus status = manager.authorizationStatus;
if (_handler && _started && status != kCLAuthorizationStatusNotDetermined) {
[self finishWithResult:(status != kCLAuthorizationStatusDenied)];
}
Expand Down
4 changes: 1 addition & 3 deletions ORK1Kit/ORK1Kit/Common/ORK1TimeIntervalPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ - (instancetype)initWithAnswerFormat:(ORK1TimeIntervalAnswerFormat *)answerForma
- (UIView *)pickerView {
if (_pickerView == nil) {
_pickerView = [[ORK1DatePicker alloc] init];
if (@available(iOS 14, *)) {
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
}
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
_pickerView.datePickerMode = UIDatePickerModeCountDownTimer;
[_pickerView addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventValueChanged];
[self setAnswerFormat:_answerFormat];
Expand Down
4 changes: 2 additions & 2 deletions ResearchKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4155,7 +4155,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
Expand Down Expand Up @@ -4203,7 +4203,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
Expand Down
14 changes: 2 additions & 12 deletions ResearchKit/ActiveTasks/ORKLocationRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ - (void)start {

self.locationManager = [self createLocationManager];

CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = self.locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = self.locationManager.authorizationStatus;

if (status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusNotDetermined) {
[self.locationManager requestWhenInUseAuthorization];
Expand Down Expand Up @@ -165,12 +160,7 @@ - (void)finishRecordingWithError:(NSError *)error {
}

- (BOOL)isRecording {
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = self.locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = self.locationManager.authorizationStatus;
return [CLLocationManager locationServicesEnabled] && (self.locationManager != nil) && (status > kCLAuthorizationStatusDenied);
}

Expand Down
4 changes: 1 addition & 3 deletions ResearchKit/Common/ORKDateTimePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ - (instancetype)initWithAnswerFormat:(ORKAnswerFormat *)answerFormat answer:(id)
- (UIDatePicker *)pickerView {
if (_pickerView == nil) {
_pickerView = [[UIDatePicker alloc] init];
if (@available(iOS 14, *)) {
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
}
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
[_pickerView addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventValueChanged];
self.answerFormat = _answerFormat;
self.answer = _answer;
Expand Down
7 changes: 1 addition & 6 deletions ResearchKit/Common/ORKLocationSelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,7 @@ - (void)showMapViewIfNecessary {

- (void)loadCurrentLocationIfNecessary {
if (_useCurrentLocation) {
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = _locationManager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = _locationManager.authorizationStatus;

if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse) {
_userLocationNeedsUpdate = YES;
Expand Down
10 changes: 3 additions & 7 deletions ResearchKit/Common/ORKTaskViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ - (void)resume {
NSString *allowedAlways = (NSString *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];

if (_manager) {
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;
if (@available(iOS 14, *)) {
status = _manager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}
CLAuthorizationStatus status = _manager.authorizationStatus;

if ((status == kCLAuthorizationStatusNotDetermined) && (allowedWhenInUse || allowedAlways)) {
if (allowedAlways) {
Expand All @@ -133,7 +128,8 @@ - (void)finishWithResult:(BOOL)result {
}
}

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {
CLAuthorizationStatus status = manager.authorizationStatus;
if (_handler && _started && status != kCLAuthorizationStatusNotDetermined) {
[self finishWithResult:(status != kCLAuthorizationStatusDenied)];
}
Expand Down
4 changes: 1 addition & 3 deletions ResearchKit/Common/ORKTimeIntervalPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ - (instancetype)initWithAnswerFormat:(ORKTimeIntervalAnswerFormat *)answerFormat
- (UIView *)pickerView {
if (_pickerView == nil) {
_pickerView = [[ORKDatePicker alloc] init];
if (@available(iOS 14, *)) {
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
}
_pickerView.preferredDatePickerStyle = UIDatePickerStyleWheels;
_pickerView.datePickerMode = UIDatePickerModeCountDownTimer;
[_pickerView addTarget:self action:@selector(valueDidChange:) forControlEvents:UIControlEventValueChanged];
[self setAnswerFormat:_answerFormat];
Expand Down
6 changes: 2 additions & 4 deletions ResearchKitTests/ORKStroopStepTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ - (void)testSometimesAlignmentRandomization {
ORKStroopStep *stroopStep = [[ORKStroopStep alloc] initWithIdentifier:@"testStroop"];
stroopStep.numberOfAttempts = 10;
NSArray<NSNumber *> *probabilitiesToTest = @[@(0.25), @(0.5), @(0.75)];
// test with n = 10,000 and tolerance of 1 %
// Test with n = 10,000 and tolerance of 1.5%.
for (NSNumber *probability in probabilitiesToTest) {
stroopStep.probabilityOfVisualAndColorAlignment = probability;
ORKStroopStepViewController *stroopVC = [[ORKStroopStepViewController alloc] initWithStep:stroopStep];
XCTAssertLessThan(fabs([self realTruesRandomizationTrialForStroopViewController:stroopVC] - probability.doubleValue), 0.01);
XCTAssertLessThan(fabs([self realTruesRandomizationTrialForStroopViewController:stroopVC] - probability.doubleValue), 0.015);
}
}

@end


0 comments on commit 3af47c4

Please sign in to comment.