Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)resetAfterDelay:(NSTimeInterval)delay completion:(nullable void (^)(void
}

-(void)resizeConstraints {
ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([[[UIApplication sharedApplication] delegate] window]);
ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([UIApplication sharedApplication].windows.firstObject);
if (screenType == ORKScreenTypeiPhone5 ) {
NormalizeButtonSize = 70.0;
BackgroundViewSpaceMultiplier = 1.75;
Expand Down
4 changes: 2 additions & 2 deletions ResearchKit/ActiveTasks/ORKStroopContentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ - (instancetype)initWithFrame:(CGRect)frame {
[_colorLabel setFont:[UIFont systemFontOfSize:60]];
[_colorLabel setAdjustsFontSizeToFitWidth:YES];

ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([[[UIApplication sharedApplication] delegate] window]);
ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([UIApplication sharedApplication].windows.firstObject);

if (screenType == ORKScreenTypeiPhone5) {
labelWidth = 200.0;
Expand Down Expand Up @@ -144,7 +144,7 @@ -(void)setupGridButtons {

_buttonStackView.axis = UILayoutConstraintAxisVertical;

ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([[[UIApplication sharedApplication] delegate] window]);
ORKScreenType screenType = ORKGetVerticalScreenTypeForWindow([UIApplication sharedApplication].windows.firstObject);

if (screenType == ORKScreenTypeiPhone6) {
minimumButtonHeight = 150.0;
Expand Down
30 changes: 30 additions & 0 deletions ResearchKit/Common/ORKHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,36 @@ void ORKAdjustHeightForLabel(UILabel *label) {
label.frame = rect;
}

#if TARGET_OS_IOS
UIColor *ORKWindowTintColor(UIWindow *window) {
UIColor *windowTintColor = window.tintColor;
if (!windowTintColor) {
return nil;
}

//Return nil if the window tint color is clear
CGFloat redColor;
CGFloat blueColor;
CGFloat greenColor;
CGFloat alpha;

[window.tintColor getRed:&redColor green:&greenColor blue:&blueColor alpha:&alpha];

if (redColor == 0 && blueColor == 0 && greenColor == 0 && alpha == 0) {
return nil;
}

return windowTintColor;
}

UIColor *ORKViewTintColor(UIView *view) {
UIColor *existingTintColor = view.tintColor ? : [UIColor systemBlueColor];
UIColor *tintColor = ORKWindowTintColor(view.window) ? : existingTintColor;

return tintColor;
}
#endif

UIImage *ORKImageWithColor(UIColor *color) {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
Expand Down
5 changes: 5 additions & 0 deletions ResearchKit/Common/ORKHelpers_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ ORK_EXTERN NSString *ORKFileProtectionFromMode(ORKFileProtectionMode mode);
CGFloat ORKExpectedLabelHeight(UILabel *label);
void ORKAdjustHeightForLabel(UILabel *label);

#if TARGET_OS_IOS
UIColor * _Nullable ORKWindowTintColor(UIWindow *window);
UIColor * ORKViewTintColor(UIView *view);
#endif

// build a image with color
UIImage *ORKImageWithColor(UIColor *color);

Expand Down
9 changes: 8 additions & 1 deletion ResearchKit/Common/ORKNavigationContainerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ - (void)setupViews {
[self arrangeSubStacks];
}

- (void)didMoveToWindow {
_appTintColor = ORKViewTintColor(self);

_cancelButton.normalTintColor = _appTintColor;
_continueButton.normalTintColor = _appTintColor;
_skipButton.normalTintColor = _appTintColor;
}

- (void)setupGrandparentStackView {
if (!_grandparentStackView) {
_grandparentStackView = [[UIStackView alloc] init];
Expand Down Expand Up @@ -351,7 +359,6 @@ - (void)setupSubStackViews {
[_parentStackView addArrangedSubview:subStack];
}
}
_appTintColor = [[UIApplication sharedApplication].delegate window].tintColor;
[self setupContinueButton];
[self setupCancelButton];
[self setupSkipButton];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ + (ORKOrderedTask *)amslerGridTaskWithIdentifier:(NSString *)identifier
intendedUseDescription:(NSString *)intendedUseDescription
options:(ORKPredefinedTaskOption)options {
NSMutableArray *steps = [NSMutableArray array];
UIColor *tintColor = [[[UIApplication sharedApplication] delegate] window].tintColor ? : ORKColor(ORKBlueHighlightColorKey);
UIColor *tintColor = [UIApplication sharedApplication].windows.firstObject.tintColor ? : ORKColor(ORKBlueHighlightColorKey);

if (!(options & ORKPredefinedTaskOptionExcludeInstructions)) {
{
Expand Down