Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point RK to IOS 13 #1499

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions ResearchKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
51751464245A5172009E8FFC /* ORKFrontFacingCameraStepViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 51751462245A5172009E8FFC /* ORKFrontFacingCameraStepViewController.m */; };
51751467245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 51751465245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.h */; };
51751468245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 51751466245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.m */; };
517B96E127ED310E00C29A00 /* ORKTextButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517B96E027ED310E00C29A00 /* ORKTextButtonTests.swift */; };
5185A799227C960500A570DE /* ORKLandoltCStepContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5185A798227C960500A570DE /* ORKLandoltCStepContentView.swift */; };
5190141924759E6800E3A418 /* ORKFrontFacingCameraStepResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 5190141724759E6800E3A418 /* ORKFrontFacingCameraStepResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
5190141A24759E6800E3A418 /* ORKFrontFacingCameraStepResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 5190141824759E6800E3A418 /* ORKFrontFacingCameraStepResult.m */; };
Expand Down Expand Up @@ -1136,6 +1137,7 @@
51751462245A5172009E8FFC /* ORKFrontFacingCameraStepViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKFrontFacingCameraStepViewController.m; sourceTree = "<group>"; };
51751465245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKFrontFacingCameraStepContentView.h; sourceTree = "<group>"; };
51751466245A53D7009E8FFC /* ORKFrontFacingCameraStepContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKFrontFacingCameraStepContentView.m; sourceTree = "<group>"; };
517B96E027ED310E00C29A00 /* ORKTextButtonTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORKTextButtonTests.swift; sourceTree = "<group>"; };
5185A798227C960500A570DE /* ORKLandoltCStepContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORKLandoltCStepContentView.swift; sourceTree = "<group>"; };
5190141724759E6800E3A418 /* ORKFrontFacingCameraStepResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORKFrontFacingCameraStepResult.h; sourceTree = "<group>"; };
5190141824759E6800E3A418 /* ORKFrontFacingCameraStepResult.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ORKFrontFacingCameraStepResult.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2090,6 +2092,7 @@
children = (
14D3F09B225BCA8100A3962D /* ORKBorderedButtonTests.swift */,
148E58C1227B753F00EEF915 /* ORKContinueButtonTests.swift */,
517B96E027ED310E00C29A00 /* ORKTextButtonTests.swift */,
);
name = ORKButtonTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -4669,6 +4672,7 @@
FA7A9D371B09365F005A2BEA /* ORKConsentSectionFormatterTests.m in Sources */,
714151D0225C4A23002CA33B /* ORKPasscodeViewControllerTests.swift in Sources */,
14E79040226A5F72009D8083 /* ORKStepViewControllerHelpers.swift in Sources */,
517B96E127ED310E00C29A00 /* ORKTextButtonTests.swift in Sources */,
86D348021AC161B0006DB02B /* ORKRecorderTests.m in Sources */,
1490DCFC224D4867003FEEDA /* ORKEnvironmentSPLMeterResultTests.swift in Sources */,
7141EA2222EFBC0C00650145 /* ORKLoggingTests.m in Sources */,
Expand Down Expand Up @@ -5213,7 +5217,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -5282,7 +5286,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -5389,8 +5393,9 @@
GCC_WARN_UNUSED_LABEL = YES;
INFOPLIST_FILE = ResearchKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 2.1.0;
MODULEMAP_FILE = ResearchKit/ResearchKit.modulemap;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -5436,8 +5441,9 @@
GCC_WARN_UNUSED_LABEL = YES;
INFOPLIST_FILE = ResearchKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 2.1.0;
MODULEMAP_FILE = ResearchKit/ResearchKit.modulemap;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "org.researchkit.${PRODUCT_NAME:rfc1034identifier}";
Expand Down
12 changes: 8 additions & 4 deletions ResearchKit/ActiveTasks/ORKFrontFacingCameraStepContentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,14 @@ - (instancetype)initWithTitleText:(nullable NSString *)titleText detailText:(nul
- (void)setupSubviews {
_startStopButton = [UIButton new];

UIButtonConfiguration *buttonConfiguration = [UIButtonConfiguration plainButtonConfiguration];
[buttonConfiguration setContentInsets:NSDirectionalEdgeInsetsMake(0, 6, 0, 6)];

[_startStopButton setConfiguration:buttonConfiguration];
if (@available(iOS 15.0, *)) {
UIButtonConfiguration *buttonConfiguration = [UIButtonConfiguration plainButtonConfiguration];
[buttonConfiguration setContentInsets:NSDirectionalEdgeInsetsMake(0, 6, 0, 6)];
[_startStopButton setConfiguration:buttonConfiguration];
} else {
_startStopButton.contentEdgeInsets = (UIEdgeInsets){.left = 6, .right = 6};
}

_startStopButton.layer.cornerRadius = 14.0;
_startStopButton.clipsToBounds = YES;

Expand Down
21 changes: 18 additions & 3 deletions ResearchKit/ActiveTasks/ORKLocationRecorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,16 @@ - (void)start {
}

self.locationManager = [self createLocationManager];

if (self.locationManager.authorizationStatus == kCLAuthorizationStatusRestricted || self.locationManager.authorizationStatus == kCLAuthorizationStatusNotDetermined) {

CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;

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

if (status == kCLAuthorizationStatusRestricted || status == kCLAuthorizationStatusNotDetermined) {
[self.locationManager requestWhenInUseAuthorization];
}
self.locationManager.pausesLocationUpdatesAutomatically = NO;
Expand Down Expand Up @@ -157,8 +165,15 @@ - (void)finishRecordingWithError:(NSError *)error {
}

- (BOOL)isRecording {
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;

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

return [CLLocationManager locationServicesEnabled] && (self.locationManager != nil) && (self.locationManager.authorizationStatus > kCLAuthorizationStatusDenied);
return [CLLocationManager locationServicesEnabled] && (self.locationManager != nil) && (status > kCLAuthorizationStatusDenied);
}

- (void)reset {
Expand Down
6 changes: 1 addition & 5 deletions ResearchKit/Common/ORKCollector.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_OBJ_CLASS(aDecoder, correlationType, HKCorrelationType);

{
NSSet<Class> *allowedClasses = [NSSet setWithObjects:HKSampleType.self, nil];
_sampleTypes = [aDecoder decodeArrayOfObjectsOfClasses:allowedClasses forKey:@ORK_STRINGIFY(sampleTypes)];
}
ORK_DECODE_OBJ_ARRAY(aDecoder, sampleTypes, HKSampleType);
ORK_DECODE_OBJ_ARRAY(aDecoder, units, HKUnit);
ORK_DECODE_OBJ_CLASS(aDecoder, startDate, NSDate);
ORK_DECODE_OBJ_CLASS(aDecoder, lastAnchor, HKQueryAnchor);
Expand Down
1 change: 0 additions & 1 deletion ResearchKit/Common/ORKCustomSignatureFooterView.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak, nullable) id<ORKSignatureViewDelegate> signatureViewDelegate;
@property (nonatomic, weak, nullable) id<ORKCustomSignatureAccessoryViewProvider> customViewProvider;
@property (nonatomic, weak, nullable) id<ORKCustomSignatureFooterViewStatusDelegate> delegate;
@property (nonatomic) BOOL enabled;

- (BOOL)isComplete;

Expand Down
4 changes: 0 additions & 4 deletions ResearchKit/Common/ORKCustomSignatureFooterView.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ - (void)configureConstraints {
[self setNeedsLayout];
}

- (void)setEnabled:(BOOL)enabled {
[_signatureView setEnabled:enabled];
}

- (void)setSignatureViewDelegate:(id<ORKSignatureViewDelegate>)signatureViewDelegate {
_signatureViewDelegate = signatureViewDelegate;
_signatureView.delegate = signatureViewDelegate;
Expand Down
9 changes: 9 additions & 0 deletions ResearchKit/Common/ORKDataCollectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,13 @@ ORK_CLASS_AVAILABLE

@end

ORK_CLASS_AVAILABLE
@interface ORKDataCollectionState : NSObject <NSSecureCoding>

@property(nonatomic, nullable, readwrite) NSString *archiveVersion;

@property(nonatomic, nonnull, readwrite) NSArray<ORKCollector *> *collectors;

@end

NS_ASSUME_NONNULL_END
15 changes: 2 additions & 13 deletions ResearchKit/Common/ORKDataCollectionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#import <HealthKit/HealthKit.h>


@interface ORKDataCollectionState : NSObject <NSSecureCoding>

@property(nonatomic, nullable, readwrite) NSString *archiveVersion;

@property(nonatomic, nonnull, readwrite) NSArray<ORKCollector *> *collectors;

@end


// The file names for persisting the state of our collectors
static NSString *const ORKDataCollectionPersistenceFileNamev1 = @".dataCollection.ork.data"; // pre-secureCoding
static NSString *const ORKDataCollectionPersistenceFileNamev2 = @".dataCollection.ork.archive"; // current
Expand Down Expand Up @@ -388,10 +379,8 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {

self = [super init];

NSSet<Class> *decodableClasses = [NSSet setWithObjects:
ORKCollector.self,
nil];
_collectors = [aDecoder decodeArrayOfObjectsOfClasses:decodableClasses forKey:@ORK_STRINGIFY(collectors)];

ORK_DECODE_OBJ_ARRAY(aDecoder, collectors, ORKCollector);
ORK_DECODE_OBJ_CLASS(aDecoder, archiveVersion, NSString);

return self;
Expand Down
11 changes: 7 additions & 4 deletions ResearchKit/Common/ORKLearnMoreView.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ + (instancetype)learnMoreCustomButtonWithText:(NSString *)text {
button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
button.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;

UIButtonConfiguration *buttonConfig = [UIButtonConfiguration filledButtonConfiguration];
[buttonConfig setContentInsets:NSDirectionalEdgeInsetsMake(0, 0, 0, 0)];

[button setConfiguration:buttonConfig];
if (@available(iOS 15.0, *)) {
UIButtonConfiguration *buttonConfig = [UIButtonConfiguration filledButtonConfiguration];
[buttonConfig setContentInsets:NSDirectionalEdgeInsetsMake(0, 0, 0, 0)];
[button setConfiguration:buttonConfig];
} else {
[button setContentEdgeInsets:UIEdgeInsetsMake(CGFLOAT_MIN, CGFLOAT_MIN, CGFLOAT_MIN, CGFLOAT_MIN)];
}

return button;
}
Expand Down
8 changes: 7 additions & 1 deletion ResearchKit/Common/ORKLocationSelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ - (void)showMapViewIfNecessary {

- (void)loadCurrentLocationIfNecessary {
if (_useCurrentLocation) {
CLAuthorizationStatus status = _locationManager.authorizationStatus;
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;

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

if (status == kCLAuthorizationStatusAuthorizedAlways || status == kCLAuthorizationStatusAuthorizedWhenInUse) {
_userLocationNeedsUpdate = YES;
Expand Down
1 change: 0 additions & 1 deletion ResearchKit/Common/ORKSignatureView.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, strong, nullable) UIColor *lineColor;
@property (nonatomic) CGFloat lineWidth;
@property (nonatomic) BOOL enabled;

/**
lineWidthVariation defines the max amount by which the line
Expand Down
5 changes: 0 additions & 5 deletions ResearchKit/Common/ORKSignatureView.m
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,6 @@ - (void)cancelAutoScrollTimer {
[(ORKSignatureGestureRecognizer *)_signatureGestureRecognizer cancelAutoScrollTimer];
}

- (void)setEnabled:(BOOL)enabled {
_enabled = enabled;
[self setUserInteractionEnabled:enabled];
}

#pragma mark - Accessibility

- (BOOL)isAccessibilityElement {
Expand Down
24 changes: 22 additions & 2 deletions ResearchKit/Common/ORKTaskViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ - (void)resume {
NSString *allowedAlways = (NSString *)[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"];

if (_manager) {
CLAuthorizationStatus status = _manager.authorizationStatus;
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;

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

if ((status == kCLAuthorizationStatusNotDetermined) && (allowedWhenInUse || allowedAlways)) {
if (allowedAlways) {
[_manager requestAlwaysAuthorization];
Expand All @@ -126,13 +133,26 @@ - (void)finishWithResult:(BOOL)result {
}

- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {
CLAuthorizationStatus status = manager.authorizationStatus;
CLAuthorizationStatus status = kCLAuthorizationStatusNotDetermined;

if (@available(iOS 14.0, *)) {
status = manager.authorizationStatus;
} else {
status = [CLLocationManager authorizationStatus];
}

if (_started && status != kCLAuthorizationStatusNotDetermined) {
[self finishWithResult:(status != kCLAuthorizationStatusDenied)];
}
}

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if (_started && status != kCLAuthorizationStatusNotDetermined) {
[self finishWithResult:(status != kCLAuthorizationStatusDenied)];
}
}


@end


Expand Down
8 changes: 5 additions & 3 deletions ResearchKit/Common/ORKTextButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ - (void)tintColorDidChange {
}

- (void)updateContentInsets:(NSDirectionalEdgeInsets)contentInsets {
UIButtonConfiguration *buttonConfiguration = [UIButtonConfiguration plainButtonConfiguration];
[buttonConfiguration setContentInsets:contentInsets];
[self setConfiguration:buttonConfiguration];
if (@available(iOS 15.0, *)) {
UIButtonConfiguration *buttonConfiguration = [UIButtonConfiguration plainButtonConfiguration];
[buttonConfiguration setContentInsets:contentInsets];
[self setConfiguration:buttonConfiguration];
}
}

- (void)updateAppearance {
Expand Down
13 changes: 1 addition & 12 deletions ResearchKit/Common/ORKWebViewStepViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,24 +432,13 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati

// MARK: UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
BOOL enabled = [self shouldEnableSignatureView] && scrollView.isDecelerating;
[_signatureView setEnabled:enabled];

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if ([_scrollView.panGestureRecognizer translationInView:_scrollView.superview].y > 0) {
// Scrolling upward
[_signatureView cancelAutoScrollTimer];
}
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[_signatureView setEnabled:[self shouldEnableSignatureView]];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[_signatureView setEnabled:[self shouldEnableSignatureView]];
}

- (BOOL)shouldEnableSignatureView {
CGFloat bottomOfSignature = _signatureView.frame.size.height + _signatureView.frame.origin.y;
CGFloat signaturePosition = _scrollView.contentOffset.y + _scrollView.frame.size.height;
Expand Down
2 changes: 1 addition & 1 deletion ResearchKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down