Compare commits

...

1821 Commits

Author SHA1 Message Date
Akshay 6f2ac3f671 Fixes 2017-07-13 11:19:33 -07:00
Akshay 007583929c Convergence 2017-07-06 18:08:13 -07:00
Akshay c97d6bd78c Convergence 2017-07-06 15:33:24 -07:00
Umer Khan 6089b09963 Merge pull request #853 from ryanschneider/podspec-fix
Fix typo in podspec version quoting characters.
2016-10-27 14:42:33 -07:00
Ryan Schneider 87a7a6a718 Fix typo in podspec version quoting characters. 2016-10-27 11:26:15 -07:00
Umer Khan c1493b9c5c Merge pull request #851 from ResearchKit/podspec
Podspec
2016-10-26 13:09:39 -07:00
Umer Khan d47e835e8e Merge branch 'master' into podspec
* master:
  convergence
  Update pod spec version number.
  Declare ORKScrollToTopAnimationDuration and ORKCGFloatInvalidValue as extern in ORKHelpers.h; fixes #679
2016-10-26 13:08:56 -07:00
Umer Khan 4b456ad2bb Merge pull request #850 from ResearchKit/stable
Stable
2016-10-26 12:48:49 -07:00
Umer Khan 125ff93795 Updating podspec 2016-10-26 12:40:56 -07:00
Umer Khan 2a1bbeefe8 Merge branch 'master' into stable
* master: (346 commits)
  Updating podspec.
  Convergence
  Fixed width constraint priority
  Make ORKInstructionStepViewController and ORKCompletionStepViewController public
  Add comment to the aux image.
  Add example use of the auxillary image.
  created the touchIdEnabled serializable encoding, confirm all tests pass
  Typo in function name
  Add ORKTappingButtonIdentifier rather than NSInteger
  added taskViewController didChangeResult implementation example to show how to get the ORKPasscodeResult information in the delegate
  Fix merge errors
  as per PR comment edited the ORKPasscodeResult to handle a new boolean property touchIdEnabled, in encoding/decoding, copying, and description
  removed the forced taskViewController delegate call from the ORKPasscodeStepViewCOntroller as its already calling it on its own, so no need for double
  added the delegate call when the prompt for touchID call is complete
  Erased asterisk/pointer from my last pull request
  Fixing bug where timer label did not display
  invalid pointer updates (warning fixes)
  Fix documentation typo
  Update ORKPicker.m
  Documented the ORKPicker functions.
  ...

# Conflicts:
#	ResearchKit.podspec
#	ResearchKit/ResearchKit.h
#	ResearchKit/ResearchKit_Private.h
2016-10-26 12:36:20 -07:00
Umer Khan ddc023fd4c Merge pull request #849 from ResearchKit/podspec
Updating podspec.
2016-10-26 11:31:58 -07:00
Umer Khan 160bb111f0 Updating podspec. 2016-10-26 11:31:36 -07:00
Yuan Zhu 30742a5043 convergence 2016-09-27 13:42:56 -07:00
Yuan Zhu ead0650dfb Convergence 2016-09-26 22:23:17 -07:00
Yuan Zhu 4f3d0f33df Merge pull request #803 from Sage-Bionetworks/pr/public-ORKCompletionStepViewController
Make ORKInstructionStepViewController and ORKCompletionStepViewController public
2016-08-30 13:14:46 -07:00
Yuan Zhu 608d954197 Merge pull request #806 from asynchrony/fixed_width_constraint
Fixed width constraint priority
2016-08-30 10:25:18 -07:00
Joe Carroll 74326baef4 Fixed width constraint priority 2016-08-30 12:16:19 -05:00
Shannon Young 5b1abe95c5 Make ORKInstructionStepViewController and ORKCompletionStepViewController public
We use a custom subclass of ORKInstructionStep which uses a custom implementation for learn more actions. By publicly exposing these view controllers, we can return the appropriate view controller (or subclass).
2016-08-25 15:37:48 -07:00
Yuan Zhu fe9c9e1fc5 Merge pull request #752 from Sage-Bionetworks/pr/add-module-hand-tremor
Add Hand Tremor Module
2016-08-24 11:06:16 -07:00
Shannon Young b8b7b80f09 Add comment to the aux image. 2016-08-26 10:46:57 -07:00
Umer Khan 1bcc12bd80 Merge pull request #792 from boland25/feature/touchIDReportResults
Feature/touch ID report results of if touchID was chosen in Passcode Setup
2016-08-22 14:21:40 -07:00
Shannon Young eb9464b6ce Add example use of the auxillary image. 2016-08-22 11:09:42 -07:00
Yuan Zhu c476ad838e Merge pull request #798 from gmw/master
Typo in function name
2016-08-22 10:06:28 -07:00
Gregory Boland c167e4d84c created the touchIdEnabled serializable encoding, confirm all tests pass 2016-08-22 11:01:15 -04:00
Magnus Wissler 77eb12636a Typo in function name 2016-08-21 12:02:11 +02:00
Umer Khan 27f4197374 Merge pull request #654 from m1entus/master
Adding tap duration to Tapping Task Issue #561
2016-08-19 12:47:11 -07:00
Michal Zaborowski 34f473d8e5 Add ORKTappingButtonIdentifier rather than NSInteger 2016-08-19 20:47:01 +02:00
Gregory Boland 42b9907579 added taskViewController didChangeResult implementation example to show how to get the ORKPasscodeResult information in the delegate 2016-08-17 10:08:15 -04:00
Shannon Young 67a04562d6 Fix merge errors 2016-08-16 13:15:51 -07:00
Shannon Young f86668e8cb Merge branch 'master' into pr/add-module-hand-tremor 2016-08-16 12:46:10 -07:00
Yuan Zhu 33ca348856 Merge pull request #770 from rsanchezsaez/rsanchezsaez-charts
[Charts] Fix crashes
2016-08-16 12:22:22 -07:00
Gregory Boland bccef20ce5 as per PR comment edited the ORKPasscodeResult to handle a new boolean property touchIdEnabled, in encoding/decoding, copying, and description 2016-08-16 15:00:53 -04:00
Yuan Zhu 0f92862e52 Merge pull request #772 from md0u80c9/funcComments
Documented the ORKPicker functions.
2016-08-16 11:24:34 -07:00
Yuan Zhu c7a8cdd2c0 Merge pull request #764 from dephillipsmichael/bad_access_fix
bad_access_fix
2016-08-16 11:22:19 -07:00
Yuan Zhu 75142028b0 Merge pull request #648 from rsanchezsaez/rsanchezsaez-CodeHomogenization2
[Misc] #import section refactor to reduce header interdependency
2016-08-16 11:20:48 -07:00
Yuan Zhu d618d45635 Merge pull request #647 from weijentu/master
ORKQuestionResult could get truncated Chinese texts
2016-08-16 11:04:20 -07:00
Yuan Zhu 7a33c6b4a7 Merge pull request #789 from phantomkirby/patch-2
Erased asterisk/pointer from my last pull request
2016-08-16 10:46:50 -07:00
Gregory Boland add20301a1 removed the forced taskViewController delegate call from the ORKPasscodeStepViewCOntroller as its already calling it on its own, so no need for double 2016-08-16 11:48:22 -04:00
Gregory Boland fbc4dde858 added the delegate call when the prompt for touchID call is complete 2016-08-16 11:38:44 -04:00
Ricardo Sánchez-Sáez 18b6557cf3 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-CodeHomogenization2
# Conflicts:
#	ResearchKit/Charts/ORKGraphChartView.m
2016-08-13 10:56:09 -07:00
Cherry c195cf1a16 Erased asterisk/pointer from my last pull request
In my last pull request (#788) that was merged, I forgot to delete the "*" symbol. This actually caused the build to fail. The build should work now. Sorry about this!
2016-08-12 21:10:56 -04:00
Yuan Zhu 6679fb0922 Merge pull request #787 from 2020Deception/master
invalid pointer updates (warning fixes)
2016-08-12 15:23:46 -07:00
Yuan Zhu 740051812a Merge pull request #788 from phantomkirby/patch-1
Fixing bug where timerLabel did not display in ORKFitnessStep
2016-08-12 14:34:45 -07:00
Cherry 5c602d7850 Fixing bug where timer label did not display
in the updateTimerLabel function, the timer would be hidden if the labelString was null. The labelString was null everytime because the "formatter" object (an NSDateComponentsFormatter object) was null the whole time. This object was null because inside the "dispatch_once", we did not reference/edit the existing static formatter object outside of the dispatch_once, but rather, we instantiated a new formatter object.
2016-08-12 14:27:42 -04:00
Brian Bowman 0b4b2ae6e5 invalid pointer updates (warning fixes) 2016-08-12 11:41:02 -04:00
Yuan Zhu 0efee740e4 Merge pull request #778 from YuanZhu-apple/master_sliderGradient
Displaying a color gradient above the scale slider
2016-08-04 14:09:38 -07:00
Yuan Zhu 856d544fad Merge pull request #777 from YuanZhu-apple/master_lineGraphHideDots
Line graph hide dots
2016-08-04 14:09:03 -07:00
Yuan Zhu c257751d1d Merge pull request #776 from YuanZhu-apple/master_result_predicate_for_consentReviewStep
Result predicate for consent review step
2016-08-04 14:08:32 -07:00
Yuan Zhu 81e879e8f6 Merge pull request #775 from YuanZhu-apple/master_piechart_scale_factor
Piechart add scale factor support
2016-08-04 14:08:12 -07:00
Yuan Zhu ddeed599df Merge pull request #773 from ThreadResearch/master
Fix documentation typo
2016-08-01 13:44:03 -07:00
Jake Krog 65f525ff38 Fix documentation typo 2016-08-01 11:32:10 -07:00
Andrew Hill 60bfacf507 Merge remote-tracking branch 'origin/funcComments' into funcComments 2016-08-01 18:35:13 +01:00
Andrew Hill 0eae7e87f7 Update ORKPicker.m
Fixed a conflict.
2016-08-01 18:23:58 +01:00
Andrew Hill 26597eb334 Merge branch 'master' into funcComments 2016-08-01 18:21:32 +01:00
Andrew Hill 44c5535a8d Merge remote-tracking branch 'ResearchKit/master' into funcComments
# Conflicts:
#	ResearchKit/Common/ORKPicker.m
2016-08-01 18:14:35 +01:00
Andrew Hill d06f070e83 Documented the ORKPicker functions. 2016-07-31 23:48:27 +01:00
Andrew Hill 633d31be97 Merge branch 'ResearchKit/master' 2016-07-30 00:23:15 +01:00
Ricardo Sánchez-Sáez 6936eb34ac [ORKPieChartPieView] Add support for segments of 0 value
Avoids crash if the dataSource returns 0 for any segment value.
2016-07-29 23:40:40 +01:00
Ricardo Sánchez-Sáez 40891abb63 [ORKGraphChartView] Make '-numberOfPlotsInGraphChartView' non-optional and make it default to 0 plots.
Avoids crash if the graph chart view is laid out before the dataSource is set.
2016-07-29 23:26:23 +01:00
Yuan Zhu f9b8e39876 Adds support for displaying a color gradient above the slider for scale answer formats.
In the simple case this can be used to show a scale from bad to good by setting.
2016-07-25 17:05:17 -07:00
Yuan Zhu e14d327e3b Adds support for drawing plots within a chart without individual data point indicators. 2016-07-25 13:58:48 -07:00
Ricardo Sánchez-Sáez b9bcd6713c Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-CodeHomogenization2
# Conflicts:
#	ResearchKit.xcodeproj/project.pbxproj
#	ResearchKit/ActiveTasks/ORKCountdownStep.h
#	ResearchKit/Charts/ORKDiscreteGraphChartView.m
#	ResearchKit/Charts/ORKGraphChartView.m
#	ResearchKit/Charts/ORKGraphChartView_Internal.h
#	ResearchKit/Charts/ORKLineGraphChartView.m
#	ResearchKit/Charts/ORKPieChartLegendView.m
#	ResearchKit/Charts/ORKPieChartView.m
#	ResearchKit/Charts/ORKRangedPoint.h
#	ResearchKit/Charts/ORKRangedPoint.m
#	ResearchKit/Common/ORKAnswerFormat.h
#	ResearchKit/Common/ORKAnswerFormat_Internal.h
#	ResearchKit/Common/ORKAnswerTextView.m
#	ResearchKit/Common/ORKCompletionStep.h
#	ResearchKit/Common/ORKFormStep.m
#	ResearchKit/Common/ORKHeightPicker.h
#	ResearchKit/Common/ORKInstructionStep.h
#	ResearchKit/Common/ORKNavigableOrderedTask.m
#	ResearchKit/Common/ORKOrderedTask.m
#	ResearchKit/Common/ORKPasscodeStepViewController.m
#	ResearchKit/Common/ORKSignatureStepViewController.h
#	ResearchKit/Common/ORKSignatureStepViewController.m
#	ResearchKit/Common/ORKStepViewController.h
#	ResearchKit/Common/ORKTextButton.h
#	ResearchKit/Common/ORKTextFieldView.m
#	ResearchKit/Common/ORKTypes.h
#	ResearchKit/Consent/ORKConsentReviewStepViewController.m
#	ResearchKit/ResearchKit.h
#	ResearchKit/ResearchKit_Private.h
#	ResearchKitTests/ORKAnswerFormatTests.m
#	Testing/ORKTest/ORKTest/Charts/Charts.storyboard
#	Testing/ORKTest/ORKTest/DragonPokerStep.m
2016-07-25 21:52:13 +01:00
Yuan Zhu bc2801bb9e Result predicate for ORKConsentReviewStep
Add a result predicate for determining if the user selected accept or decline in a consent signature step, allowing for custom navigation rules, such as skipping to the end of a survey if the user does not consent.
2016-07-25 12:47:14 -07:00
Yuan Zhu ba78feb4dd Providing a scale factor property in ORKPieChartView. 2016-07-25 12:36:56 -07:00
MDP 56a8bc1db3 added check if weak self vc has been dismissed 2016-07-18 14:28:02 -04:00
Ricardo Sánchez-Sáez e86ef34a75 Merge branch 'master' of github.com:rsanchezsaez/ResearchKit into rsanchezsaez-CodeHomogenization2
# Conflicts:
#	ResearchKit/Common/ORKSurveyAnswerCellForText.m
#	ResearchKit/Common/ORKTextFieldView.m
2016-07-14 23:58:01 +01:00
Shannon Young 912a8112fb Fix warning in ORKHeightAnswerFormat due to failure to properly cast 2016-07-11 15:04:58 -07:00
Shannon Young 27644a292c Fix merge conflicts 2016-07-11 15:04:19 -07:00
Shannon Young 3f2cb32b23 Merge branch 'master' into pr/add-module-hand-tremor
# Conflicts:
#	ResearchKit/Common/ORKOrderedTask.m
#	ResearchKit/Common/ORKSkin.m
2016-07-11 14:56:27 -07:00
Yuan Zhu d84944ac6a Merge pull request #702 from stevemoser/ipad-pro-12-9-support
Support for 12.9 inch iPad Pro
2016-07-11 12:54:15 -07:00
Yuan Zhu ebfbfcb900 Merge pull request #637 from rsanchezsaez/rsanchezsaez-CodeHomogenization
[Misc] Code homogenization
2016-07-11 12:49:30 -07:00
Ricardo Sánchez-Sáez 3bd27d6ebe Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-CodeHomogenization
# Conflicts:
#	ResearchKit/Common/ORKAnswerFormat.m
#	ResearchKit/Common/ORKAnswerFormat_Internal.h
#	ResearchKit/Common/ORKDefines.h
#	ResearchKit/Common/ORKHealthAnswerFormat.m
#	ResearchKit/Common/ORKHelpers.h
#	ResearchKit/Common/ORKQuestionStepViewController.m
2016-07-09 19:42:16 +02:00
Yuan Zhu e11440b036 Merge pull request #643 from rsanchezsaez/rsanchezsaez-ORKHeightAnswerFormat
[ORKAnswerFormat] Implement picker-based 'ORKHeightAnswerFormat'
2016-07-08 10:41:15 -07:00
Andrew Hill fdedb11fea Merge branch 'ResearchKit/master' 2016-07-08 17:09:29 +01:00
Ricardo Sánchez-Sáez 72a665b961 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-CodeHomogenization
# Conflicts:
#	ResearchKit/Consent/ORKConsentReviewStepViewController.m
2016-07-08 15:07:21 +02:00
Ricardo Sánchez-Sáez cfe04441ad Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-CodeHomogenization
# Conflicts:
#	ResearchKit.xcodeproj/project.pbxproj
#	ResearchKit/ActiveTasks/ORKHealthQuantityTypeRecorder.m
#	ResearchKit/Charts/ORKGraphChartView.m
#	ResearchKit/Charts/ORKRangedPoint.m
#	ResearchKit/Common/ORKHealthAnswerFormat.m
#	ResearchKit/Common/ORKNavigableOrderedTask.m
#	ResearchKit/Common/ORKOrderedTask.m
#	ResearchKit/Common/ORKPasscodeStepViewController.m
#	ResearchKit/Common/ORKSurveyAnswerCellForText.m
#	ResearchKit/Common/ORKTextButton.h
#	ResearchKit/Common/ORKTextFieldView.m
#	Testing/ORKTest/ORKTestTests/ORKJSONSerializationTests.m
2016-07-08 15:05:24 +02:00
Ricardo Sánchez-Sáez 7fe3e227ad [ORKHeightPicker] Fix issue returning empty 'selectedLabelText' 2016-07-08 13:34:17 +02:00
Yuan Zhu 4d8f4f3bb1 Merge pull request #753 from Sage-Bionetworks/pr/fix-signature-warning
Fix cast warning introduced with ORKSignatureResult
2016-07-07 15:39:47 -07:00
Shannon Young e29e7f2b73 Fix cast warning introduced with ORKSignatureResult 2016-07-07 13:24:25 -07:00
Allen Tu f2e133676b Merge remote-tracking branch 'ResearchKit/master' 2016-07-07 11:09:11 -07:00
Shannon Young 0c898b4abb Language updates to more closely match the wording approved by our IRB. 2016-07-07 10:26:22 -07:00
Ricardo Sánchez-Sáez c1fa1ea154 [ORKHeightPicker] Use cm as the internal answer unit regardless of chosen locale 2016-07-07 18:08:38 +02:00
Ricardo Sánchez-Sáez f659531d77 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-ORKHeightAnswerFormat
# Conflicts:
#	ResearchKit/Common/ORKHealthAnswerFormat.m
#	ResearchKit/Localized/en.lproj/ResearchKit.strings
2016-07-07 17:50:54 +02:00
Ricardo Sánchez-Sáez 6e22f94cf5 [ORKHeightPicker] Fix previous answer not being remembered
The _answerFormat ivar needs to be properly set before for the self.answer setter to work correctly.
2016-07-07 17:30:42 +02:00
Ricardo Sánchez-Sáez 88c7c87f28 [ORKHeightAnswerFormat] Fix documentation 2016-07-07 17:29:38 +02:00
Ricardo Sánchez-Sáez 6a9da73a8a [ORKCatalog] Add metric and USC height question step samples 2016-07-07 17:29:24 +02:00
Shannon Young 0f0448bff7 Fix ORKCatalog for updated tremor module 2016-07-07 00:28:21 -07:00
Shannon Young fd2c914b68 Add navigation rules to allow user to skip the steps for one hand. 2016-07-07 00:06:05 -07:00
Shannon Young 5122948de0 Add Tremot task to ORKTest 2016-07-06 16:51:25 -07:00
Erin-Mounts 19d3624658 Two-handed tremor task 2016-07-06 16:46:03 -07:00
Erin Mounts 4f68c2bf4e Allow excluding some active tasks from tremor test 2016-07-06 16:46:02 -07:00
Shannon Young 9e1ed9e070 Add initial tremor module 2016-07-06 16:46:01 -07:00
Shannon Young 9fb7562ce5 Add an auxillary image to the instruction view.
This is used in the tremor module to show a second image.
2016-07-06 16:46:01 -07:00
Yuan Zhu b1b25f9ac4 Merge pull request #751 from Sage-Bionetworks/pr/ui-public-signature-step
Add public ORKSignatureStep
2016-07-06 16:27:46 -07:00
Shannon Young a5b58c4c8e Add signaturePath to list of knownNotSerializedProperties 2016-07-06 16:23:31 -07:00
Yuan Zhu 66c7b86484 Merge pull request #743 from Sage-Bionetworks/pr/add-module-bilateral-tapping
Add task module for measuring bilateral tapping speed
2016-07-06 16:01:12 -07:00
Shannon Young 7b850951ef More syntax changes 2016-07-06 15:45:48 -07:00
Shannon Young bd5f5bb231 Retain signature state on back navigation 2016-07-06 15:44:16 -07:00
Shannon Young 2526450391 More syntax cleanup. 2016-07-06 15:11:06 -07:00
Shannon Young 289a45c3dd Change undefined hand to unspecified. 2016-07-06 14:38:35 -07:00
Shannon Young 931c7d7728 More curly brace changes. 2016-07-06 12:06:15 -07:00
Shannon Young 6d52269995 Fixed syntax, updated copyright and fixed localized formatting. 2016-07-06 11:49:25 -07:00
Shannon Young f69401cae9 Added task for showing just the signature step to ORKTest
Note: ORKCatalog uses this step in the consent flow example and displays the result.
2016-07-06 11:42:41 -07:00
Shannon Young 3d57bf65b8 Moved ORKSignatureStep into Common 2016-07-06 11:21:25 -07:00
Shannon Young e7b75b5f88 Move default title/text for signature to ORKSignatureStep 2016-07-06 09:29:55 -07:00
Shannon Young 590bb25559 Update text for tapping skip button and hide once tapping started. 2016-07-05 21:59:11 -07:00
Shannon Young f7345070a9 Add public ORKSignatureStep
Change the consent signature view controller to a step view controller that is instantiated using an ORKSignatureStep and outputs an ORKSignatureResult. This will allow for customization of the consent process and use of the signature gathering step in other task work flows.
2016-07-05 17:36:42 -07:00
Yuan Zhu 558b5391a3 Merge pull request #732 from Sage-Bionetworks/pr/ui-add-ORKStepTableViewController
Added a general purpose step table view controller
2016-07-05 15:10:28 -07:00
Shannon Young 4ea6fc7d46 Updated comment in ORKTableStep 2016-07-05 14:51:05 -07:00
Shannon Young 2289b01f7c Modified method signature for bilateral tapping task and updated ORKTest and ORKCatalog 2016-07-05 14:35:02 -07:00
Shannon Young 4899548438 Deprecated two-finger tapping test without hand specified 2016-07-05 14:25:37 -07:00
Shannon Young bcc85b9a2c Updated tapping unit test to explicitly check for reverse-compatibility 2016-07-05 14:23:54 -07:00
Shannon Young 613d3a676c Move the two-handed tapping test into ResearchKit
# Conflicts:
#	ResearchKitTests/ORKTaskTests.m
2016-07-05 14:23:54 -07:00
Shannon Young e5fa2374ab Add UIImage method for mirroring a collection of images
This is a utility method for flipping an image so that the same image can be used in both left-hand and right-hand orientations.
2016-07-05 14:21:01 -07:00
Erin Mounts 859bbb4e17 Modifications to ORKTappingContentView to support resizing the view if skippable.
cherry-pick d5011e37606365f794c377dad45e73a721d6db00 (with some manual intervention because of massive changes to ORKTappingContentView in RK 1.3)
2016-07-05 14:21:01 -07:00
Shannon Young 9fe59ca7a8 Default ORKTableStepViewController to allowsSelection=NO and simplify cell registration. 2016-07-05 14:19:50 -07:00
Shannon Young b3d72ce28a Add ORKTableStep with a default implementation for supporting a basic data source 2016-07-05 14:19:50 -07:00
Shannon Young e421214098 Add to the comments describing intended usage of this class. 2016-07-05 14:18:57 -07:00
Shannon Young 53e19548c4 Edited comments 2016-07-05 14:18:57 -07:00
Shannon Young f3fdb66cf8 Added comments and updated copyright. 2016-07-05 14:18:57 -07:00
Shannon Young ead682b402 Add files to project and update copyright date 2016-07-05 14:18:57 -07:00
Erin Mounts aeb3849fd7 Make ORKTableStepViewController visible...
...in release builds (RK sets symbols to hidden by default in release builds)
2016-07-05 14:18:57 -07:00
Shannon Young b9af6508ac Added a general purpose step table view controller 2016-07-05 14:18:57 -07:00
Yuan Zhu 2ff97e4558 Merge pull request #747 from Sage-Bionetworks/pr/add-module-walk-back-and-forth
Add module for walking back and forth
2016-07-05 14:17:05 -07:00
Shannon Young 26da4d8e34 Added serialized properties on ORKActiveStep to ORKTest 2016-07-05 13:53:15 -07:00
Shannon Young 6ee2b47dc1 Updated copyright and halfway count property name 2016-07-05 13:37:29 -07:00
Shannon Young 84f806ee11 Add walk back and forth task to ORKTest 2016-07-05 12:58:26 -07:00
Shannon Young a24dc1ac56 Added unit tests to check the identifiers and half-way spoken count. 2016-07-05 12:57:29 -07:00
Erin Mounts c3618bb104 update pocket image. phone should be inserted speaker-side-out 2016-07-05 12:56:37 -07:00
Shannon Young 119b5f19d2 Add halfway spoken instruction to countdown for walking back and forth 2016-07-05 12:56:37 -07:00
Shannon Young 5195ed44f1 Add back-and-forth walking task 2016-07-05 12:56:37 -07:00
Shannon Young 755db8b700 Add finishedSpokenInstruction to active step
The finished spoken instruction property allows a step to announce that it is completed. This is useful in the case where the phone screen is not visible such as a walking activity (where the phone is in the participant's phone) or a hand tremor measurement (where the screen is not facing the participant).
2016-07-05 12:56:37 -07:00
Yuan Zhu 3d95111ace Merge pull request #735 from Sage-Bionetworks/pr/method-add-stepvc-init
Allow steps to instantiate the view controller
2016-07-05 12:26:55 -07:00
Shannon Young 859fc28d8a Fix deprecation warning 2016-07-01 16:39:33 -07:00
Shannon Young ebc4ccacc0 Move example for initializing a custom step view controller into ORKTest 2016-07-01 16:31:53 -07:00
Shannon Young 1c3aab92c1 Update the unit test to make it a little more interesting. 2016-07-01 16:28:12 -07:00
Shannon Young 70093149b5 Updated comment to add additional description. 2016-07-01 16:28:12 -07:00
Shannon Young d595a0b199 Add unit test for instantiating a view controller and expose stepViewControllerClass method 2016-07-01 16:28:12 -07:00
Shannon Young 764b5f8691 Allow steps to instantiate the view controller 2016-07-01 16:28:12 -07:00
Yuan Zhu 395eb936d5 Merge pull request #721 from Sage-Bionetworks/pr/public-continue-button
Make the continue button public for UI consistency
2016-07-01 16:14:15 -07:00
Yuan Zhu dcab7194c1 Merge pull request #727 from Sage-Bionetworks/pr/ui-should-confirm-cancel
Added delegate method for discarding results without confirming cancel.
2016-07-01 15:39:48 -07:00
Yuan Zhu 9c271d87f6 Merge pull request #726 from Sage-Bionetworks/pr/fix-audio-prompts
Fix audio-prompts-coming-from-earpiece bug
2016-07-01 15:32:37 -07:00
Shannon Young d9ebc6d253 Fixed copyrights and removed commented out code 2016-07-01 15:26:20 -07:00
Yuan Zhu 2e555356a6 Merge pull request #722 from Sage-Bionetworks/pr/ui-forgot-passcode
Forgot passcode with delegate methods matching existing pattern
2016-07-01 14:53:49 -07:00
Shannon Young 69c830b8cd Code cleanup and fix alert in ORKTest 2016-07-01 14:24:12 -07:00
Shannon Young a5aa647ed0 Remove delegate method for setting the tintColor 2016-07-01 13:40:32 -07:00
Shannon Young d7d923e609 Forgot passcode with delegate methods matching existing pattern 2016-07-01 13:40:32 -07:00
Shannon Young 0cbb21d71d Add missing comma 2016-07-01 13:06:48 -07:00
Shannon Young f5fe7a47f3 Added files to ORKTest for creating example continue button 2016-07-01 13:02:13 -07:00
Shannon Young cbea809430 Add Continue Button to ORKTest project 2016-07-01 13:02:13 -07:00
Shannon Young a65d5da62f Add test for example usage of continue button. 2016-07-01 13:02:13 -07:00
Shannon Young 49f2914063 Mark ORKTextButton_Internal with project 2016-07-01 13:02:13 -07:00
Shannon Young f50340c7e1 Make the continue button public for UI consistency 2016-07-01 13:02:13 -07:00
Yuan Zhu dfcc02d75f Merge pull request #639 from rsanchezsaez/rsanchezsaez-ORKHealthKitCharacteristicTypeAnswerFormat
[ORKHealthKitCharacteristicTypeAnswerFormat] Expose date picker attributes
2016-06-29 12:36:18 -07:00
Ricardo Sánchez-Sáez 6ad71820d8 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-ORKHealthKitCharacteristicTypeAnswerFormat
# Conflicts:
#	Testing/ORKTest/ORKTestTests/ORKJSONSerializationTests.m
2016-06-29 20:22:23 +01:00
Ricardo Sánchez-Sáez 275cc3ae17 [ORKJSONSerializationTests] Remove unneeded whitespace 2016-06-29 20:18:57 +01:00
Yuan Zhu 5f643fdcde Merge pull request #731 from Sage-Bionetworks/pr/audio-level-check
Added a optional ambient noise check to the voice task.
2016-06-29 10:57:14 -07:00
Shannon Young e444c32eb5 Add missing ORK_CLASS_AVAILABLE to ORKPredicateSkipStepNavigationRule 2016-06-29 10:55:54 -07:00
Shannon Young 7c7dfc4861 Added missing ORK_CLASS_AVAILABLE to headers 2016-06-29 10:44:59 -07:00
Shannon Young 9b9e941299 Add ORKAudioLevelNavigationRule to the tests for ORKSerialization 2016-06-28 17:58:44 -07:00
Shannon Young 27a0755414 Fix typo in documentation for audioTask with sound check 2016-06-28 16:31:48 -07:00
Shannon Young 0dfb3455f7 Update documentation and added unit test 2016-06-28 15:04:41 -07:00
Shannon Young 47d6b5e0f9 Change method signature and deprecate the old audioTask constructor 2016-06-28 14:45:41 -07:00
Shannon Young dbb0fcf2b7 Change name of step identifier property to destinationStepIdentifier 2016-06-28 14:45:41 -07:00
Shannon Young 170ca3e0b6 Added audio wiith sound check to ORKCatalog 2016-06-28 14:45:41 -07:00
Shannon Young 2c868e3bb4 Update copyrights and method signature 2016-06-28 14:45:41 -07:00
Shannon Young 1abd8bf548 Throw exception if recordingSettings dictionary is nil 2016-06-28 14:45:41 -07:00
Shannon Young 5db0f6422e Update copyright dates 2016-06-28 14:45:41 -07:00
Shannon Young 47f1a3bfd1 Added a optional ambient noise check to the voice task. 2016-06-28 14:45:41 -07:00
Yuan Zhu 231ed3f90c Merge pull request #738 from Sage-Bionetworks/pr/ui-confirm-answer-format
Expose method for instantiating an answer format for confirmation of another field.
2016-06-28 13:33:08 -07:00
Yuan Zhu dd465a00e7 Merge pull request #728 from Sage-Bionetworks/pr/public-ordered-task-step-index
Expose method for getting the index of a step from ORKOrderedTask
2016-06-28 13:24:14 -07:00
Yuan Zhu 05325d6070 Merge pull request #644 from rsanchezsaez/rsanchezsaez-Cocoapods
[Cocoapods] Fix podspec to include swift files
2016-06-28 10:22:41 -07:00
Shannon Young ee446da653 Added test for indexOfStep == NSNotFound 2016-06-27 16:38:38 -07:00
Shannon Young b39c2ea10d Add unit test for indexOfStep 2016-06-27 16:38:38 -07:00
Shannon Young 106b2d969f Remove ORKOrderedTask_Internal 2016-06-27 16:37:47 -07:00
Shannon Young cd02eefff7 Expose method for getting the index of a step. 2016-06-27 16:37:47 -07:00
Yuan Zhu 55b97af36a Merge pull request #633 from rsanchezsaez/rsanchezsaez-ORKBarGraphChart
[Charts] Implement ORKBarGraphChart
2016-06-27 16:22:34 -07:00
Shannon Young fa50f74e9c Throw assert on multiple lines - not currently supported. 2016-06-27 16:20:16 -07:00
Shannon Young 903e1cbffe Added example usage of confirmation form item to ORKTest 2016-06-27 16:20:16 -07:00
Shannon Young 4cda98e896 Clean up tab spacing for readability. 2016-06-27 16:18:19 -07:00
Shannon Young 525d5b2350 Added additional comment and tests for the confirmation answer form item. 2016-06-27 16:18:19 -07:00
Shannon Young 191c17930d Move confirm answer to ORKFormItem 2016-06-27 16:18:19 -07:00
Shannon Young cfe39f8201 Fix issue with autocapitolization 2016-06-27 16:18:19 -07:00
Shannon Young 4b35370e80 Expose method for instantiating an answer format for confirmation of another field.
This answer format is intended to be used with an `ORKFormStep` in order to confirm a previous formItem input. Example usage includes a password or participant identifier that is used to anonymously identify a study participant.
2016-06-27 16:18:19 -07:00
Yuan Zhu 2404b20433 Merge pull request #739 from Sage-Bionetworks/pr/ui-task-delegate-vc-will-disappear
Add delegate method to task view controller for step will disappear
2016-06-27 14:59:45 -07:00
Shannon Young a20f953467 Add example that uses the step will disappear method. 2016-06-27 14:36:45 -07:00
Shannon Young f41480f5bb Add unit test of the delgate callback 2016-06-24 12:18:45 -07:00
Shannon Young ddef74e9cc Updated comment and added direction to the method signature. 2016-06-23 17:31:48 -07:00
Yuan Zhu a50f7cbc2f Merge pull request #736 from Sage-Bionetworks/pr/fix-HKQuantityTypeRecorder
Fix ORKHealthQuantityTypeRecorder to allow for iOS 10 and iOS 8 support
2016-06-23 16:47:52 -07:00
Shannon Young 5715ea13c5 Update comment to match method signature. 2016-06-23 16:33:04 -07:00
Shannon Young 41575b830c Add delegate method to task view controller for step will disappear 2016-06-23 16:27:47 -07:00
Shannon Young c6907b1e9e Add comment explaining why tracking both object and uint 2016-06-23 14:46:41 -07:00
Yuan Zhu 286f49bb5d Merge pull request #737 from Sage-Bionetworks/pr/task-copy-with-steps
Copy the properties of an ORKOrderedTask (or subclass) and mutate the steps.
2016-06-23 14:00:35 -07:00
Yuan Zhu 59ac9c3213 Merge pull request #729 from Sage-Bionetworks/pr/fix-result-nullable-date
ORKResult start/end dates should not be nullable
2016-06-23 13:29:31 -07:00
Shannon Young 0cfce94dd6 Copy the properties of an ORKOrderedTask (or subclass) and mutate the steps. 2016-06-22 22:56:00 -07:00
Ricardo Sánchez-Sáez cb4ff44859 [Charts] Rename 'pointForPlotIndex:' (and related methods) to 'dataPointForPlotIndex:'
Also rename 'ORKGraphChartType' to 'ORKValueCollectionType'.
2016-06-23 02:51:02 +01:00
Shannon Young 0375b70146 Wrap the interface for iOS 8 HKAnchoredObjectQuery init
Use a #ifdef __IPHONE_10_0 to only expose the interface if it would not otherwise be available.
2016-06-22 13:29:19 -07:00
Shannon Young e9e2434d5f Add deprecation warning into protocol work-around for HK iOS 10 support 2016-06-22 11:45:13 -07:00
Shannon Young 72fb6d5138 Updated implementation for iOS 8 compatibility to HealthKit for iOS 10 2016-06-22 11:45:05 -07:00
Shannon Young 60aa464b02 Add work-around for missing method for HKAnchoredObjectQuery 2016-06-22 11:44:57 -07:00
Ricardo Sánchez-Sáez 8474d39cdf Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-ORKBarGraphChart
# Conflicts:
#	ResearchKit/Charts/ORKGraphChartView.m
#	ResearchKit/Charts/ORKGraphChartView_Internal.h
#	ResearchKit/Charts/ORKLineGraphChartView.m
#	ResearchKit/Common/ORKHelpers.h
2016-06-22 03:09:42 +01:00
Erin Mounts 3f258d2c6c ORKResult start/end dates should not be nullable 2016-06-21 16:37:48 -07:00
Shannon Young aad49eac86 Added delegate method for discarding results without confirming cancel. 2016-06-21 16:12:25 -07:00
Shannon Young 4b610ee085 Log an error with restoring audio session but do not forward.
If an error occurs with restoring the saved audio session category, then log the error but otherwise ignore. Do not want to fail the task.
2016-06-21 15:49:05 -07:00
Yuan Zhu 78d59f7ed8 Merge pull request #636 from rsanchezsaez/rsanchezsaez-ORKNavigableOrderedTask
[ORKNavigableOrderedTask] Implement skip navigation rules
2016-06-21 15:12:32 -07:00
Shannon Young a147b2e6e3 Report error (if any) for restoring the saved audio session category 2016-06-21 14:54:46 -07:00
Yuan Zhu 78bc96956c Merge pull request #724 from Sage-Bionetworks/pr/update-module-voice-threshold
Audio ActiveTask View - add ability to define threshold value
2016-06-21 14:30:23 -07:00
Shannon Young 0e9ce26b82 Mark audio prompt property as copy rather than strong 2016-06-21 14:28:56 -07:00
Shannon Young e2f284a4cb Only update the view threshold if the view is loaded 2016-06-21 14:26:52 -07:00
Shannon Young 90af9211eb Only set the threshold if greater than 0 2016-06-21 14:25:15 -07:00
Shannon Young 1107bd9dba Do not set the initial threshold. Zero by default is ignored. 2016-06-21 14:22:04 -07:00
Yuan Zhu 4bcc83ecd3 Merge pull request #716 from king7532/swift3
Update `ORKPredicateStepNavigationRule` Swift 2.x formatting to match…
2016-06-21 14:19:27 -07:00
Ricardo Sánchez-Sáez aa86bf3bed [ORKNavigableOrderedTask] Return empty dictionaries instead of empty arrays 2016-06-21 21:51:00 +01:00
Erin Mounts 5de1888375 Fix audio-prompts-coming-from-earpiece bug
save the current AVAudioSession category before starting voice recording and then restore afterward
2016-06-21 13:20:51 -07:00
Everest Liu 01eab7bd0c PAN-98 - Audio ActiveTask View - add ability to define threshold value 2016-06-21 13:10:17 -07:00
Yuan Zhu 1da1d632b6 Merge pull request #718 from Sage-Bionetworks/pr/fix-defaultResultStore
Fix bug where the defaultResultSource is using ivar rather than public property accessor
2016-06-21 11:11:52 -07:00
Shannon Young 072d19c84b Fix bug where the defaultResultSource is using ivar rather than public property accessor 2016-06-21 11:06:27 -07:00
Yuan Zhu 11effe846e Merge pull request #625 from shazino/ib-graph-chart
Make chart and graph IBInspectable/IBDesignable
2016-06-21 10:18:53 -07:00
Umer Khan c185fce465 Merge pull request #583 from chb/feature/passcode-override
Improve Passcode View
2016-06-20 14:47:53 -05:00
Benjamin King 4863368e23 Update ORKPredicateStepNavigationRule Swift 2.x formatting to match the style guide 2016-06-20 15:07:39 -04:00
Yuan Zhu 1ce947395d Merge pull request #715 from king7532/swift3
Update extension to `ORKPredicateStepNavigationRule` to support Swift 3 and 2.x
2016-06-20 11:10:18 -07:00
Benjamin King c15b98e41a Update extension to ORKPredicateStepNavigationRule to support Swift 3 and 2.x 2016-06-18 21:32:37 -04:00
Andrew Hill 9341e85030 Merge branch 'ResearchKit/master' 2016-06-14 20:14:53 +01:00
Steve Moser 1934f143a5 Add suggested fixes for 12 iPad Pro metrics 2016-06-13 12:54:29 -04:00
Yuan Zhu 9b1efb8641 Merge pull request #707 from malhal/master
Fix for blank white screen when app activates back from viewing the N…
2016-06-10 14:30:59 -07:00
Malcolm Hall c1f30947be Fix for blank white screen when app activates back from viewing the NC or a privacy prompt 2016-06-08 20:09:11 +01:00
Steve Moser dc22fe8191 Add initial support for 12.9 inch iPad Pro
Needs feedback on naming and metrics
2016-06-03 15:11:43 -04:00
Yuan Zhu 4259a1cc92 Update pod spec version number. 2016-05-24 10:54:15 -07:00
Ben DiFrancesco 70d4532d0e Declare ORKScrollToTopAnimationDuration and ORKCGFloatInvalidValue as extern in ORKHelpers.h; fixes #679 2016-05-24 10:53:53 -07:00
Yuan Zhu 8e2313118f Merge pull request #680 from apbendi/header-fix
Fix declaration of constants in ORKHelpers
2016-05-17 11:12:34 -07:00
Ben DiFrancesco 354cee7e7a Declare ORKScrollToTopAnimationDuration and ORKCGFloatInvalidValue as extern in ORKHelpers.h; fixes #679 2016-05-12 16:18:20 -04:00
Ricardo Sánchez-Sáez 7cfb8960c9 [ORKHeightPicker] Rename variables in internal method 2016-05-05 01:36:04 +01:00
Ricardo Sánchez-Sáez cabaecb5d1 [ORKHeightAnswerFormat] Use ORK_DECODE_ENUM() and ORK_ENCODE_ENUM() 2016-05-05 01:08:37 +01:00
Ricardo Sánchez-Sáez 99bd214f23 [Misc] Rename 'ORKNumberFormatter' to 'ORKDecimalNumberFormatter' 2016-05-05 01:04:07 +01:00
Umer Khan ea7c941424 Merge pull request #662 from dukemike/issues/658
allow plot fill color of ORKLineGraphChartView to be set by the delegate
2016-05-04 13:17:02 -07:00
Umer Khan 75e880e1d9 Merge pull request #653 from samfalconer/master
Update ORKSignatureView to support pressure sensitive stroke widths.
2016-05-03 11:07:35 -07:00
Andrew Hill a788e35d25 Merge branch 'ResearchKit/master' 2016-05-02 10:50:32 +01:00
Yuan Zhu e9d7b847da Merge pull request #638 from evands/improve-vertical-slider-layout
Improved flexibility for laying out a vertical ORKScaleSliderView.
2016-04-29 13:47:56 -07:00
Yuan Zhu b0f5e2cbb7 Merge pull request #650 from dwarfland/master
Typo/case fix in #include
2016-04-28 16:38:31 -07:00
Yuan Zhu 2c4ef0f73e Merge pull request #664 from ResearchKit/stable
Merge class visibility fix from Stable to Master
2016-04-19 17:12:02 -07:00
Yuan Zhu 23900bed0e Merge pull request #663 from YuanZhu-apple/stable_class_visibility
Fix class visibility
2016-04-19 17:10:44 -07:00
Yuan Zhu 8c8a1adc47 Fix class visibility 2016-04-19 17:05:49 -07:00
Mike Revoir 4ada9cf5ff Merge pull request #1 from rsanchezsaez/dukemike-issue-658
[ORKLineGraphChartView] Improvements to new fill color method
2016-04-14 10:56:03 -04:00
Ricardo Sánchez-Sáez 7b23d8b21e [ORKLineGraphChartView] Fix issue where fill color wasn't correctly obtained on updatePlotColors method
Also:
- Have points and lines to be drawn above their corresponding fill
- Move fillColorForPlotIndex: to ORKLineGraphChartView.m
- Minor headerdoc improvement
2016-04-13 20:01:57 +01:00
Ricardo Sánchez-Sáez d2f26a5ab9 [ORKTest] Add ORKLineGraphChartView's graphChartView:fillColorForPlotIndex: method test 2016-04-13 19:58:58 +01:00
Mike Revoir c170a8c38a reformat whitespace. refs #658 2016-04-13 10:56:54 -04:00
Mike Revoir 934aa3283b allow plot fill color to be set. refs #658 2016-04-13 10:56:47 -04:00
Sam Falconer 639f75eaa6 Merge if statements.
In addition to checking for 3D touch, check for Apple Pencil
to see if we can get force from that.
2016-04-06 18:11:01 -04:00
Michal Zaborowski 5f969da0d7 Adding tap duration to Tapping Task Issue #561 2016-04-06 19:49:58 +02:00
Sam Falconer 080c69bd8b Update ORKSignatureView to support pressure sensitive stroke widths.
Add property for setting the stroke width variation (default to 3pts).

If the device supports 3D touch, use the true pressure to determine
how thick the line should be at a given point.

If the device does not support 3D touch, use the speed of the stroke
to determine how thick the line should be at a given point.
2016-04-05 14:36:53 -04:00
Ricardo Sánchez-Sáez 42c12ca73f [ORKHeightAnswerFormat] Replace 'BOOL useMetricSystem' by 'ORKMeasurementSystem measurementSystem'
Valid values are:
- ORKMeasurementSystemLocal
- ORKMeasurementSystemMetric
- ORKMeasurementSystemUSC
2016-03-30 00:56:12 +01:00
Ricardo Sánchez-Sáez 025581ad55 [ORKHealthKitQuantityTypeAnswerFormat] Use 'ORKHeightAnswerFormat' as the impliedAnswerFormat when the quantity type is 'HKQuantityTypeIdentifierHeight 2016-03-29 21:53:30 +01:00
Ricardo Sánchez-Sáez 65aee797ce [ORKHealthKitCharacteristicTypeAnswerFormat] Move 'defaultDate', 'minimumDate', 'maximumDate' and 'calendar' default value calculation to impliedAnswerFormat's initialization
This prevents archiving of stale date and calendar values.
2016-03-29 20:47:46 +01:00
Yuan Zhu f7ea0167b1 Merge pull request #641 from rsanchezsaez/rsanchezsaez-ORKStepResult.enabledAssistiveTechnology
[ORKStepResult] Add 'enabledAssistiveTechnology' property
2016-03-29 12:39:21 -07:00
Ricardo Sánchez-Sáez a5a8531fdf [ORKStepResult] Rename 'checkEnabledAssistiveTechnology' to 'updateEnabledAssistiveTechnology' 2016-03-29 20:23:58 +01:00
Yuan Zhu e60db320ed Merge pull request #645 from rsanchezsaez/rsanchezsaez-ORKCountdownStep
[Framework] Expose ORKCountdownStep and ORKCompletionStep publicly
2016-03-29 11:08:23 -07:00
marc hoffman 8a6895d762 ORKWaitStepViewController.h was marked as private and thus missing (but needed) from compiled .framework 2016-03-29 11:26:53 -04:00
marc hoffman 2ac579a610 Type/case fix in #include 2016-03-29 11:20:57 -04:00
Ricardo Sánchez-Sáez 4b9ae8e404 [ORKTest] Fix small indentation misalign 2016-03-29 14:12:14 +01:00
Ricardo Sánchez-Sáez f7d1591c19 [Misc] Change all framework #imports to @import
Also:
- Change some #imports to directly refer headers instead of going though the framework header because it enables it be included as a module through Cocoapods.
- Improve unit test encapsulation by making some classes (recorders) and methods available in the private header
2016-03-28 20:06:58 +01:00
Ricardo Sánchez-Sáez 9b539d7faf [Misc] Remove needless #imports from ORKVerticalContainerView 2016-03-28 16:05:34 +01:00
Ricardo Sánchez-Sáez e515278b4c [Misc] Perform #import section refactor to reduce header interdependency
Compilation time after you modify a header file has been greatly improved by avoiding including the umbrella headers (ResearchKit.h and ResearchKit_Private.h) in any of the framework files.

Also:
- Restructure .m files #import section into a hierarchy of alphabetically sorted subsections separated by one newline (1. local views and controls; 2. view controllers and recorders; 3. model files; 4. general files and helpers, 5. iOS frameworks). The #import order follows advice found here: http://qualitycoding.org/import-order/
- Remove needless and duplicate imports from .m files
- Make sure all headers include at least Foundation or UIKit; except Private or Internal headers which only include their own class header at the next public level
- Rename ORKHelpers.h to ORKHelpers_Internal.h (it is not public, and its name was misleading given that we also have ORKHelpers_Private.h).
- Add a few missing NS_ASSUME_NONNULL_BEGIN/NS_ASSUME_NONNULL_END annotation in headers
- Add a few missing double newline before and after import section
2016-03-28 15:34:27 +01:00
WEI-JEN TU e3b2d91a8b ORKQuestionResult could get truncated Chinese texts before textFieldDidEndEditing is called
ORKQuestionResult could get truncated Chinese texts before
textFieldDidEndEditing is called in UITextFieldDelegate

The repository “truncated-branch” is revised to be able to demonstrate
the scenario right away. Also uncomment line 202 in
ORKSurveyAnswerCellForText addresses the issue.

There are two videos as well to elaborate truncated Chinese texts and
difference between before and after.
Before: (Notice that the last character is always truncated before
textFieldDidEndEditing is called in UITextFieldDelegate)
https://db.tt/jHlCyr62

After:
https://db.tt/jeh1O20k
2016-03-26 12:07:17 -07:00
WEI-JEN TU da41b8a43b Merge remote-tracking branch 'ResearchKit/master' 2016-03-26 10:41:03 -07:00
Ricardo Sánchez-Sáez 86273181ac [Framework] Expose ORKCountdownStep and ORKCompletionStep publicly 2016-03-24 17:29:05 +00:00
Ricardo Sánchez-Sáez 930d94f804 [ORKSpatialSpanMemoryTask] Rename methods to avoid abbreviations and add step documentation
(Missing step documentation was causing broken links in the documentation.)
2016-03-24 17:08:56 +00:00
Ricardo Sánchez-Sáez d783c0b2b6 [Cocoapods] Fix podspec to include swift files 2016-03-24 15:23:50 +00:00
Ricardo Sánchez-Sáez 92cc2c0ef9 [ORKTest] Add 'ORKHeightAnswerFormat' step to review example
Fix review step text output which was showing total inches instead of decomposed feet and inches.
2016-03-24 15:20:57 +00:00
Ricardo Sánchez-Sáez 275b7b5ff9 [ORKAnswerFormat] Implement picker-based 'ORKHeightAnswerFormat'
Details:
- Metric and imperial measuring systems support
- Standalone question steps and on form steps support
- Serialization unit tests implemented

Notes:
- For input it uses the newly added 'ORKHeighPicker' class
- Height limits and default value are hardcoded into the picker, taking the same values as the Health App: [0 ft, 0 in - 9 ft, 11 in] range, default: 5 ft, 4 in; [0 cm - 299 cm] range, default: 162 cm
- Results are output as an 'ORKNumericResult' object, with the unit canonically set to 'in' or 'cm' depending on the chosen measuring system (on the imperial system, feet and inches always get converted to total inches when stored in the outputted result)
- Visually, the picker and the chosen answer in form steps display the 'cm' and decomposed 'ft in' values, with their units localized if applicable (unlike the canonical result units which are never localized)
2016-03-24 14:51:36 +00:00
Ricardo Sánchez-Sáez 642f87576a [Misc] Avoid some abbreviations and needless intermediate variables 2016-03-23 17:43:44 +00:00
Ricardo Sánchez-Sáez 4735bc5d47 [Misc] Add missing whitespace around '!=' operator 2016-03-22 18:43:59 +00:00
Ricardo Sánchez-Sáez 0e29f50f77 [ORKStepResult] Add 'enabledAssistiveTechnology' property
The property can have the following values:
 - `UIAccessibilityNotificationVoiceOverIdentifier` if Voice Over was active
 - `UIAccessibilityNotificationSwitchControlIdentifier` if Switch Control was active
2016-03-22 18:34:09 +00:00
Ricardo Sánchez-Sáez daac3505b4 [ORKSample] Small improvement to 40x40 app icon 2016-03-22 12:45:09 +00:00
Ricardo Sánchez-Sáez 89838d63bd [Misc] Update to Swift 2.2 code (Xcode 7.3 only)
(Avoid using newly deprecated methods)
2016-03-22 12:22:33 +00:00
Ricardo Sánchez-Sáez 1337dbf851 [ORKDirectionView] Avoid CGMutablePath leak 2016-03-22 12:15:24 +00:00
Ricardo Sánchez-Sáez 0c60532068 [ORKTextScaleAnswerFormat] Fix issue potentially causing 'nil' to try to be added to an array 2016-03-22 12:12:07 +00:00
Ricardo Sánchez-Sáez ea0fb64319 [ORKHealthKitCharacteristicTypeAnswerFormat] Expose 'defaultDate', 'minimumDate', 'maximumDate' and 'calendar'
Used to customize the presented date picker, only applicable to the 'HKCharacteristicTypeIdentifierDateOfBirth' characteristic type.
2016-03-21 18:50:27 +00:00
Ricardo Sánchez-Sáez 14bb563d26 [ORKPieChartView] Implement new ORKPieChartLegendCollectionViewLayout
It evenly distributes the cells between all the rows, and lays them out as compactly possible along the center by increasing leading and trailing padding.
2016-03-18 18:04:02 +00:00
Ricardo Sánchez-Sáez 09b7adc981 [Charts] Make scrubber to be shown on a static long press
Adds public UILongPressGestureRecognizer property.
2016-03-18 11:57:03 +00:00
Ricardo Sánchez-Sáez 412f30652f [Charts] Adjust reference line boundaries so they rest on full pixels on iPhone 6 and 6 Plus 2016-03-17 16:46:56 +00:00
Ricardo Sánchez-Sáez 9ef8b4a980 [Charts] Make sure ORKBarGraphChartView bars and ORKLineGraphChartView fill start at whole pixel coordinates 2016-03-17 15:47:20 +00:00
Ricardo Sánchez-Sáez ce365bbe10 [Charts] Make auto-calculated reduced-alpha colors opaque, so reference lines don't show below bar graphs 2016-03-16 21:15:15 +00:00
Ricardo Sánchez-Sáez 778bcf71e0 [ORKValueStack] Rename '-initWithStackedValueArray:' to '-initWithStackedValues:' and fix documentation 2016-03-16 18:05:15 +00:00
Ricardo Sánchez-Sáez bf94333d32 [ORKChartTypes] Make 'stackedValues' property to have copy semantics 2016-03-16 17:45:56 +00:00
Yuan Zhu 9f5caad71d Merge pull request #445 from rsanchezsaez/rsanchezsaez-HomogenousORKTextFieldView
[ORKTextField] Coherent placeholder handling
2016-03-16 10:07:20 -07:00
Ricardo Sánchez-Sáez 14fce4445f [Charts] Minor documentation improvements 2016-03-16 16:48:30 +00:00
Ricardo Sánchez-Sáez 1984b46efb [ORKNavigableOrderedTask] Add nullability annotations when returning individual rules; make sure the rule dictionary property always returns a proper non-mutable dictionary 2016-03-16 16:20:40 +00:00
Ricardo Sánchez-Sáez 02a822baef [Misc] Make sure -isEqual: method always uses the property format when accessing the variables to compare 2016-03-16 16:02:01 +00:00
Ricardo Sánchez-Sáez cdaa4d4c91 [Misc] Make sure +(instancetype)new is NS_UNAVAILABLE when init is so.
Also, throw exception on unavailable methods where appropriate. Make sure ORKTest unit tests continue to pass.
2016-03-16 15:55:09 +00:00
Ricardo Sánchez-Sáez 6e4a4560d8 [Misc] Use property syntax for accessing 'hash' 2016-03-16 14:04:46 +00:00
Ricardo Sánchez-Sáez 657bcab2f7 [Misc] Use 'error' instead of the non-standard 'err' abbreviation
(https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE)
2016-03-16 13:34:41 +00:00
Ricardo Sánchez-Sáez b8a999995f [Misc] Remove explicit __autoreleasing annotation in indirect parameters to avoid noisy code
Indirect parameters are __autoreleasing implicitly: http://clang.llvm.org/docs/AutomaticReferenceCounting.html#indirect-parameters
Also, add _Nullable annotation to indirect parameters in headers, and homogenize whitespace surrounding it.
2016-03-16 13:31:50 +00:00
Ricardo Sánchez-Sáez 28ee60beb7 [Coding Style Guide] Add some whitespace notes, and favor '_Nullable' over '__nullable. 2016-03-16 13:21:02 +00:00
Ricardo Sánchez-Sáez e305e3c4b2 [ORKNavigationContainerView] Use explicit struct initialization 2016-03-16 13:17:03 +00:00
Ricardo Sánchez-Sáez 90f5a2cc62 [Misc] Avoid needless returns from void functions 2016-03-16 13:16:58 +00:00
Ricardo Sánchez-Sáez 75c75901a3 [Misc] Use __typeof instead of typeof
(Avoids pedantic warning)
2016-03-16 13:16:53 +00:00
Ricardo Sánchez-Sáez c5396e8ae6 [ORKHelpers] Remove needless struct casts 2016-03-16 13:16:46 +00:00
Ricardo Sánchez-Sáez 942a092bd1 [Misc] Remove extraneous ; symbols 2016-03-16 13:16:41 +00:00
Ricardo Sánchez-Sáez 1cb09d68d3 [Charts] Draw reference lines for Bar Graph Chart View on ORKCatalog example 2016-03-15 18:32:25 +00:00
Evan D. Schoenberg, M.D fd11ee1e89 Improved flexibility for laying out vertical ORKScaleSliderView. This allows longer text labels by setting constraints to allow the slider to move as far left as 25% the width of the view, and allows the text labels to expand to the edge of the view (less a SideLabelMargin margin width). 2016-03-15 13:32:19 -04:00
Ricardo Sánchez-Sáez 878acecad6 [ORKSpatialSpanTargetView] Remove needsless '_' prefix from static variable name 2016-03-15 17:07:20 +00:00
Ricardo Sánchez-Sáez 5d1fe51b42 [Coding Style Guide] Add 'Spaces in array and dictionary literals' subsection 2016-03-15 16:31:34 +00:00
Ricardo Sánchez-Sáez 077dfcc4ab [Misc] Additional whitespace homogenization regarding space before dictionary keys and around the tertiary operator (?:) 2016-03-15 16:09:19 +00:00
Ricardo Sánchez-Sáez f24c371541 [Misc] Rename STRONGTYPE() to ORKStrongTypeOf() and introduce ORKWeakTypeOf() for homogeneity 2016-03-15 15:31:26 +00:00
Ricardo Sánchez-Sáez 7a0101c12b [Project] Rename ORKDefines_Private.h to ORKHelpers_Private.h
(Since it has fuctions, not macros.)

Also, move localization functions from ORKHelpers_Private.h to ORKHelpers.h (the latter is an internal file, so encapsulation is better).
2016-03-15 14:54:55 +00:00
Ricardo Sánchez-Sáez 887f8dd6bd [Project] Extract type definitions from 'ORKDefines.h' into the new 'ORKTypes.h' file 2016-03-15 12:42:16 +00:00
Ricardo Sánchez-Sáez f6c8bc939b [ORKHelpers] Use ORK_INLINE macro 2016-03-15 12:14:44 +00:00
Ricardo Sánchez-Sáez b6cc2f3add [ORKGraphChartView] Use ORK_INLINE macro 2016-03-15 11:47:36 +00:00
Ricardo Sánchez-Sáez 24929ca8b1 [ORKHelpers] Rename STRINGIFY to ORK_STRINGIFY 2016-03-14 15:35:15 +00:00
Ricardo Sánchez-Sáez 8c270dca89 [ORKHelpers] Avoid using the reserved '__' prefix 2016-03-14 15:31:56 +00:00
Ricardo Sánchez-Sáez 129ee6baef [ORKKeychainWrapper]: Use '_Nullable' instead of '__nullable' (Xcode 7 style) 2016-03-14 15:23:26 +00:00
Ricardo Sánchez-Sáez a2e4b5aa1c [Misc] Always add space before '__autoreleasing' 2016-03-14 15:22:15 +00:00
Ricardo Sánchez-Sáez 75047cabb2 [ORKHolePegTest] Replace 'can not' by 'cannot' in exception messages 2016-03-14 15:09:58 +00:00
Ricardo Sánchez-Sáez 8a3fea6488 [Misc] Make some code to conform to code homogenization
- Remove space after unary '!' operator
- Remove space after pointer '*' start
2016-03-14 15:08:45 +00:00
Ricardo Sánchez-Sáez 57cbebae64 [ORKNavigableOrderedTask] Implement skip navigation rules
Introduce the ORKSkipStepNavigationRule and ORKPredicateSkipStepNavigationRule classes, and the appropriate 'ORKNavigableOrderedTask' methods to insert, view and remove them.
Implement ORKTest example code within the Navigable Loop Task Items.
Implement unit tests for the new functionality, and makes sure all serialization tests continue to pass.
2016-03-11 18:41:32 +00:00
Andrew Hill b13a470348 Merge branch 'ResearchKit/master' 2016-03-11 12:45:54 +00:00
Ricardo Sánchez-Sáez 2ea828e29e [ORKBarGraphChartView] Made BarWidth constant static 2016-03-11 11:56:08 +00:00
Ricardo Sánchez-Sáez 7efb9ecb36 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-ORKBarGraphChart 2016-03-10 18:10:44 +00:00
Ricardo Sánchez-Sáez ea777873af [Charts] Make 'ORKValueRange' and 'ORKValueStack' to use 'double' instead of 'CGFloat' 2016-03-10 17:58:46 +00:00
Ricardo Sánchez-Sáez fc7c55c3ab [ORKValueRange] Raname 'isEmpty' property to 'isEmptyRange' 2016-03-10 17:24:13 +00:00
Ricardo Sánchez-Sáez df05877256 [Charts] Rename 'ORKFloatRange' and 'ORKFloatStack' to 'ORKValueRange' and 'ORKValueStack' 2016-03-10 17:20:13 +00:00
vtourraine 9025045a4c [Charts] Add sample graph chart data source for Interface Builder 2016-03-10 15:47:14 +01:00
vtourraine 0571b6e960 [Charts] Add sample pie chart data source for Interface Builder 2016-03-10 15:01:09 +01:00
Yuan Zhu d1fbc178a1 Merge pull request #591 from rsanchezsaez/rsanchezsaez-master-ORKSampleIcon
[ORKSample] Add app icon
2016-03-09 16:12:08 -08:00
Yuan Zhu 6a2f18af4d Merge pull request #629 from evands/vertical-slider-multiline
Allow 2 lines of text on vertical scale sliders
2016-03-09 16:10:45 -08:00
Yuan Zhu cc352493f9 Merge pull request #626 from weijentu/master
About ORKQuestionType for ORKTextAnswerFormat?
2016-03-09 11:00:42 -08:00
Yuan Zhu 43a4379c8e Merge pull request #621 from pra85/patch-1
[RELEASE-NOTES.md] Fix a typo
2016-03-09 10:30:43 -08:00
Evan D. Schoenberg, M.D 5c3db570f7 Allow unlimited lines for vertical scale slider views rather than 2 as per discussion in #629 2016-03-08 21:15:00 -05:00
Ricardo Sánchez-Sáez 0980410b95 [ORKFloatRange] Throw exception if 'maximumValue' is lower than 'minimumValue 2016-03-08 18:05:42 +00:00
Ricardo Sánchez-Sáez 2e5d784608 [ORKFloatStack] Add comma before the 'and' separator 2016-03-08 17:56:15 +00:00
Ricardo Sánchez-Sáez 288d710e51 [ORKGraphChartView] Fix issue with wrong UIAccessibilityIsVoiceOverRunning() check
The issue prevented accessibility elements to be properly set.
2016-03-08 17:49:21 +00:00
Ricardo Sánchez-Sáez cc46125c69 [ORKFloatStack] Implement accessibilityLabel method
(Used by Voice Over)
2016-03-08 17:48:37 +00:00
Ricardo Sánchez-Sáez ca94aa7468 [ORKChartTypes] Conform ORKFloatRange and ORKFloatStack descriptions to ObjC conventions 2016-03-08 17:46:09 +00:00
Ricardo Sánchez-Sáez d0293a0ee7 [ORKBarGraphChartView] Fix display animation implementation
Also, add ORKTest appearance tests, and make other graph tests more comprehensive by adding empty points at the middle.
2016-03-08 17:45:47 +00:00
Ricardo Sánchez-Sáez b8c80c70c7 [ORKBarGraphChartView] Implement most of bar graph chart functionality
Some details:
- Added ORKCatalog example and ORKTest test
- Conform ORKFloatRange and ORKFloatStack to the new ORKGraphChartType protocol. Move them to the ORKChartTypes.h/m files.
- ORKLineGraphChartView and ORKDiscreteGraphChartView now inherit from the abstract ORKFloatRangeGraphChartViewClass.
- There are now two concrete protocolsL ORKFloatRangeGraphChartViewDataSource (used by ORKLineGraphChartView and ORKDiscreteGraphChartView) and ORKFloatStackGraphChartViewDataSource (used by ORKBarGraphChartView). Both inherit from the abstract ORKGraphChartViewDataSource protocol.

Things yet to do:
- Implement appearing animations
- Implement ORKTest appearance-properties testing
- Implement and test bar chart view accessibility
2016-03-08 17:45:04 +00:00
Evan D. Schoenberg, M.D 40e328e29e Allow 2 lines of text on vertical scale sliders, as there is plenty of space for this to fit comfortably. 2016-03-05 09:51:20 -08:00
Ricardo Sánchez-Sáez 3f89fba2cf [Charts] Implement first steps for ORKBarGraphChartView
Also, makes ORKTest's 'ORKDiscreteGraphChartView' tests more comprehensive.
2016-03-01 17:14:55 +00:00
Ricardo Sánchez-Sáez bece29b351 [ORKGraphChartView] Fix global appearance proxy tintColor taking over custom local tintColor 2016-03-01 16:02:43 +00:00
Allen Tu 4d1601a787 Set questionType for ORKEmailAnswerFormat with ORKQuestionTypeText
Discussion: An ORKEmailAnswerFormat object is implied with
ORKTextAnswerFormat and produces an ORKTextQuestionResult object, too.
Could it be better to set its questionType to ORKQuestionTypeText?
2016-02-26 21:59:13 +08:00
Allen Tu 80d7685ab3 Merge remote-tracking branch 'ResearchKit/master' 2016-02-26 21:43:36 +08:00
vtourraine 6e1334a2fc Make chart and graph IBDesignable 2016-02-26 14:39:16 +01:00
vtourraine 3c550b54b4 Fix IBInspectable for readonly properties 2016-02-26 14:13:38 +01:00
vtourraine 7ca7079522 Make chart and graph properties IBInspectable 2016-02-26 10:49:19 +01:00
Prayag Verma e4af7fe7fe [RELEASE-NOTES.md] Fix a typo
Remove extra `the`
2016-02-18 13:07:24 +05:30
Jared Crawford 8c3b5ce81f Update delegate method documentation 2016-02-17 17:27:34 -08:00
Jared Crawford 783ad4c6b4 Adds support for drawing plots within a chart without individual data point indicators 2016-02-17 17:17:40 -08:00
Jared Crawford b85182b372 Fix typos 2016-02-12 12:27:58 -08:00
Jared Crawford 6e075cbfe3 Add a result predicate for determining if the user selected accept or decline in a consent signature step, allowing for custom navigation rules, such as skipping to the end of a survey if the user does not consent. 2016-02-11 18:07:08 -08:00
Yuan Zhu 410affbf5d Merge pull request #619 from rsanchezsaez/rsanchezsaez-UnitTests
[ORKNavigableOrderedTask] Fix 'shouldReportProgress' being ignored by NSSecureCoding and NSCopying
2016-02-08 15:34:57 -08:00
Ricardo Sánchez-Sáez 182960a263 [ORKGraphChartView] Fix small documentation issues 2016-02-08 18:24:51 +00:00
Ricardo Sánchez-Sáez 0971ef71f4 [ORKSample] Fix typos in variable names 2016-02-08 17:52:46 +00:00
Ricardo Sánchez-Sáez 92ca8f86a5 [ORKGraphChartView] Fix error in accessibility string key 2016-02-08 17:50:45 +00:00
Ricardo Sánchez-Sáez 24c46898e8 [ORKLineGraphChartView] Go back to consistently using minimumValue as main plotted data 2016-02-08 16:40:34 +00:00
Ricardo Sánchez-Sáez 065a02eff1 [ORKNavigableOrderedTask] Fix 'shouldReportProgress' being ignored by NSSecureCoding and NSCopying
Also, fix ORKTest's unit tests.
2016-02-08 16:33:22 +00:00
Ricardo Sánchez-Sáez 2db99d6152 [Charts] Rename ORKRangedPoint to ORKFloatRange
Also:
- Improve documentation.
- Fix ORKFloatRange's 'hasEmptyRange' property being always 'NO'.
- Fix typo in ORKGraphChartView's 'colorForPlotIndex:' method.
2016-02-08 16:24:33 +00:00
Ricardo Sánchez-Sáez f6cb8b09f0 [ORKGraphChartView] Make the discrete graph to snap on the actual chosen plot index when scrubbing 2016-02-07 18:51:06 +00:00
Ricardo Sánchez-Sáez f9d49594fe [ORKGraphVhartView] Fix scrubber not being correctly positioned for last data point in discrete graphs 2016-02-07 15:41:07 +00:00
Yuan Zhu 62a31b087a Merge pull request #618 from rsanchezsaez/rsanchezsaez-ReleaseNotes
[RELEASE-NOTES.md] Improvements
2016-02-05 12:27:31 -08:00
Ricardo Sánchez-Sáez 70fd57488d [RELEASE-NOTES.md] Fix some typos, rewrite some sentences and improve formatting 2016-02-05 18:29:06 +00:00
Yuan Zhu 1f457e1d54 Merge pull request #615 from apbendi/nav-ordered-progress
Allow user to opt-in to linear progress reporting on ORKNavigableOrderedTask
2016-02-03 10:21:30 -08:00
Ben DiFrancesco 729247cfcd Allow user to opt-in to linear progress reporting on ORKNavigableOrderedTask 2016-01-29 10:50:25 -05:00
Yuan Zhu 218b8af66a Merge pull request #604 from rsanchezsaez/rsanchezsaez-ORKTestTests
[ORKTestTests] Fix unit tests
2016-01-27 14:21:42 -08:00
Ricardo Sánchez-Sáez 069c388cb3 [ORKTest] Remove README.md from target 2016-01-27 19:34:13 +00:00
Ricardo Sánchez-Sáez e199db13b4 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-ORKTestTests 2016-01-27 19:30:50 +00:00
Ricardo Sánchez-Sáez a96c8b9540 [ResearchKit] Fix unit tests
- Fixes tests to reflect the new empty answer for a Choice Answer Format being ORKNullAnswerValue() instead of an empty array (introduced on the Review Step feature).
- Fixes test for task step identifier uniqueness validation (it now takes place on task init).
2016-01-27 13:21:05 +00:00
Ricardo Sánchez-Sáez 865275d3aa [Projects] Fix ResearchKit framework linkage for all 3 apps
This links and embeds the workspace instance of ResearchKit from the three subprojects.

Also:
- Remove ResearchKit subproject reference from ORKCatalog.
- Link HealthKit framework from ORKSample.
- Link HealthKit and MapKit in an optional way.
- Reorganise frameworks into Framework group for each subproject.
2016-01-27 12:39:55 +00:00
Yuan Zhu a1d29fe225 Merge pull request #612 from CareEvolution/ORKWaitStepView-header-fix
Revert ORKWaitStepView.h to Project visibility
2016-01-26 11:32:03 -08:00
Scott Guelich 67bcc93947 Remove Private attribute from internal headers 2016-01-26 11:29:18 -08:00
Yuan Zhu 8e8fabf79f Merge pull request #605 from rsanchezsaez/rsanchezsaez-ORKStepNavigationRule
[ORKStepNavigationRule] Improve documentation
2016-01-26 11:27:30 -08:00
Yuan Zhu 292727ad91 Merge pull request #611 from CareEvolution/remove-chart-no-data-label
ORKGraphChartView - Remove the "No Data" label when there is data
2016-01-26 10:46:57 -08:00
Scott Guelich 2f1e58e234 Revert ORKWaitStepView.h to Project visibility 2016-01-26 08:47:41 -08:00
Scott Guelich 86226e9ba8 Remove noDataLabel when no data
Fix simple logic error
2016-01-26 08:37:13 -08:00
Yuan Zhu d40e8193d5 Providing a scale factor property in ORKPieChartView.
One reasoning this might be needed is incase the labels in the pie chart don't fit.
2016-01-22 13:39:59 -08:00
Yuan Zhu 525f2c6efb Merge branch 'master' of https://github.com/ResearchKit/ResearchKit 2016-01-22 13:20:39 -08:00
Ricardo Sánchez-Sáez ad52da287c [ORKStepNavigationRule] Improve documentation
- Improve whitespace
- Specify that passing 'ORKNullStepIdentifier' (instead of 'nil') ends the task for direct and predicate step navigation rules.
2016-01-16 21:46:18 +00:00
Ricardo Sánchez-Sáez 8d0fd95ad0 [ORKTestTests] Fix failing tests (mainly due ORKReviewStep) 2016-01-16 21:36:55 +00:00
Ricardo Sánchez-Sáez 46c78c08a4 [Workspace] Remove duplicated ResearchKit subproject references from ORKSample and ORKTest
They're not needed since ResearchKit is already in the Workspace.
2016-01-16 21:35:53 +00:00
Yuan Zhu 54927408bf Merge pull request #601 from rsanchezsaez/rsanchezsaez-ORKSample
[ORKSample] Allow onboarding to proceed on the Simulator despite HealthKit not being present
2016-01-14 16:27:36 -08:00
Yuan Zhu f325310d77 Merge pull request #451 from rsanchezsaez/rsanchezsaez-documentationformatting
README.md formatting
2016-01-14 16:11:13 -08:00
Yuan Zhu dd4e4fdbce Merge pull request #596 from shazino/timed-walk-optional-form
Add includeAssistiveDeviceForm parameter to timed walk task
2016-01-14 16:00:33 -08:00
Yuan Zhu 063cde7656 Merge pull request #602 from rsanchezsaez/rsanchezsaez-ORKGraphChartView
[Charts] Fix crash when displaying graph chart with no data source
2016-01-14 15:53:48 -08:00
Ricardo Sánchez-Sáez fb1ef39165 [Charts] Add reloadData methods
The developer can call this method if the data provided by the dataSource changes.
2016-01-14 22:26:59 +00:00
Ricardo Sánchez-Sáez c570771b4d [ORKGraphChartView] Avoid crash when displaying a graph with no dataSource set 2016-01-14 21:55:50 +00:00
Ricardo Sánchez-Sáez 00ff2f3402 [ORKSample] Allow onboarding to proceed on the Simulator despite the lack of HealthKit 2016-01-14 21:15:59 +00:00
Ricardo Sánchez-Sáez 407de8ed11 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-HomogeneousORKTextFieldView 2016-01-14 20:59:10 +00:00
Ricardo Sánchez-Sáez 6474ebfff7 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-documentationformatting
# Conflicts:
#	ResearchKit/ActiveTasks/ORKTowerOfHanoiStep.h
#	ResearchKit/Common/ORKAnswerFormat_Private.h
2016-01-14 20:57:48 +00:00
Yuan Zhu 340ba7210d Merge branch 'master' of gitlab.sd.apple.com:y_zhu/GitHub-ResearchKit-Fork into convergence_regex_api_change 2016-01-14 10:29:03 -08:00
Yuan Zhu 8c86b8d80d Merge pull request #463 from oliverschaefer/master
Review Step: API Design v1.2
2016-01-13 17:14:58 -08:00
Oliver Schäfer 21c89256fa Merge remote-tracking branch 'apple/master' 2016-01-12 17:19:49 +01:00
Pascal Pfiffner 62ae57bb11 Merge branch 'master' into feature/passcode-override 2016-01-12 14:20:38 +01:00
Yuan Zhu fbc4191081 Merge pull request #599 from ResearchKit/stable
Merge `Stable` into `Master`
2016-01-11 15:50:58 -08:00
Yuan Zhu 429c3c9886 Update the versioning and pod spec 2016-01-11 15:20:01 -08:00
Yuan Zhu 4228cf46c6 Merge pull request #598 from YuanZhu-apple/convergence_batch2
Doc updates and other fixes for convergence
2016-01-11 11:25:46 -08:00
Yuan Zhu 674e06cebc Merge pull request #597 from evliu/master
Samples - ORKCatalog/Charts/ChartListViewController - set prop on dis…
2016-01-08 13:17:32 -08:00
Umer Khan ce31ebd366 Merge branch 'releaseNotes' into 'convergence'
Release notes

See merge request !35
2016-01-08 12:17:11 -08:00
Umer Khan 135ec4a3f2 Minor edits. 2016-01-08 12:10:56 -08:00
Umer Khan a30119aa0d Merge branch 'convergence_active_task_should_resume_properly' into 'convergence'
Convergence active task should resume properly

Fix for <rdar://problem/24095971> ResearchKit: progress for 2 finger tapping stopped after the passcode auth.

Stop using background delivery in health recorder.

See merge request !37
2016-01-07 16:12:36 -08:00
Yuan Zhu 31526c6664 Disable background delivery in health recorder. 2016-01-07 15:29:59 -08:00
Yuan Zhu e5ac62f298 Fix for progress for 2 finger tapping stopped after the passcode auth 2016-01-07 15:29:21 -08:00
Everest Liu ade7f99010 Samples - ORKCatalog/Charts/ChartListViewController - set prop on discreteGraphChartView instead of lineGraphChartView 2016-01-07 13:29:27 -08:00
Yuan Zhu bb1be965a2 Merge branch 'convergence_incorporate_documentation' into 'convergence'
Convergence incorporate documentation

Incorporate documentation update from devpubs.

See merge request !36
2016-01-06 17:42:42 -08:00
Yuan Zhu 3fb266139e More doc update. 2016-01-06 13:59:38 -08:00
Yuan Zhu 0b2216c6cf Update for review. 2016-01-06 13:56:39 -08:00
Yuan Zhu c90d8c7fbd One more merge conflict 2016-01-06 11:06:09 -08:00
Yuan Zhu 3cb705c123 Fix appledoc warnings 2016-01-06 11:03:26 -08:00
vtourraine 94fbd3a6d1 Add includeAssistiveDeviceForm parameter to timed walk task
Make timed walk assistive device form items non-optional
2016-01-06 16:47:31 +01:00
Oliver Schäfer f24a74006a PR updates 2016-01-06 13:27:38 +01:00
Oliver Schäfer 040b9d2220 Merge remote-tracking branch 'apple/master' 2016-01-06 13:18:34 +01:00
Oliver Schäfer 2e1749a14d alert controller bugfixes 2016-01-06 13:09:30 +01:00
Yuan Zhu 1817398f61 Merge branch 'convergence' into convergence_incorporate_documentation
Conflicts:
	ResearchKit/Charts/ORKGraphChartView.h
	ResearchKit/Common/ORKAnswerFormat.h
	ResearchKit/Common/ORKDefines.h
	ResearchKit/Common/ORKNavigableOrderedTask.h
	ResearchKit/Common/ORKResult.h
	ResearchKit/Common/ORKResultPredicate.h
	ResearchKit/Consent/ORKConsentReviewController.m
2016-01-05 23:18:21 -08:00
Umer Khan b542c46189 Formatting fixes. 2016-01-05 18:36:46 -08:00
Umer Khan b6cc636975 Minor fixes. 2016-01-05 18:30:24 -08:00
Umer Khan 1844a0774c Added Sample App info. 2016-01-05 18:29:27 -08:00
Yuan Zhu 6a1343622d Update charts documentation. 2016-01-05 18:00:56 -08:00
Yuan Zhu a3b45b6268 Merge branch 'convergence' of https://github.com/ResearchKit/ResearchKit into convergence 2016-01-05 16:34:20 -08:00
Yuan Zhu 204d5dbf40 Merge pull request #595 from rsanchezsaez/rsanchezsaez-ORKOrderedTask
[ORKOrderedTask] Validate step identifier uniqueness on init
2016-01-05 16:17:59 -08:00
Yuan Zhu f076b69a98 Merge pull request #594 from rsanchezsaez/rsanchezsaez-convergence-ORKGraphChartView
[ORKGraphChartView] Fix wrong selector check on accessibility (convergence)
2016-01-05 16:15:25 -08:00
Yuan Zhu 908b9cb713 Merge pull request #593 from rsanchezsaez/rsanchezsaez-ORKGraphChartView
[ORKGraphChartView] Fix wrong selector check on accessibility
2016-01-05 16:14:23 -08:00
Yuan Zhu ff2c5ad055 Merge pull request #592 from rsanchezsaez/rsanchezsaez-ORKChoiceAnswerFormatHelper
[ORKChoiceAnswerFormatHelper] Relax class checking so choice answer formats can be subclassed
2016-01-05 15:47:05 -08:00
Umer Khan 39e17e7867 Added RK 1.3 notes. 2016-01-05 14:52:53 -08:00
Oliver Schäfer 66fa232ca7 PR updates 2016-01-05 17:09:44 +01:00
Pascal Pfiffner 75ad7512b8 Merge branch 'master' of github.com:ResearchKit/ResearchKit 2016-01-05 10:46:51 +01:00
Ricardo Sánchez-Sáez 8b521477dd [docs] Fix some headerdoc warnings 2016-01-05 03:05:42 +00:00
Ricardo Sánchez-Sáez d60c81b004 [docs] Remove extraneous line from the Programming Guide 2016-01-05 02:52:22 +00:00
Ricardo Sánchez-Sáez a44f2db8fd [ORKOrderedTask] Validate step identifier uniqueness on init 2016-01-05 02:32:56 +00:00
Ricardo Sánchez-Sáez 663426250f [ORKGraphChartView] Fix wrong selector check on accessibility 2016-01-05 02:27:50 +00:00
Ricardo Sánchez-Sáez 58d377d9ab [ORKGraphChartView] Fix wrong selector check on accessibility 2016-01-05 02:24:52 +00:00
Ricardo Sánchez-Sáez e56bf7d217 [ORKChoiceAnswerFormatHelper] Relax class checking so choice answer formats can be subclassed 2016-01-05 01:49:17 +00:00
Ricardo Sánchez-Sáez 28ff1415dd Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-documentationformatting
# Conflicts:
#	README.md
2016-01-05 00:19:28 +00:00
Ricardo Sánchez-Sáez 8cbe836bb2 ORKTextFieldView: proper fix for animation glitch
The text frame sometimes animated from left to right (e.g., in ORKTest's MiniForm, tap 4th text field, type any number and tap any other text field).
Also remove needless period on latest placeholder text.
2016-01-05 00:14:49 +00:00
Ricardo Sánchez-Sáez 2289abf03a ORKFormItemTextFieldBasedCell: Allow temporarily leaving the text field empty without triggering answer validity checking
This fixes a regression. It restores the behavior in which you are allowed to edit a different text field in a form if you leave the current text field blank. E.g., on ORKTest's 'Mini Form', tapping on the first cell text field and then tapping on second cell text field without having written anything should not trigger the alert.
2016-01-04 23:09:35 +00:00
Ricardo Sánchez-Sáez 44ee48fa54 ORKTextField: Hide placeholder when editing a field which has a suffix 2016-01-04 23:00:18 +00:00
Ricardo Sánchez-Sáez b704be75b5 ORKAnswerTextView: fix comment typo 2016-01-04 22:30:54 +00:00
Ricardo Sánchez-Sáez 4048e34530 ORKAnswerTextFieldView: fix whitespace 2016-01-04 22:30:13 +00:00
Ricardo Sánchez-Sáez b34fb01350 ORKAnswerTextView: use the same placeholder approach as in ORKTextFieldView
This creates a non-interactive 'UITextView' for displaying the placeholder at the exact same position as the 'ORKAnswerTextView' text.

It improves encapsulation, the 'ORKAnswerTextView' class handles the placeholder internally.

Also: some minor naming convention improvenets in 'ORKTextFieldView'.
2016-01-04 22:30:09 +00:00
Ricardo Sánchez-Sáez 1b266c3652 ORKTextFieldView: conform to naming and whitespacing conventions 2016-01-04 22:23:58 +00:00
Ricardo Sánchez-Sáez 8ab052577d ORKTextFieldView: fix active unit color being off when there's no placeholder 2016-01-04 21:58:51 +00:00
Ricardo Sánchez-Sáez 1e34cf6d35 ORKTextFieldView: fix unit frame animation glitch
To reproduce, tap on an empty field with unit label and no placeholder (first form item of first step in ORKTest's Miniform).
2016-01-04 21:58:35 +00:00
Ricardo Sánchez-Sáez d39a72e535 ORKTextField: reduce left paddingGuess 2016-01-04 21:58:13 +00:00
Ricardo Sánchez-Sáez 135e2209c8 ORKTextFieldView: whitespace 2016-01-04 21:58:07 +00:00
Ricardo Sánchez-Sáez b865da3a75 ORKTextFieldView: make placeholder behave like 'UITextFieldView' placeholder
# Conflicts:
#	ResearchKit/Common/ORKTextFieldView.m
2016-01-04 21:57:53 +00:00
Ricardo SaÃÅnchez-SaÃÅez 40111a1431 ORKTextFieldView: remove '_unitWithPlaceholder' ivar which was producing extra unneeded padding between the placeholder and the unit 2016-01-04 21:55:34 +00:00
Ricardo Sánchez-Sáez cc45d92266 [ORKSample] Add app icon 2016-01-04 20:00:33 +00:00
Umer Khan 197eb8422a Merge branch 'convergence_fix_responder_check' into 'convergence'
Fix "ORKGraphChartView checks wrong delegate method for respondsToSelector"

Use the correct `respondsToSelector:` checking.

This is an issue reported by https://github.com/ResearchKit/ResearchKit/issues/589

See merge request !34
2016-01-04 11:53:14 -08:00
Yuan Zhu fe10cd8a71 Merge branch 'convergence' of https://github.com/ResearchKit/ResearchKit into convergence 2016-01-04 11:40:16 -08:00
Yuan Zhu 63dfad2b0d Merge pull request #590 from rsanchezsaez/rsanchezsaez-convergence-ORKSampleFix
ORKSample fixes
2016-01-04 11:39:36 -08:00
Yuan Zhu 886605e013 Use the correct respondsToSelector: checking 2016-01-04 10:43:49 -08:00
Oliver Schäfer 1619428bb0 Accessibility updates 2015-12-29 22:07:22 +01:00
Oliver Schäfer 3ae773049a PR updates 2015-12-29 12:20:54 +01:00
Oliver Schäfer 76eb4f97d9 Merge remote-tracking branch 'apple/master' 2015-12-28 17:45:52 +01:00
Ricardo Sánchez-Sáez 4c0a4a1e51 [ORKSample] Fix project
- Add ResearchKit as an embed framework (otherwise it won't run on the device)
- Remove extraneous Development Team
2015-12-23 20:38:24 +00:00
Pascal Pfiffner 12326634db Spaces instead of tabs 2015-12-23 17:30:06 +01:00
Pascal Pfiffner 36b90b813c Merge branch 'master' of https://github.com/ResearchKit/ResearchKit into feature/passcode-override 2015-12-23 17:28:41 +01:00
Yuan Zhu 22b769b786 Merge pull request #588 from YuanZhu-apple/convergence_merge_master
Merge convergence code into master
2015-12-22 14:21:49 -08:00
Yuan Zhu 0afc2027d7 Merge branch 'master' of https://github.com/ResearchKit/ResearchKit into convergence
Conflicts:
	samples/ORKCatalog/ORKCatalog/Results/ResultTableViewProviders.swift
2015-12-22 14:09:54 -08:00
Yuan Zhu aa2b1f9e61 Merge pull request #587 from YuanZhu-apple/convergence_batch
Convergence patch
2015-12-22 12:35:23 -08:00
Pascal Pfiffner a78878c712 Allow to enforce a certain passcode
Comes in handy when moving to ResearchKit's passcode entry from a custom implementation or AppCore.
2015-12-18 11:21:04 +01:00
Pascal Pfiffner f6fd29087b Use instancetype instead of id 2015-12-18 10:48:32 +01:00
Pascal Pfiffner 4517cd445e Merge branch 'master' of github.com:ResearchKit/ResearchKit 2015-12-18 09:38:50 +01:00
Andrew Hill d151e11004 Merge branch 'ResearchKit/master' 2015-12-17 23:23:09 +00:00
John Earl fed9fb9ce6 Merge branch 'convergence_fix_progress_is_missing_on_first_step' into 'convergence'
Fix task progress is missing on first step.

Fix for <rdar://problem/23940893> Question form does not show "1 of 6" progress at the top when the modal is displayed

Since we pulled `currentStepViewController` into `shouldDisplayProgressLabel`, we also need to move progressLabel generation after `currentStepViewController` has been assigned.

Today's `shouldDisplayProgressLabel`:
```
- (BOOL)shouldDisplayProgressLabel {
    return self.showsProgressInNavigationBar && [_task respondsToSelector:@selector(progressOfCurrentStep:withResult:)] && self.currentStepViewController.step.showsProgress;
}
```

See merge request !33
2015-12-17 13:47:00 -08:00
Yuan Zhu 6a786cfb37 Fix task progress is missing on first step. 2015-12-17 13:27:39 -08:00
Umer Khan 39d76c8ed6 Merge branch 'convergence_fix_orksample_dependency' into 'convergence'
Add RK as ORKSample's dependency.

See merge request !31
2015-12-16 16:05:26 -08:00
Yuan Zhu ec9b1c9108 Change regex api to accept NSRegularExpression. 2015-12-16 15:56:28 -08:00
Yuan Zhu 7059bd39a6 Add RK as ORKSample's dependency. 2015-12-16 14:52:28 -08:00
Umer Khan dddc633e3a Merge branch 'convergence_ax_wait_step' into 'convergence'
AX for wait step

From Ryan, even through `UIProgressView` is not accessible.

See merge request !30
2015-12-16 11:18:36 -08:00
Umer Khan 9e358e7fc5 Merge branch 'convergence_fix_catalog_after_verification_step_change' into 'convergence'
API changed after verification step update, need to update ORKCatalog as well.

See merge request !29
2015-12-16 11:10:45 -08:00
Yuan Zhu 0aacde2057 AX for wait step 2015-12-16 10:59:56 -08:00
Yuan Zhu 5bdd973315 Fix unit tests. 2015-12-16 10:30:09 -08:00
Yuan Zhu d7bf7a6ec3 Merge pull request #581 from Sage-Bionetworks/master-sage
Added method to create a copy of a step with a new identifier
2015-12-16 10:03:20 -08:00
Shannon Young 4342caae71 Updated in response to code review. 2015-12-15 18:10:26 -08:00
Yuan Zhu cb4514328e API changed after verification step update, need to update ORKCatalog as well. 2015-12-15 17:49:33 -08:00
Umer Khan 84710f773f Merge branch 'convergence_update_pod_spec' into 'convergence'
Update pod spec to include `swift` files

According to
https://github.com/ResearchKit/ResearchKit/pull/383#issuecomment-161036351

See merge request !28
2015-12-15 16:54:04 -08:00
Yuan Zhu 42005af39c Update pod spec to include swift files
According to
https://github.com/ResearchKit/ResearchKit/pull/383#issuecomment-161036351
2015-12-15 16:51:46 -08:00
Shannon Young f7d7355c49 Added method to create a copy of a step with a new identifier 2015-12-15 14:48:38 -08:00
Yuan Zhu 9c847f8fe6 Merge branch 'passcodeIcon' into 'convergence'
Adding app icon to ORKPasscodeStep.

See merge request !27
2015-12-15 13:06:06 -08:00
Umer Khan aac584b2f1 Resolving merge conflicts. 2015-12-15 11:05:09 -08:00
Yuan Zhu 4be283e888 Localization strings update. 2015-12-14 17:36:31 -08:00
Umer Khan 4d37142873 Merge branch 'convergence_new_sample_app' into 'convergence'
Checkin the new sample app

New app was added as `ORKSample` under `samples` folder.

See merge request !23
2015-12-14 17:06:30 -08:00
Umer Khan 08b48589da Added new metric for icon on vertical container view to support iPad. 2015-12-14 17:04:34 -08:00
Umer Khan 6ba85a1504 Merge branch 'convergence_accessibility_fix_value_picker' into 'convergence'
Accessibility fix value picker

R=me.

From Ryan:
This next issue is with VoiceOver speaking the wrong words when changing ORKValuePicker’s value.  Ultimately, we need to fix this on our side:
<rdar://problem/23885294> UITextField AX broken when connected as the firstResponder to a UIPicker.

I have attached a workaround patch to rdar://problem/23710698. The problem is that when we change the value of the picker and a text field is the firstResponder, VoiceOver thinks this is a selection changed event and reads the delta change. For example, going from Male to Female, the delta is “LE.” The workaround is, since this textfield is not editable, to keep the selectedTextRange as 0,0 so that VO doesn’t do the selection changed behavior.

Please let me know if you have any questions!

See merge request !26
2015-12-14 16:54:18 -08:00
Yuan Zhu 5fc4316e22 Auto deselect selected cell on profile page. 2015-12-14 16:54:18 -08:00
Yuan Zhu 287dcd979c Merge branch 'verificationRedesign' into 'convergence'
Verification Step redesign.

Verification step redesign as per HI.

See merge request !20
2015-12-14 16:47:48 -08:00
Umer Khan 29f2d16676 Adding app icon to ORKPasscodeStep. 2015-12-14 16:46:33 -08:00
Yuan Zhu b022ae3589 Limit minimum date in answer format to current time. 2015-12-14 16:46:02 -08:00
Umer Khan 76bbbbe604 Delegate callback refactor for keyboard on ORKPasscodeStepViewController. 2015-12-14 16:40:32 -08:00
Umer Khan a322f0b17f Minor refactor. 2015-12-14 16:32:55 -08:00
Yuan Zhu f11d17752f Accessibility fix value picker
From Ryan:
This next issue is with VoiceOver speaking the wrong words when changing ORKValuePicker’s value.  Ultimately, we need to fix this on our side:
<rdar://problem/23885294> UITextField AX broken when connected as the firstResponder to a UIPicker.

I have attached a workaround patch to rdar://problem/23710698. The problem is that when we change the value of the picker and a text field is the firstResponder, VoiceOver thinks this is a selection changed event and reads the delta change. For example, going from Male to Female, the delta is “LE.” The workaround is, since this textfield is not editable, to keep the selectedTextRange as 0,0 so that VO doesn’t do the selection changed behavior.

Please let me know if you have any questions!
2015-12-14 14:32:10 -08:00
Umer Khan 14a815d63e Merge branch 'convergence_fix_merge_crash_bug' into 'convergence'
The `break` was in wrong place which let `confirmAnswerFormat` use a `scaleCell` instead.

It is used to crash `registration test`.

See merge request !25
2015-12-14 14:18:09 -08:00
Yuan Zhu 1b4b0166b8 The break was in wrong place which let confirmAnswerFormat use a scaleCell instead. 2015-12-14 14:13:01 -08:00
Umer Khan 669269fd45 Merge branch 'convergence_full_length_seperator_line' into 'convergence'
Apply full width section separator on from/question page (including location question)

![Simulator_Screen_Shot_Dec_10__2015__5.49.40_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/e6dc184239617bcde03b39a8d8588ca8/Simulator_Screen_Shot_Dec_10__2015__5.49.40_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.49.37_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/74494292d8cdffb621c1d7b9fa4266d6/Simulator_Screen_Shot_Dec_10__2015__5.49.37_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.49.24_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/50e45d20f29ac510f927d823fb9ede2e/Simulator_Screen_Shot_Dec_10__2015__5.49.24_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.49.33_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/e0e80fe5241088ed55c1d1878e01497b/Simulator_Screen_Shot_Dec_10__2015__5.49.33_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.49.06_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/b42e3e4005363bd00e4e7f6c144ddde9/Simulator_Screen_Shot_Dec_10__2015__5.49.06_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.49.07_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/fb4889714cfa2c1ed6bf7ca80b2d9cf7/Simulator_Screen_Shot_Dec_10__2015__5.49.07_PM.png)
![Simulator_Screen_Shot_Dec_10__2015__5.48.59_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/11232d3553fd1b5d477f81212f5981c4/Simulator_Screen_Shot_Dec_10__2015__5.48.59_PM.png)

See merge request !22
2015-12-11 16:01:59 -08:00
Yuan Zhu 3f7c1d15d5 Checkin the new sample app 2015-12-11 15:46:30 -08:00
Yuan Zhu ca136a9ce1 Merge branch 'convergence' of gitlab.sd.apple.com:y_zhu/GitHub-ResearchKit-Fork into convergence_full_length_seperator_line
Conflicts:
	ResearchKit/Common/ORKFormStepViewController.m
2015-12-11 14:11:29 -08:00
Yuan Zhu fe2ea1e3d8 Merge branch 'eligFix' into 'convergence'
Removed eligibility module.

As per HI, the eligibility module should re-use the text choice answer format look and feel. This PR removes the current `ORKEligbilityAnswerFormat` and updates `ORKTest` and `ORKCatalog` examples of eligibility using `ORKTextChoiceAnswerFormat`.

See merge request !17
2015-12-11 13:30:50 -08:00
Yuan Zhu eedcff0ab0 Merge branch 'passcodeFix' into 'convergence'
Passcode keyboard orientation fix.

The orientation for the passcode step was not being registered from `supportedInterfaceOrientations`, so this fix forwards that instance method to a class method of the same name to retrieve the value. This allows the Task View Controller to retrieve the values before the class is initialized.

See merge request !16
2015-12-11 13:24:28 -08:00
Yuan Zhu 00bd267c1b Apply full width section separator on from/question page (including location question) 2015-12-10 17:52:28 -08:00
Umer Khan d9c005aa18 Refactored eligibility survey also. 2015-12-10 16:40:27 -08:00
Umer Khan be02e1a22a Refactored eligibility task. 2015-12-10 16:38:59 -08:00
Umer Khan b474f6f12d Added additional documentation. 2015-12-10 14:45:33 -08:00
Yuan Zhu bc263d92af Merge branch 'convergence_accessibility_fix_for_account_creation' into 'convergence'
Accessibility fix for password field

<rdar://problem/23829496> RK Accessibility Account creation control issues

I looked, it is good to me.

See merge request !21
2015-12-10 13:13:39 -08:00
Yuan Zhu 0575f21c3e Accessibility fix for password field: <rdar://problem/23829496> RK Accessibility: Account creation control issues 2015-12-09 17:58:57 -08:00
Umer Khan 88543a14d6 Verification Step redesign. 2015-12-09 17:11:35 -08:00
Yuan Zhu cd8a801738 Merge branch 'verificationRedesign' into 'convergence'
Added new strings for verification step and removed old strings.

See merge request !19
2015-12-09 15:04:26 -08:00
Umer Khan 30af7f46f7 Merge branch 'convergence_new_icon_from_hi' into 'convergence'
Use the new icon for ORKTest app

See merge request !18
2015-12-09 14:59:46 -08:00
Umer Khan 1e889ad7dc Added new strings for verification step and removed old strings. 2015-12-09 14:58:06 -08:00
Umer Khan 839c8eca53 Removed class method forwarding. 2015-12-09 14:40:14 -08:00
Yuan Zhu 48ed4b3771 Use the new icon for ORKTest app 2015-12-09 14:23:07 -08:00
Umer Khan e6f4c1deb8 Merge branch 'convergence_peg_test_missing_spoken_instruction_on_last_step' into 'convergence'
All other three of four testing steps has spoken instruction.

For <rdar://problem/23778535> [Clout]: US: RedRiver7M1453: No VoiceOver speaks at the Page of 'Put the peg behind the line using your left hand.'

See merge request !13
2015-12-09 12:47:24 -08:00
Umer Khan ae2bff43fa Merge branch 'convergence_support_multiline_in_form_header' into 'convergence'
Wrap text in form header view if the text is long.

Wrap text in form header view if the text is long.

![Simulator_Screen_Shot_Dec_8__2015__6.00.30_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/84632e2b1a3e61e56983168ddfa4e3c7/Simulator_Screen_Shot_Dec_8__2015__6.00.30_PM.png)

See merge request !14
2015-12-09 12:45:53 -08:00
Umer Khan 14260e0df1 Merge branch 'convergence_add_icon_for_ipad_pro' into 'convergence'
Add app icons for iPad pro

See merge request !15
2015-12-09 12:40:06 -08:00
Umer Khan 4153702c2d Removed eligibility answer format, survey cell, form item cell, and implementations from ORKTest and ORKCatalog. 2015-12-09 12:08:34 -08:00
Umer Khan a9494ce5d8 Passcode keyboard orientation fix. 2015-12-09 11:04:13 -08:00
Yuan Zhu 0b06d4c18a Add app icons for iPad pro 2015-12-09 10:41:22 -08:00
Yuan Zhu 2b6d1fcab9 Wrap text in form header view if the text is long. 2015-12-08 17:59:25 -08:00
Oliver Schäfer 610ce5aefd Merge remote-tracking branch 'apple/master' 2015-12-08 22:01:56 +01:00
Oliver Schäfer bd52a14196 Minor PR updates 2015-12-08 22:01:44 +01:00
Yuan Zhu eb52acefa9 All other three of four testing steps has spoken instruction. 2015-12-08 12:55:14 -08:00
Pascal Pfiffner 423a89c879 Merge branch 'master' of github.com:ResearchKit/ResearchKit 2015-12-07 16:51:07 -05:00
Oliver Schäfer e444086399 PR updates 2015-12-06 13:13:33 +01:00
Umer Khan 82de8783bd Merge branch 'convergence_fix_wait_step_progessview_size' into 'convergence'
Fix the size of progress view in wait step.

Also documented the view hierarchy of ORKVerticalContainerView

See reopened radar:
<rdar://problem/23638006> ResearchKit: updateText of ORKWaitStepViewController does not work as expected

See merge request !12
2015-12-04 16:39:52 -08:00
Yuan Zhu 0dea3dd673 Localization strings update 2015-12-04 13:51:39 -08:00
Yuan Zhu 6f4c072f93 Fix the size of progress view in wait step.
Also documented the view hierarchy of ORKVerticalContainerView
2015-12-04 12:17:13 -08:00
Oliver Schäfer 0ed1df3945 PR changes 2015-12-04 13:36:38 +01:00
Yuan Zhu fee0d2d7b6 Merge branch 'regexFix' into 'convergence'
Added validation checking for Text Survey Cell.

Currently, text validation from ORKTextAnswerFormat is only applied to ORKFormItemCell.
This patch adds the validation checking to ORKSurveyAnswerCellForText.

This is in response to a radar generated by QA.
radar://23695918

See merge request !9
2015-12-03 13:26:55 -08:00
Oliver Schäfer d71ab9538c PR updates 2015-12-03 22:08:37 +01:00
Oliver Schäfer 7caaf525e3 PR updates 2015-12-03 13:05:22 +01:00
Umer Khan 610a1fd93f Minor fix. 2015-12-02 16:05:44 -08:00
Umer Khan 36bda05556 Merge branch 'convergence_ax_scale_question_fix' into 'convergence'
Fix for <rdar://problem/23710807> RK Accessibility: Scale Question

`swipe up` by passed the normal `touch to assign value` process, thus, set `showThumb = YES;` is required.

From Ryan:
1. Tap the slider
(No value is read)
(VoiceOver cursor is moved to the slider element)

2. Swipe up to increment the value (i.e. calls accessibilityIncrement which calls axBumpValue)

Expected Behavior:
Now that we incremented the slider, it has a value and should be spoken.

Actual Behavior:
No value is spoken.
(In the debugger, I can see showThumb is NO, thus we don’t speak an accessibilityValue).

Conclusion:
It seems to me once you made a change to the slider’s value (via accessibilityIncrement or accessibilityDecrement), showThumb should become YES.

See merge request !11
2015-12-02 16:03:43 -08:00
Yuan Zhu 069ea16731 Merge branch 'passcodeFix' into 'convergence'
Locked Passcode View Controllers to portrait only.

The Passcode View Controllers truncate the passcode text field in landscape mode.
To avoid this problem, this PR locks the passcode view controller orientation to portrait only.
This solves the stated problem and provides a more intuitive UI for passcode entry.

This is in response to the radar generated by QA.
radar://23713589

See merge request !10
2015-12-02 15:35:22 -08:00
Umer Khan a1ed3ea711 Refactored continue button logic and removed validation logic from textfield delegate. 2015-12-02 15:27:12 -08:00
Yuan Zhu d910062bb9 Merge branch 'dobFix' into 'convergence'
Add current date to maximum date for ORKRegistrationStep's dob answer format.

See merge request !7
2015-12-02 14:57:02 -08:00
Yuan Zhu ba5d80c6c1 Fix for <rdar://problem/23710807> RK Accessibility: Scale Question
`swipe up` by passed the normal `touch to assign value` process, thus, set `showThumb = YES;` is required.

From Ryan:
1. Tap the slider
(No value is read)
(VoiceOver cursor is moved to the slider element)

2. Swipe up to increment the value (i.e. calls accessibilityIncrement which calls axBumpValue)

Expected Behavior:
Now that we incremented the slider, it has a value and should be spoken.

Actual Behavior:
No value is spoken.
(In the debugger, I can see showThumb is NO, thus we don’t speak an accessibilityValue).

Conclusion:
It seems to me once you made a change to the slider’s value (via accessibilityIncrement or accessibilityDecrement), showThumb should become YES.
2015-12-02 14:38:54 -08:00
Umer Khan 21ada70ae4 Locked Passcode View Controllers to portrait only. 2015-12-02 14:28:53 -08:00
Umer Khan 9be3f057be Added validation checking for Text Survey Cell. 2015-12-02 13:43:02 -08:00
Umer Khan 51c23ccf17 Changed dispatch_once to an ivar. 2015-12-01 16:20:22 -08:00
Umer Khan 113b7422a0 Added additional initializer. 2015-12-01 16:09:08 -08:00
Umer Khan c852c62262 Added static, updated formItems to generate today's date for maximumDate, and fixed serialization issues. 2015-12-01 15:50:52 -08:00
Yuan Zhu c27b784870 Merge branch 'convergence' of https://github.com/ResearchKit/ResearchKit into convergence 2015-12-01 15:31:58 -08:00
Yuan Zhu c3102d6183 Merge branch 'convergence' 2015-12-01 15:31:04 -08:00
Andrew Hill 2510bc7f97 Correct Destionation
Changed all instances of Destionation to Destination
2015-12-01 15:30:04 -08:00
Tom Welsh de7860b60a Allow ORKLoginStepViewController to be subclassed by making the class symbol visible 2015-12-01 15:28:35 -08:00
Yuan Zhu 37c65bdc55 Merge branch 'convergence' of https://github.com/ResearchKit/ResearchKit into convergence 2015-12-01 14:40:52 -08:00
Umer Khan 4fe13d0b27 Minor refactor. 2015-12-01 13:29:29 -08:00
Umer Khan 853d4384fd Refactored registration form items generation. 2015-12-01 13:16:43 -08:00
Yuan Zhu f9669508dc Merge branch 'tappingResultBugFix' into 'convergence'
Tapping sample result bug fix.

See merge request !8
2015-12-01 10:29:32 -08:00
Umer Khan e1ea72b861 Tapping sample result bug fix. 2015-11-30 17:58:46 -08:00
Umer Khan 1cf445af09 Add current date to maximum date for ORKRegistrationStep's dob answer format. 2015-11-30 14:03:53 -08:00
Yuan Zhu fc1c328b68 localized strings update on convergence branch. 2015-11-30 13:26:47 -08:00
Umer Khan 7b7a851cca Merge branch 'convergence_fix_pie_chart_label_overlap' into 'convergence'
Fix issue https://github.com/ResearchKit/ResearchKit/issues/558

Corrected the calculation inside `ORKCenteredCollectionViewLayout`

To test, update `ChartDataSources.swift`'s `pieChartView` method to be like this:
```
     func pieChartView(pieChartView: ORKPieChartView, titleForSegmentAtIndex index: Int) -> String {
        switch index {
        case 0:
            return "Steps"
        case 1:
            return "Tasks"
        case 2:
            return "Surveys completed"
        default:
            return "test"
        }
     }

```

After this fix:

![Screen_Shot_2015-11-19_at_6.02.59_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/d574cf99032e90264eee6afaf3370ad9/Screen_Shot_2015-11-19_at_6.02.59_PM.png)

See merge request !3
2015-11-30 13:16:44 -08:00
Umer Khan 37ac134b5e Merge branch 'convergence_change_activity_indicator' into 'convergence'
Change to use system activity indicator in wait step.

![Simulator_Screen_Shot_Nov_20__2015__3.26.51_PM](https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork/uploads/20c83818ac6c6be1debef7bef0f8be9c/Simulator_Screen_Shot_Nov_20__2015__3.26.51_PM.png)

See merge request !5
2015-11-30 13:16:21 -08:00
Umer Khan 067f8f8e3d Merge branch 'convergence_add_ORKWaitStepViewController_to_RK.h' into 'convergence'
Make WaitStepVC public and add it to `ResearchKit.h`

This is a fix for `<rdar://problem/23621910> ResearchKit: ORKWaitStepViewController.h is not included in the <ResearchKit/ResearchKit.h>`

See merge request !4
2015-11-30 13:13:25 -08:00
Umer Khan 7d30dd09f3 Merge branch 'convergence_loc_two_lines' into 'convergence'
Fix for rdar://problem/23574379 [Clout]: RS: RedRiver7M1408: Clipping string…

Make buttons and labels multilines.

See merge request !2
2015-11-30 12:55:28 -08:00
Oliver Schäfer 73495244be PR change 2015-11-30 21:31:52 +01:00
Yuan Zhu 85dd559217 Merge pull request #575 from UberJason/master
Fixed build error in ResultTableViewProviders.swift caused by an outdated property.
2015-11-30 10:44:03 -08:00
Jason Ji 81c8c10ebc Fixed build error in ResultTableViewProviders.swift caused by an outdated property. 2015-11-24 20:12:48 -05:00
Yuan Zhu 19921baf55 Merge pull request #569 from shazino/convergence
Fix PSAT progress indicator tint color.
2015-11-23 14:24:36 -08:00
Yuan Zhu 63a7e30049 Merge pull request #573 from tomihisaw/master
Allow ORKLoginStepViewController to be subclassed by making the class…
2015-11-23 14:23:47 -08:00
Tom Welsh 8fa839a66b Allow ORKLoginStepViewController to be subclassed by making the class symbol visible 2015-11-23 14:02:47 -05:00
Julien Therier ffd8552aa8 Fix PSAT progress indicator tint color. 2015-11-21 11:48:42 +01:00
Yuan Zhu 140e1ebae0 Fix for rdar://problem/23638006 ResearchKit: updateText of ORKWaitStepViewController does not work as expected 2015-11-20 17:33:05 -08:00
Yuan Zhu 9338ea8b59 Use RK native layout instead of custom layout. 2015-11-20 16:15:33 -08:00
Yuan Zhu 63d56e44f8 Change to use system activity indicator in wait step. 2015-11-20 15:22:23 -08:00
Yuan Zhu 3daf9484c4 Make WaitStepVC public and add it to ResearchKit.h 2015-11-20 11:21:26 -08:00
Yuan Zhu d87372923b Fix issue https://github.com/ResearchKit/ResearchKit/issues/558
Corrected the calculation inside `ORKCenteredCollectionViewLayout`
2015-11-19 17:58:53 -08:00
Yuan Zhu 3dccc6d438 Fix radar <rdar://problem/23574379> [Clout]: RS: RedRiver7M1408: Clipping string RESEND_EMAIL_BUTTON_TITLE.
Make buttons and labels multiline.
2015-11-19 14:32:03 -08:00
Oliver Schäfer f8a77a1b1e Read only message 2015-11-19 20:24:11 +01:00
Oliver Schäfer ddc0016bd1 Disable skip button 2015-11-19 20:00:57 +01:00
Yuan Zhu 50cf8171f5 Change english string for "LOCATION_ERROR_TITLE" 2015-11-18 17:03:23 -08:00
Yuan Zhu d2c51201ef Strings update 2nd round 2015-11-18 15:53:49 -08:00
Yuan Zhu 8a320f0b72 Use seperate string for left and right hand. 2015-11-18 14:03:54 -08:00
Oliver Schäfer 8b81a8c5f1 Merge remote-tracking branch 'apple/master' 2015-11-18 22:55:22 +01:00
Oliver Schäfer ff673f0ad4 Fixed header comment typos 2015-11-18 22:50:03 +01:00
Oliver Schäfer 116a8e08ad Changed animation direction 2015-11-18 22:40:24 +01:00
Yuan Zhu 2988cb0fa6 Change circle to peg 2015-11-18 13:07:34 -08:00
Yuan Zhu 59788e53ec change the string of "PASSCODE_INVALID_ALERT_TITLE" 2015-11-18 10:52:31 -08:00
Yuan Zhu 09e717c69f Merge pull request #564 from md0u80c9/CorrectDestionation
CorrectDestionation
2015-11-18 10:34:49 -08:00
Oliver Schäfer 9b1bdd390c PR changes, added documentation 2015-11-18 15:28:23 +01:00
Yuan Zhu af823d1f63 Change WiFi to Wi-Fi 2015-11-17 18:09:59 -08:00
Yuan Zhu 75ac5d3366 Fix typo. 2015-11-17 17:50:56 -08:00
Oliver Schäfer b113ef0ee3 PR updates 2015-11-17 21:52:23 +01:00
Andrew Hill 8e49cbc733 Correct Destionation
Changed all instances of Destionation to Destination
2015-11-17 13:47:25 +00:00
Andrew Hill 37cfadf81a Merge branch 'ResearchKit/master' 2015-11-16 22:29:18 +00:00
Yuan Zhu 932024c4af Loc en string fixes 2015-11-13 15:16:15 -08:00
Yuan Zhu 26cf7e4d64 add ORK_CLASS_AVAILABLE for ORKLoginStepViewController 2015-11-13 15:12:24 -08:00
Yuan Zhu fa2b18da42 1st round localization 2015-11-13 12:52:07 -08:00
Oliver Schäfer fb778eefcf Bug fix 2015-11-13 09:41:25 +01:00
Oliver Schäfer f384f9137d Bug fixes 2015-11-12 22:24:12 +01:00
Oliver Schäfer 2f19a3e089 PR updates, bug fix 2015-11-12 21:44:04 +01:00
Oliver Schäfer b112945365 PR update 2015-11-11 21:13:38 +01:00
Oliver Schäfer 58c12a025b Changed review step ui for better navigation 2015-11-11 18:56:31 +01:00
Yuan Zhu 304d93a79a Add charts sections 2015-11-10 14:21:39 -08:00
Yuan Zhu a57a8d8370 Merge pull request #383 from rsanchezsaez/rsanchezsaez-navigationrules
Add Swift tuple initializer overlay to ORKPredicateStepNavigationRule
2015-11-09 10:31:44 -08:00
Oliver Schäfer 2aa09084c8 PR updates 2015-11-06 22:16:43 +01:00
Oliver Schäfer 4d16e39f73 Merge remote-tracking branch 'apple/master' 2015-11-06 21:21:13 +01:00
Yuan Zhu d44676d816 Merge pull request #559 from umerkhan-apple/localizationBug
ORKCatalog Localization Files
2015-11-05 11:10:08 -08:00
Yuan Zhu 18d50721cc Merge pull request #556 from rsanchezsaez/rsanchezsaez-ORKTestNamingConventions
ORKTest: improve some class and method names
2015-11-05 10:52:21 -08:00
Yuan Zhu 967518a576 Merge pull request #557 from umerkhan-apple/readme
Updating README for RK Forum.
2015-11-05 10:39:09 -08:00
Yuan Zhu ef8c1e1b3a Merge pull request #553 from YuanZhu-apple/master_location_question_enhancement
Switch `ORKLocationResult`'s answer from `ORKPlacemark` to `ORKLocation`
2015-11-05 10:38:57 -08:00
Yuan Zhu 6563ebdca4 Clean up NSLog 2015-11-05 10:38:34 -08:00
Yuan Zhu f85faecb49 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master_location_question_enhancement 2015-11-05 10:28:08 -08:00
Umer Khan 0341e511ab Adding localization files for all other supported languages. No translations, only placeholder files in order to enable localization for RK Framework strings. 2015-11-04 17:07:53 -08:00
Oliver Schäfer 59d2ed7a39 PR updates 2015-11-04 21:54:53 +01:00
Umer Khan 8f9ab33897 Updating README for RK Forum. 2015-11-04 10:52:47 -08:00
Oliver Schäfer e5a4d01039 Merge remote-tracking branch 'apple/master' 2015-11-04 05:45:38 +01:00
Oliver Schäfer e7aac14571 PR update to fix ORKTextScaleAnswerFormat crash and re-connect embedded and standalone review step in ORKTest 2015-11-04 05:41:11 +01:00
Yuan Zhu 372fbaaaa4 Merge pull request #546 from huguesbr/master
Fix localization when using  ResearchKit as Pod (Localizable.strings > ResearchKit.strings)
2015-11-03 16:19:48 -08:00
Hugues Bernet-Rollande a3c28f666c re-add missing white space 2015-11-04 01:01:33 +01:00
Ricardo Sánchez-Sáez 4c34d1e8a3 ORKCatalog: improve naming conventions and documentation for VerificationViewController and LoginViewController subclass examples 2015-11-03 23:08:17 +00:00
Ricardo Sánchez-Sáez 50c0d4b3c0 ORKTest: improve code for Wait Task progress update 2015-11-03 22:24:35 +00:00
Oliver Schäfer 746b0866b0 PR changes related to displaying results 2015-11-03 22:23:27 +01:00
Hugues Bernet-Rollande 4b269b8c21 Updating docs to reflect new name of localized strings (ResearchKit.strings) 2015-11-03 09:30:19 +01:00
Hugues Bernet-Rollande 143b474aff Rename Localizable.strings file to ResearchKit.strings and use table name in localization, avoiding conflict when including ResearchKit as a pod (the Localizable.strings files conflict with project one) 2015-11-03 09:30:19 +01:00
Yuan Zhu ca11a8def0 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master_location_question_enhancement
Conflicts:
	ResearchKit.xcodeproj/project.pbxproj
2015-11-02 17:42:22 -08:00
Yuan Zhu 09cb204a24 Add copyright line. 2015-11-02 11:01:21 -08:00
Ricardo Sánchez-Sáez 20204946bc ORKTest: change case in comments 2015-11-01 22:20:20 +00:00
Ricardo Sánchez-Sáez 74dc33a654 ORKTest: improve some class and method names 2015-11-01 22:18:17 +00:00
Andrew Hill 11a29435cd Merge branch 'ResearchKit/master' 2015-11-01 09:01:21 +00:00
Yuan Zhu f738f18570 Update to PR to improve UI experience. 2015-10-30 12:43:31 -07:00
Nidhi Gupta 7af35c7c35 Replace old PAVSAT screen shoots to reflect PASAT 2015-10-29 11:00:46 -07:00
Yuan Zhu ca2f7848f8 Merge pull request #538 from umerkhan-apple/account
Onboarding - Account Module
2015-10-28 13:48:21 -07:00
Umer Khan 85097a5e20 PR updates. 2015-10-28 13:20:48 -07:00
Yuan Zhu 60af4ce1e5 Address PR feedback, remove location question from selection survey 2015-10-27 17:56:36 -07:00
Umer Khan 8c10abfd74 Removing cancel button customization for Registration step. 2015-10-27 15:13:24 -07:00
Umer Khan 0f97c0704a Update cancel button actions for Login and Registration step. 2015-10-27 14:56:36 -07:00
Nidhi Gupta a9ea108054 Incorporated edits for the new features. 2015-10-27 14:35:32 -07:00
Yuan Zhu ac0a9a25d6 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master_location_question_enhancement 2015-10-27 13:07:38 -07:00
Yuan Zhu 4ca0197532 Switch ORKLocationResult's answer from ORKPlacemark to ORKLocation
Create location questions task in ORKTest
2015-10-27 13:07:24 -07:00
Yuan Zhu e021f815ca Merge pull request #551 from umerkhan-apple/imageCaptureBug
IOI # 517 - Image capture no permissions bug
2015-10-26 17:11:46 -07:00
Yuan Zhu 1492ab82c1 Merge pull request #550 from umerkhan-apple/eligFix
IOI # 549 - Eligibility Tint Color Fix
2015-10-26 17:11:40 -07:00
Umer Khan 61408fc5f6 Consolidated tint color change method. 2015-10-26 16:28:38 -07:00
Ricardo Sánchez-Sáez 0459818613 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules
# Conflicts:
#	Testing/ORKTest/ORKTest.xcodeproj/project.pbxproj
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-10-26 22:43:35 +00:00
Umer Khan 99bdc3cbbc Merging upstream/master 2015-10-26 15:38:23 -07:00
Umer Khan c0b751d05a Fixed error handling bug for image capture step. 2015-10-26 15:29:33 -07:00
Nidhi Gupta d3ed706680 Merge branch 'stable1.2_documentation' of https://gitlab.sd.apple.com/y_zhu/GitHub-ResearchKit-Fork into stable1.2_documentation 2015-10-26 15:02:48 -07:00
Nidhi Gupta d5175083ef Incorporated edits for the rest of the classes. 2015-10-26 15:02:20 -07:00
Umer Khan 721572a533 Minor update. 2015-10-26 12:44:42 -07:00
Umer Khan 2494895cf9 Tint color toggle bug fix. 2015-10-26 12:23:15 -07:00
Oliver Sch√§fer 00886afe69 Displaying results for ORKLocationAnswerFormat 2015-10-26 17:53:24 +01:00
Oliver Schäfer fdd608fee4 Merge remote-tracking branch 'apple/master' 2015-10-26 17:30:54 +01:00
Andrew Hill b630dff27e Merge branch 'ResearchKit/master' 2015-10-25 20:28:57 +00:00
Oliver Sch√§fer c41fac8023 Displaying results 2015-10-25 18:27:34 +01:00
Yuan Zhu 160b7c5f71 Merge pull request #478 from QuintilesRK/LocationQuestion
Location Question Type
2015-10-23 16:50:57 -07:00
Brandon McQuilkin 1b5ea88e0f Fixed issue causing tests to fail. 2015-10-22 15:13:48 -04:00
Brandon McQuilkin dd42f4740e Accidentally removed required import on merge. 2015-10-22 12:21:05 -04:00
Brandon McQuilkin 1f26d5c5a1 Merge branch 'master' of https://github.com/ResearchKit/ResearchKit into LocationQuestion
Conflicts:
	ResearchKit/Common/ORKResult.m
2015-10-22 12:16:54 -04:00
Brandon McQuilkin 0a07f24bea Removed unused error message. 2015-10-22 08:27:44 -04:00
Brandon McQuilkin 224146f7fd Handle errors that can be returned by the CLLocationManager that do not apply to the functionality of the selection view by silently absorbing the error. 2015-10-22 08:27:06 -04:00
Brandon McQuilkin 5e7768483e Forgot to add localizable strings. 2015-10-22 08:24:36 -04:00
Andrew Hill 2819b7714d Merge branch 'ResearchKit/master' 2015-10-22 07:55:27 +01:00
Oliver Schäfer 81ec1f0056 Merge remote-tracking branch 'apple/master' 2015-10-22 00:10:02 +02:00
Oliver Sch√§fer 36f710739d PR updates 2015-10-22 00:05:11 +02:00
Yuan Zhu 66884c045b Merge pull request #513 from rsanchezsaez/rsanchezsaez-NavigableOrderedTask
Use results for backwards navigation in 'ORKNavigableOrderedTask'
2015-10-21 13:47:55 -07:00
Oliver Sch√§fer 04f5a9e9f6 PR changes 2015-10-21 20:14:18 +02:00
Brandon McQuilkin e7ca832c3d Updated error handling. 2015-10-21 08:59:33 -04:00
Umer Khan af3285f5f0 Bug fix for confirm answer format. 2015-10-20 22:17:41 -07:00
Umer Khan 50cd9055ac PR updates and added example to ORKTest. 2015-10-20 19:48:53 -07:00
Umer Khan d0226f29f7 Merge remote-tracking branch 'upstream/master' into account 2015-10-20 18:37:00 -07:00
Umer Khan eceeab053d PR feedback changes. 2015-10-20 18:36:30 -07:00
Andrew Hill aa2e83e2b5 Merge branch 'ResearchKit/master' 2015-10-20 19:09:40 +01:00
Yuan Zhu de0019054a Merge pull request #533 from md0u80c9/ORKFormItem-optionalConvenienceInit
ORKFormItem optionalConvenienceInit
2015-10-20 10:47:44 -07:00
Brandon McQuilkin cbf9d7284f Removed location question from form example. 2015-10-20 08:40:52 -04:00
Brandon McQuilkin 00183879ce Removed if statement left over from debugging. 2015-10-20 08:39:04 -04:00
Brandon McQuilkin 58453f5df9 Pulled edge to edge presentation logic into init. 2015-10-20 08:37:50 -04:00
Umer Khan 9c65780911 Updated confirm text answer format validation logic. 2015-10-19 18:47:23 -07:00
Ricardo Sánchez-Sáez f7f8e12d9d ORKResult: add indentation for collection classes description 2015-10-20 02:41:30 +01:00
Ricardo Sánchez-Sáez ee494c5ed1 ORKResult: add 'numberOfPaddingSpacesForIndentationLevel' constant 2015-10-20 02:30:08 +01:00
Ricardo Sánchez-Sáez 12a2d556c9 ORKHelpers: simplify 'ORKPaddingWithNumberOfSpaces' function by using Foundation API 2015-10-20 02:27:44 +01:00
Yuan Zhu ce6d4fe3ac Fix links in survey page. 2015-10-19 18:19:22 -07:00
Umer Khan 05f2fe9db4 Minor update to DOB form item in ORKRegistrationStep. 2015-10-19 15:24:52 -07:00
Umer Khan 7e8175b8a2 Added more error checking and updated registration step to adjust given & family name for locale. 2015-10-19 14:49:09 -07:00
Umer Khan c3460d8aaa Refactored string constants for login step form items. 2015-10-19 14:09:23 -07:00
Umer Khan 886bca74bf PR review modifications. 2015-10-19 14:03:36 -07:00
Andrew Hill 79deaaa4b2 Merge branch 'ResearchKit/master' 2015-10-19 19:11:34 +01:00
Umer Khan 53bb638c69 Minor fix. 2015-10-19 11:07:25 -07:00
Umer Khan 3d40007df9 Minor documentation updates. 2015-10-19 10:57:48 -07:00
Brandon McQuilkin 5070517ba3 Removed unnecessary lines. 2015-10-19 13:17:00 -04:00
Brandon McQuilkin 5bca8eb66d Updated ORKLocationQuestionResult's copy method. 2015-10-19 08:25:05 -04:00
Brandon McQuilkin 4dff0189df Removed unnecessary hash method override. 2015-10-19 08:24:09 -04:00
Brandon McQuilkin 9e1e855b70 Fixed ORKLocationQuestionResult's answer format. 2015-10-19 08:21:20 -04:00
Brandon McQuilkin 4e7f24f1c2 Reverted indentation changes to ORKESerialization. 2015-10-19 08:20:11 -04:00
Brandon McQuilkin 3229df2a48 Updated the default location place holder string's key. 2015-10-19 08:18:41 -04:00
Ricardo Sánchez-Sáez 7bc407ee90 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules 2015-10-19 01:50:43 +01:00
Ricardo Sánchez-Sáez 96e94155d7 ORKTest: fix serialization tests 2015-10-19 01:49:15 +01:00
Ricardo Sánchez-Sáez b8b5648c71 ORKResult: improve indentantion of collection results' 'description' 2015-10-19 01:42:30 +01:00
Ricardo Sánchez-Sáez 0471bf61d4 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-NavigableOrderedTask
# Conflicts:
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-10-18 20:24:10 +01:00
Andrew Hill a0ca62ec23 Reordered the initialisers per YuanZhu's feedback. 2015-10-18 00:02:30 +01:00
Oliver Sch√§fer a581d58243 Bug fixes 2015-10-17 16:44:59 +02:00
Oliver Sch√§fer 718a4d3ed7 PR changes 2015-10-17 12:49:24 +02:00
Oliver Sch√§fer 9241848bc3 PR changes 2015-10-17 11:09:35 +02:00
Oliver Sch√§fer 913be47d6d Fixed corruption of project.pbxproj 2015-10-17 11:00:46 +02:00
Oliver Sch√§fer 88a94e106b PR Changes 2015-10-17 10:47:17 +02:00
Oliver Schäfer 2469bfe5a3 Merge remote-tracking branch 'apple/master' 2015-10-17 10:45:19 +02:00
Oliver Sch√§fer 6ec5df751d PR changes 2015-10-17 10:40:14 +02:00
Umer Khan aac14a3a1a Minor formatting fixes. 2015-10-16 18:38:53 -07:00
Umer Khan 696758bdc2 Added more validation checks. 2015-10-16 18:26:05 -07:00
Umer Khan 43b6585bfa Minor updates. 2015-10-16 16:38:34 -07:00
Umer Khan f47f9d824c Updates 2015-10-16 16:23:13 -07:00
Oliver Sch√§fer 7ef55e55e7 Bug fux 2015-10-16 21:51:00 +02:00
Brandon McQuilkin 9b4152ec6e Aligned text field and map with the rest of the form question cells. 2015-10-16 15:23:39 -04:00
Brandon McQuilkin b58ae6139b Adjusted map size to ensure that the text field was visible on all devices.
Removed the code to scroll the text field into view as the scroll offset change was being overriden by the animation of the keyboard changing the table view offset.
2015-10-16 15:12:57 -04:00
Brandon McQuilkin 7ba97f4089 Removed unnecessary cast. 2015-10-16 14:33:55 -04:00
Brandon McQuilkin a2bfb9a15d Switched to using predefined vertical margin. 2015-10-16 14:33:06 -04:00
Umer Khan 17b7d7d4f9 Merge remote-tracking branch 'upstream/master' into account 2015-10-16 10:47:20 -07:00
Andrew Hill d9e2f54c41 Changes made per UmerKhan-apple's suggestions 2015-10-16 08:19:34 +01:00
Umer Khan 9347ef6573 Updated serialization. 2015-10-15 18:03:49 -07:00
Nidhi Gupta ed4a50dacc Few API edits. 2015-10-15 11:47:16 -07:00
Nidhi Gupta d8d3882a1c Update ORKScaleAnswerFormat Class Reference 2015-10-15 11:43:47 -07:00
Nidhi Gupta ec8308b8bd Code snippet for ORKNavigableOrderedTask, and Email answer format. 2015-10-15 11:28:43 -07:00
Brandon McQuilkin 9296fe90bc Moved map view initialization 2015-10-15 09:16:36 -04:00
Brandon McQuilkin df9170f9cf Removed extra method. 2015-10-15 09:06:58 -04:00
Brandon McQuilkin 0deb8ba55e Switched the focus of the form cell from the map view to the text field. 2015-10-15 09:05:49 -04:00
Brandon McQuilkin b24310adbc Removed unnecessary variable. 2015-10-15 08:57:13 -04:00
Brandon McQuilkin c138f6aa02 Marked constant span values as constants. 2015-10-15 08:56:28 -04:00
Brandon McQuilkin 49e541d1b7 Set the map region's coordinate directly. 2015-10-15 08:55:28 -04:00
Brandon McQuilkin f22676a8e7 Switched isEqual to ORKEqualObjects 2015-10-15 08:54:17 -04:00
Brandon McQuilkin d34749e1ef Copy answer before setting the answer property 2015-10-15 08:52:34 -04:00
Brandon McQuilkin 0e4251d511 Directly use string from ABCreateStringWithAddressDictionary 2015-10-15 08:50:07 -04:00
Brandon McQuilkin 06ff988941 Removed unnecessary casts. 2015-10-15 08:49:26 -04:00
Brandon McQuilkin 3b3c907d39 Removed extra class from ORKResult.h 2015-10-15 08:47:27 -04:00
Brandon McQuilkin b1515e0fc2 Removed unnecessary method. 2015-10-15 08:46:43 -04:00
Brandon McQuilkin f9924ddbc0 Removed debug log from tests. 2015-10-15 08:44:24 -04:00
Brandon McQuilkin bbde9865ee suggestedCellHeightForView now returns a height based off of the screen metric. 2015-10-15 08:35:39 -04:00
Nidhi Gupta cfa9e90d76 Corrected ORKOrderedTask description. 2015-10-15 00:13:12 -07:00
Andrew Hill 851bd4e2c5 Added ORKFormStep optional convenience initialiser.
Updated the optional form test to confirm all is working.
2015-10-15 04:13:05 +01:00
Yuan Zhu 9fbabf8f3b Merge pull request #528 from rsanchezsaez/rsanchezsaez-ChartsPerformanceTest
ORKTest: add 'Test Charts Performance' item
2015-10-14 18:04:34 -07:00
Yuan Zhu 536a22f733 Merge pull request #526 from YuanZhu-apple/master_should_able_to_contine_with_default_value_on_scale
Refractor scale answer format
2015-10-14 17:42:31 -07:00
Yuan Zhu e51c9b708a Should set currentNumberValue to nil if passed in currentTextChoiceValue is not match any of the text choices. 2015-10-14 17:41:10 -07:00
Yuan Zhu b45425ba72 Update API doc 2015-10-14 17:38:06 -07:00
Yuan Zhu 181651b365 Update string. 2015-10-14 17:35:00 -07:00
Yuan Zhu b8d2c6bf86 Address review feedback 2015-10-14 17:33:42 -07:00
Ricardo Sánchez-Sáez feb5f11e3e CharDataSources.swift: add PerformanceLineGraphChartDataSource 2015-10-15 00:54:10 +01:00
Yuan Zhu 8d4b73ae8f Style adjustment 2015-10-14 16:31:57 -07:00
Yuan Zhu 81e67dc6fa Use _textChoices instead of self.textChoices 2015-10-14 16:30:24 -07:00
Yuan Zhu e873af81d6 Style adjustment. 2015-10-14 16:24:19 -07:00
Yuan Zhu 59681fbab5 Other review feedback update. 2015-10-14 16:11:41 -07:00
Yuan Zhu a3a53b7c68 Make separate ORKTextScaleAnswerFormatProvider to carry the methods for ORKTextScaleAnswerFormat 2015-10-14 15:59:28 -07:00
Yuan Zhu a28e2596bd Change protocol method from defaultNumber to defaultAnswer to better work with ScaleSliderView. 2015-10-14 15:50:04 -07:00
Yuan Zhu f5e8b40f6d Style update 2015-10-14 15:36:10 -07:00
Umer Khan 55bc242896 Removed disabled confirm textfield feature. 2015-10-14 14:51:18 -07:00
Umer Khan d3dee01678 Refactored to view controller parameter rather than Class parameter. 2015-10-14 14:47:15 -07:00
Umer Khan a6445546fd Updated confirm text answer format. 2015-10-14 14:30:38 -07:00
Brandon McQuilkin 44a786d51d Switch returned error message to localizedFailureReason. 2015-10-14 15:19:21 -04:00
Brandon McQuilkin 5954a6b254 Moved size of map to screen metric. 2015-10-14 15:15:04 -04:00
Brandon McQuilkin 06eecb054c Updated serialization and unit tests of ORKPlacemark.
- Added ORKPlacemark to public header.
- Added NSSecureCoding, NSCopying, isEqual: to ORKPlacemark
- Finished replacing MKPlacemark to ORKPlacemark
- Updated ORKTestTests
2015-10-14 14:53:50 -04:00
Brandon McQuilkin c38da58f6b Added open source license. 2015-10-14 08:45:32 -04:00
Brandon McQuilkin 17c35e6765 Updated horizontal margins. 2015-10-14 08:44:34 -04:00
Umer Khan 1074eefbbe Added confirm text answer format and cell. 2015-10-13 20:16:47 -07:00
Nidhi Gupta 6c54eea404 API reference edits incorporated (part 1) 2015-10-13 15:05:56 -07:00
Ricardo Sánchez-Sáez daa267b8f0 ORKTest: add 'Test Charts Performance' item 2015-10-13 22:43:30 +01:00
Andrew Hill 7f66623c59 Merge branch 'ResearchKit/master' 2015-10-13 22:18:32 +01:00
Umer Khan 7854c619a3 Added LoginStep and refactored minor things. 2015-10-13 14:10:21 -07:00
Brandon McQuilkin deef811bc9 Moved where the initial coordinate region is set. 2015-10-13 10:38:05 -04:00
Brandon McQuilkin b9fff0e4c0 Removed extra text color change. 2015-10-13 10:23:05 -04:00
Brandon McQuilkin f35e84189c Removed extra answerDidChange call.
Fixed extra annotations bug.
2015-10-13 09:57:42 -04:00
Brandon McQuilkin 5ff0f9324a Updated error message. 2015-10-13 09:48:44 -04:00
Brandon McQuilkin 35d33709b2 Added support for ORKNullAnswerValue to the selection view. 2015-10-13 09:46:28 -04:00
Brandon McQuilkin 0d9c98dd56 Fixed the selection view's first responder being ignored. 2015-10-13 08:14:39 -04:00
Yuan Zhu 2ac5e30d85 Refractor scale answer format.
1. fix for #511 "Continue button is disabled on scale with default values"
2. refactor ORKScaleSliderView to work better with three scale related answer format.
2015-10-12 16:23:22 -07:00
Umer Khan d1e246bba4 Adding wait step to account creation task. 2015-10-12 14:46:00 -07:00
Yuan Zhu 0dc31e4593 Merge pull request #512 from md0u80c9/restorationData
RestorationData
2015-10-12 12:01:57 -07:00
Brandon McQuilkin 521dba3d4e Removed invalid location answer error creation as it is not possible for the user to create an invalid coordinate. 2015-10-12 10:40:52 -04:00
Brandon McQuilkin 07e05298a0 Removed the MKPlacemark string conversion and replaced with a subclass of MKPlacemark. 2015-10-12 10:33:05 -04:00
Brandon McQuilkin 9214c48d41 Added ORKPlacemark class. 2015-10-12 10:06:38 -04:00
Brandon McQuilkin ebdc7a218a Added MKPlacemark serialization tests. 2015-10-12 09:47:03 -04:00
Brandon McQuilkin 3d9cc15c0b Fixed issue where previously entered answer would be overridden with current location after coming back to the question. 2015-10-12 08:42:50 -04:00
Oliver Sch√§fer 41d6a415ad Bug fixes 2015-10-12 11:59:10 +02:00
Ricardo Sánchez-Sáez f45722366c ORKNavigableOrderedTask: add loop support information to headerdocs 2015-10-11 13:16:58 +01:00
Ricardo Sánchez-Sáez 10152cfb79 ORKNavigableOrderedTask: reverse backwards navigation iteration
This fixes the behavior correct when you have visited the same step more than once (otherwise you'd get the previous step on your first visit).

Also, stop iteration as soon as possible, and improve loop warning
2015-10-11 12:50:47 +01:00
Ricardo Sánchez-Sáez 038794df0d ORKTaskViewController: make _managedStepIdentifiers array again
This is the original behavior, it follows the pop/push model. All the backward navigation stack is preserved, but older results which are ovewritten if you revisit the same step on a loop. Thus, going over a loop will produce duplicate results for the steps that are seen more than once (all the duplicate step results will point to the same result instance: the one corresponding to the last time you visited the step).
2015-10-11 12:46:53 +01:00
Ricardo Sánchez-Sáez d74bfe956f ORKResult: improve results' description
Also, use description to print task results in 'ORKTest'.
2015-10-11 12:42:47 +01:00
Oliver Sch√§fer a3b2d68b7a State restoration bugfix #2 2015-10-11 12:43:52 +02:00
Oliver Sch√§fer 87560025c8 State restoration bugfix 2015-10-11 12:34:08 +02:00
Steve Cadwallader af9588fd93 Revert to property notation. 2015-10-10 16:13:47 -04:00
Steve Cadwallader 80ee2b8792 Mark three ORKLocationSelectionViewDelegate event callbacks as optional. 2015-10-10 16:12:10 -04:00
Steve Cadwallader 8dffe81ea7 Replace ORKNullAnswerValue test with more complete ORKIsAnswerEmpty. 2015-10-10 15:48:29 -04:00
Steve Cadwallader 95099e34de Initialize the subview earlier, and access the placeholder directly from the form. 2015-10-10 15:42:47 -04:00
Steve Cadwallader 9dc22ff97e Remove unimplemented applyAnswerFormat from ORKFormItemLocationCell. 2015-10-10 15:15:27 -04:00
Steve Cadwallader df7a5d2ae4 Remove blank line in import statements. 2015-10-10 15:11:14 -04:00
Steve Cadwallader 475d84de73 Implement copyWithZone for ORKLocationAnswerFormat 2015-10-10 15:10:30 -04:00
Steve Cadwallader cc6380af67 Utilize constants for JSON keys. 2015-10-10 14:29:42 -04:00
Ricardo Sánchez-Sáez ebf3a5474d Unit tests: test new navigable ordered task navigation model 2015-10-10 17:04:21 +01:00
Ricardo Sánchez-Sáez f8a94a0f66 ORKTest: update unit tests 2015-10-10 16:47:48 +01:00
Ricardo Sánchez-Sáez 1afb67bf9e Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-NavigableOrderedTask
# Conflicts:
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-10-10 16:17:02 +01:00
Ricardo Sánchez-Sáez 258afcb7df ORKTest: direclty call TaskFactory method 2015-10-10 16:07:05 +01:00
Ricardo Sánchez-Sáez 8a3882d85c Fix ResearchKit unit tests not running due to Swift code 2015-10-10 16:06:46 +01:00
Ricardo Sánchez-Sáez 2bd667bc6f ORKTest: rename Swift 'TestHelpers' to 'TaskFactory' 2015-10-10 15:39:11 +01:00
Ricardo Sánchez-Sáez 7a4715dd72 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules
# Conflicts:
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-10-10 15:37:12 +01:00
Umer Khan 8f7047220f Merging master and resolving merge conflicts. 2015-10-09 14:58:04 -07:00
Yuan Zhu fda01e8dd0 Merge pull request #518 from YuanZhu-apple/master_fix_First_Last_Name_logic_in_consent
Fix Issue #516: Consent required name logic is invalid
2015-10-09 14:56:10 -07:00
Steve Cadwallader 8042df3127 Documentation tweak. 2015-10-09 17:40:50 -04:00
Steve Cadwallader 153726633f Rename conversion methods to be more explicit about JSON strings. 2015-10-09 17:40:10 -04:00
Nidhi Gupta 4040d962a0 Added rules for scale answer format. 2015-10-09 12:07:26 -07:00
Steve Cadwallader 861211fa3b Integrate MKPlacemark JSON serialization. 2015-10-09 10:28:03 -04:00
Steve Cadwallader a8f6be61f3 Copyright updates 2015-10-09 08:38:43 -04:00
Steve Cadwallader 7c01903108 Replace spaces with tabs, to follow convention. 2015-10-09 08:05:25 -04:00
Steve Cadwallader 848800bcd6 Reintroduce Wait Step, resolution of merge conflict. 2015-10-09 07:58:51 -04:00
Steve Cadwallader caa324ec79 Merge branch 'master' into LocationQuestion 2015-10-09 07:56:21 -04:00
Steve Cadwallader 27bf948f6d Merge remote-tracking branch 'ResearchKit/master' 2015-10-09 07:45:26 -04:00
Nidhi Gupta ed60c84a2d Added vertical slider answer format. 2015-10-08 20:01:49 -07:00
Nidhi Gupta e70d56142d Incorporated active task's feedback.
Added ORKNavigableOrderedTask.
2015-10-08 19:40:49 -07:00
Yuan Zhu a4c9286f29 Merge pull request #520 from umerkhan-apple/waitTask
Rearranging ORKTest and ORKCatalog for WaitTask.
2015-10-08 18:26:59 -07:00
Umer Khan 97c5ada28f Rearranging ORKTest and ORKCatalog for WaitTask to comply with alphabetic ordering. 2015-10-08 18:21:11 -07:00
Umer Khan fd0d4af750 Merge pull request #477 from QuintilesRK/WaitTask
Wait Task
2015-10-08 18:11:18 -07:00
Steve Cadwallader dc81d8af3a Remove identifier serialization from ORKPasscodeStep as well. 2015-10-08 21:05:05 -04:00
Steve Cadwallader deac6b5de0 Remove incorrect serialization of identifier for ORKWaitStep (defined in base class). 2015-10-08 21:04:25 -04:00
Steve Cadwallader 2c504f4b01 Merge remote-tracking branch 'ResearchKit/master' 2015-10-08 20:58:39 -04:00
Steve Cadwallader db4b19b229 Add ORKQuestionTypeLocation to section types. 2015-10-08 20:51:57 -04:00
Steve Cadwallader 129d2ac3df Add Apple to copyright headers 2015-10-08 20:37:46 -04:00
Steve Cadwallader 0790e52a5a Replace remaining reference to indicatorType with indicatorMask, resolving unit test issue. 2015-10-08 20:31:09 -04:00
Umer Khan 9784c1425a Merge pull request #476 from QuintilesRK/ValidatedText
Validated Text
2015-10-08 17:26:20 -07:00
Steve Cadwallader df13dca4d9 Update two copyright headers. 2015-10-08 20:20:39 -04:00
Steve Cadwallader acfce230b4 Re-implement the cached percent formatter. 2015-10-08 20:19:10 -04:00
Steve Cadwallader bfac86d706 Merge pull request #1 from umerkhan-apple/waitStep
Wait Step
2015-10-08 20:14:08 -04:00
Steve Cadwallader c2e2951d6f Cache the regular expression. 2015-10-08 19:52:39 -04:00
Steve Cadwallader 36a578549b Refactor common initialization code out into a commonInit method. 2015-10-08 19:34:35 -04:00
Yuan Zhu 165e107ddc Fix Issue #516: Consent required name logic is invalid
#516

Should update this code after we adding in #443 .
2015-10-08 15:43:44 -07:00
Yuan Zhu e32efc4ec2 Merge pull request #515 from YuanZhu-apple/master_fix_unit_test
Clear unexpected exceptions from unit tests.
2015-10-08 14:40:53 -07:00
Yuan Zhu 3479c35fb3 Code refactor 2015-10-08 13:32:07 -07:00
Umer Khan 74fbc9af77 Merge branch 'waitStep' of https://github.com/umerkhan-apple/ResearchKit into waitStep 2015-10-08 12:57:00 -07:00
Yuan Zhu ec91b7b139 Clear unexpected exceptions from unit tests.
- `HTMLForSignature:` would throw exception on a nil `signature.title`
2015-10-08 12:56:46 -07:00
Umer Khan d4403704ce Re-ordering wait task in ORKTest to stay consistent with alphabetic ordering. 2015-10-08 12:52:57 -07:00
Umer Khan 4919e0fc0c Refactoring WaitStep logic and formatting. 2015-10-08 12:48:33 -07:00
Oliver Sch√§fer dc3c6e011c PR changes 2015-10-08 20:47:55 +02:00
Andrew Hill 4c49283504 removed duplicate self.delegate allocation 2015-10-08 19:31:48 +01:00
Brandon McQuilkin 26a094e05f Merge branch 'master' of https://github.com/ResearchKit/ResearchKit into WaitTask
Conflicts:
	samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift
2015-10-08 14:23:27 -04:00
Brandon McQuilkin d6504c68ef Undo deletion of MKPlacemark category. 2015-10-08 14:15:08 -04:00
Brandon McQuilkin f90af1ce01 Added MapKit Framework to ORKTest project. 2015-10-08 14:10:21 -04:00
Steve Cadwallader ae6fcf4ce4 Re-insert ValidatedTextQuestion cases that were incorrectly merged out in 52d5fca 2015-10-08 14:07:33 -04:00
Brandon McQuilkin 8730a26be1 Updated initializer for ORKLocationSelectionView. 2015-10-08 11:57:00 -04:00
Brandon McQuilkin 20d6defb6f Added property to enable/disable automatically retrieving the user's current location. 2015-10-08 11:37:26 -04:00
Brandon McQuilkin cf917dc208 Added serialization tests for location step and result. 2015-10-08 11:12:13 -04:00
Brandon McQuilkin 47ad36d906 Added the location permission request string to ORKTest to enable automatic location retrieval. 2015-10-08 09:40:51 -04:00
Brandon McQuilkin e69228445a Updated ORKCatalog's info.plist with the new location permission request string. 2015-10-08 09:35:52 -04:00
Brandon McQuilkin 90619ac2af Removed unnecessary method that caused the wrong value to be set to the ORKLocationQuestionResult's locationAnswer property. 2015-10-08 09:34:00 -04:00
Brandon McQuilkin 43c4b892b2 Added new lines before and after imports. 2015-10-08 09:05:11 -04:00
Brandon McQuilkin 1c2028ce5d Updated legal headers in MKPlacemark category. 2015-10-08 09:03:06 -04:00
Brandon McQuilkin 29942a01d5 Added address field placeholder to localized strings. 2015-10-08 09:02:01 -04:00
Brandon McQuilkin c159d6db61 Updated cell expansion animation. 2015-10-08 09:00:51 -04:00
Brandon McQuilkin 7635528b2f Removed extra line from localized strings. 2015-10-08 08:56:39 -04:00
Brandon McQuilkin d5b6b0f87a Refactored ORKSurveyAnswerCellDelegate method name to be in line with the ORKFormItemCell. 2015-10-08 08:55:54 -04:00
Brandon McQuilkin 328b8421a3 Switched constants from #define to static const CGFloat 2015-10-08 08:52:35 -04:00
Brandon McQuilkin b4a2cbebd0 Removed prefixes from location selection view constants. 2015-10-08 08:51:27 -04:00
Brandon McQuilkin 9a749c5489 Added non null assumptions. 2015-10-08 08:49:06 -04:00
Brandon McQuilkin 09272a78df Removed second unused method. 2015-10-08 08:47:06 -04:00
Brandon McQuilkin 92ae7cf071 Removed unused method. 2015-10-08 08:46:36 -04:00
Brandon McQuilkin b5568e278b Renamed ORKFormItemLocationCell's constraint set up method. 2015-10-08 08:46:03 -04:00
Brandon McQuilkin 33864f1012 Updated error strings for invalid coordinates. 2015-10-08 08:44:28 -04:00
Brandon McQuilkin 2534e6b20e Fixed syntax error. 2015-10-08 08:21:44 -04:00
Andrew Hill 56b50e9296 Removed a wandering ')' seemed to have slipped the net. 2015-10-08 11:09:44 +01:00
Steve Cadwallader 8eb756b96c Merge conflicts 2015-10-07 22:07:17 -04:00
Steve Cadwallader 52d5fcabe7 Merge branch 'master' into ValidatedText 2015-10-07 22:05:11 -04:00
Steve Cadwallader bf07984430 Merge remote-tracking branch 'ResearchKit/master' 2015-10-07 21:56:53 -04:00
Steve Cadwallader 0554cbd6f1 Implement serialization, copying, and equality logic for regex and invalidMessage. Resolves unit test failures. 2015-10-07 21:55:47 -04:00
Ricardo Sánchez-Sáez b34d1ecd29 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules 2015-10-07 23:23:08 +01:00
Ricardo Sánchez-Sáez f3c7c53e21 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-NavigableOrderedTask 2015-10-07 23:14:38 +01:00
John Earl 59045b27a5 Revert changes from bad merge at c113deb 2015-10-07 14:59:59 -07:00
Umer Khan 14ea5cc282 Updated changes to ORKLoginStep. 2015-10-07 14:05:14 -07:00
Ricardo Sánchez-Sáez ec04a5c633 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-NavigableOrderedTask 2015-10-07 22:03:27 +01:00
Ricardo Sánchez-Sáez f1e4941f3f ORKNavigableOrderedStack: use task results for backwards navigation
This commits removes ORKNavigableOrderedTask's '_stepIdentifierStack' ivar (used for backwards navigation) and uses the managed task results instead. The managed task result will only show results for the steps that have been previously visited, so it can be used to simulate the backwards navigation stack.

The ORKTaskViewController's '_managedStepIdentifiers' ivar has been converted into an 'NSMutableOrderedSet'. When an already visited step is shown (either by going back, or by following a loop in a navigable ordered task), all the managed step identifiers which come later than the step being shown are removed.

This commit also updates the 'ORKTest' to remove the "Save For Later" task archiving (which is no longer needed) and updates the 'Ordered Loop Task' example to be more comprehensive by featuring a branched question.
2015-10-07 22:03:03 +01:00
Steve Cadwallader bb01f0bb4d Utilize string formatting for error messages. Update comments. Change location of ORKTest URL test to in-line beneath e-mail. 2015-10-07 16:53:50 -04:00
Andrew Hill 7ebc03c93f Ensure we set up the delegate. 2015-10-07 21:43:38 +01:00
Andrew Hill 413bc6682a Amended ORKTaskViewController initWithTask to take a nullable restorationData field.
Updated ORKTest to allow us to test this out.
tested with NavigableOrderedTask.
2015-10-07 21:22:26 +01:00
Andrew Hill 9ccf4fb743 Merge branch 'ResearchKit/master' 2015-10-07 21:12:31 +01:00
Andrew Hill 723075a61f Merge branch 'ResearchKit/master' into restorationData 2015-10-07 21:11:53 +01:00
Ricardo Sánchez-Sáez c659539a45 ORKResult: homogenize results 'description' strings
Also: add result description for 'ORKCollectionResult' and 'ORKQuestionResult'.
2015-10-07 20:29:46 +01:00
Ricardo Sánchez-Sáez 48661fe670 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules
# Conflicts:
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-10-07 19:54:33 +01:00
Ricardo Sánchez-Sáez b9fadc1b87 ORKTest: add 'Navigable Loop Task'
The 'Navigable Loop Task' allows testing of optional 'ORKNavigableOrderedTask' looping (when you loop, all the navigation history after the targeted step is discareded).

Also:
- Improve style and conform to naming conventions in MainViewController.m.
2015-10-07 19:17:08 +01:00
Yuan Zhu 11dc10e66e Merge pull request #509 from YuanZhu-apple/master_fix_save_for_later
If a task in ORKTest has been cancelled and saved, the output directory should be kept.
2015-10-07 10:32:42 -07:00
Yuan Zhu 6911fe614f Update for feedback. 2015-10-07 10:26:10 -07:00
Brandon McQuilkin 452665de14 Merge ResearchKit/master into ResearchKit/LocationQuestion 2015-10-07 10:43:32 -04:00
Brandon McQuilkin 1f352c39d2 Updated ORKWaitStep serialization. 2015-10-07 09:23:34 -04:00
Brandon McQuilkin e42c92004a Fixed syntax error. 2015-10-07 09:18:57 -04:00
Brandon McQuilkin 17ac3f5177 Updated changed method name in ORKTest. 2015-10-07 09:09:53 -04:00
Brandon McQuilkin 400da43f42 Cached the percent formatter. 2015-10-07 09:07:23 -04:00
Brandon McQuilkin c0aed6d641 Merge branch 'master' of https://github.com/ResearchKit/ResearchKit into WaitTask
Conflicts:
	samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift
2015-10-07 09:05:22 -04:00
Brandon McQuilkin f7e9c672e2 Added serialization tests for the wait step. 2015-10-07 08:26:48 -04:00
Yuan Zhu 7f106898e2 Merge pull request #462 from rsanchezsaez/rsanchezsaez-changelog
Add CHANGELOG.md
2015-10-06 15:58:12 -07:00
Yuan Zhu d3da59a4f6 In ORKTest, if a task has been cancelled and saved, the output directory should be kept.
ORKURLFromBookmarkData() fails to return a valid URL, when the resolving directory is not exist.
2015-10-06 14:33:47 -07:00
Umer Khan 8a78e95ebb Added Login step and updated documentation. 2015-10-06 13:55:28 -07:00
Umer Khan c113deb1a3 Merge branch 'master' of https://github.com/ResearchKit/ResearchKit 2015-10-06 13:36:09 -07:00
Brandon McQuilkin 3097232bd5 Converted weakSelf to strongSelf in block. 2015-10-06 15:13:14 -04:00
Brandon McQuilkin 04a55343bc Cleaned up imports. 2015-10-06 15:07:06 -04:00
Brandon McQuilkin 485e6035e0 Updated percent string to use NSNumberFormatter 2015-10-06 14:59:29 -04:00
Brandon McQuilkin 785ea40fc4 Constraint handling updated.
Static constraints now set up in setUpConstraints
Changing constraints now set up in updateConstraints if needed.
2015-10-06 14:55:07 -04:00
Ricardo Sánchez-Sáez 69319a3c5e RELEASE-NOTES.md: fix typo 2015-10-06 20:47:39 +02:00
Brandon McQuilkin c10ab44036 Consolidated indicator mask view creation. 2015-10-06 14:47:01 -04:00
Brandon McQuilkin 3fdbad88b2 Updated framework headers. 2015-10-06 14:27:35 -04:00
Brandon McQuilkin 2287b99b86 Moved wait task creation code in ORKTest 2015-10-06 14:23:02 -04:00
Brandon McQuilkin 3d6a7fa481 Updated accessibility to read out the progress value. 2015-10-06 14:16:03 -04:00
Brandon McQuilkin 0759764889 Added hard line wraps. 2015-10-06 14:07:05 -04:00
Brandon McQuilkin e3ab9d75ef Removed unnecessary tint color management 2015-10-06 14:03:12 -04:00
Brandon McQuilkin f401dcf94d Moved the wait step classes into the common folder. 2015-10-06 13:57:01 -04:00
Brandon McQuilkin b941379779 Refactored the wait step into a normal step. 2015-10-06 13:54:16 -04:00
Steve Cadwallader f2d13d1305 Reordered Validated Text Question between Value Picker and Image Capture per @rsanchezsaez feedback. 2015-10-06 11:59:33 -04:00
Brandon McQuilkin 96e5f26f7d Updated the result to return a placemark 2015-10-06 11:17:36 -04:00
Steve Cadwallader cecef562a9 Update localizedInvalidValueStringWithAnswerString to check both string length and regex validity when building a string. 2015-10-06 10:44:27 -04:00
Steve Cadwallader 7d2d04239f Remove emailAddress from ORKTextAnswerFormat. 2015-10-06 10:28:44 -04:00
Steve Cadwallader 2b649f9e12 Split out method for isTextRegexValidWithString. Update initializers to match recent argument changes. 2015-10-06 10:22:30 -04:00
Steve Cadwallader a9478c3cb0 Remove assignment to local variables per review feedback. 2015-10-06 09:23:11 -04:00
Steve Cadwallader 9b64b9c0f0 Change the argument name for textAnswerFormatWithValidationExpression. Reorder properties to be grouped together. Correct outdated documentation. 2015-10-06 09:18:51 -04:00
Ricardo Sánchez-Sáez ac0f3c542c RELEASE-NOTES.md: take care of internal review feedback
Also:
- Encode '(' and ')' symbols in URL (they interferred with markdown syntax).
- Use Title Capitalization for all section titles.
- Mention "General stability and performance improvements" on each release introducion instead of as a separate section.
2015-10-06 14:36:53 +02:00
Umer Khan 2e356cac03 Added confirm passcode field. 2015-10-05 16:55:51 -07:00
Yuan Zhu 91d4fa7890 Merge pull request #498 from ResearchKit/localizationFix
IOI # 495 - Localization fallback language
2015-10-05 13:37:42 -07:00
Yuan Zhu 18504e9ffe Merge pull request #493 from umerkhan-apple/touchID
Passcode updates
2015-10-05 13:21:46 -07:00
Umer Khan d80ca89094 PR update. 2015-10-05 13:11:32 -07:00
Umer Khan 706900ff07 Updated ORKVerificationStepView controls and constraints. 2015-10-05 13:03:17 -07:00
Brandon McQuilkin 20cfa9f588 Fixed layout constraint errors
Note: The height of the cell separator needs to be accounted for, it is
subtracted from the cell height returned/calculated by the UITableView.
2015-10-05 14:49:08 -04:00
Steve Cadwallader 76aef1a069 Naming tweak from setupConstraints to setUpConstraints for consistency. 2015-10-05 14:18:11 -04:00
Steve Cadwallader 4afe6dcf77 Merge from master 2015-10-05 14:11:07 -04:00
Steve Cadwallader 4d82dcb8f3 Merge branch 'master' into WaitTask 2015-10-05 14:09:58 -04:00
Steve Cadwallader d2c381fefb Merge remote-tracking branch 'ResearchKit/master' 2015-10-05 13:51:34 -04:00
Brandon McQuilkin fbfeb233fa Clearing the text field now resets the map view to its initial state 2015-10-05 09:51:14 -04:00
Brandon McQuilkin 2a4b1b370a Automatically obtain user's location upon presenting the map view 2015-10-05 09:37:28 -04:00
Brandon McQuilkin 52ef002a67 Address now updated immediately after search 2015-10-05 09:34:05 -04:00
Brandon McQuilkin 65e2946cba Keyboard dismissed on search 2015-10-05 09:33:28 -04:00
Brandon McQuilkin 52fbba25b8 Fixed layout issues for the ORKQuestionStep 2015-10-05 09:27:21 -04:00
Brandon McQuilkin 73c59a40b9 Added location question result to the result table view. 2015-10-05 08:09:49 -04:00
Brandon McQuilkin 87c6feceaa Removed current location button 2015-10-05 08:09:15 -04:00
Oliver Schäfer 0180500607 Merge remote-tracking branch 'apple/master' 2015-10-03 12:02:33 +02:00
Oliver Sch√§fer 42e6c97ee2 API changes 2015-10-03 12:02:18 +02:00
Brandon McQuilkin 4bfc412626 Sorted the location question alphabetically in the catalog 2015-10-02 22:49:27 -04:00
Brandon McQuilkin 8621b38a89 Added array contents to constraints array 2015-10-02 22:33:29 -04:00
Brandon McQuilkin 8517354463 Fixed missing metric values. 2015-10-02 22:29:12 -04:00
Brandon McQuilkin 250d016306 Switch true/false to YES/NO 2015-10-02 22:28:13 -04:00
Steve Cadwallader a2a73b1661 Merge latest ResearchKit/master 2015-10-02 16:57:35 -04:00
Nidhi Gupta 46e61011a2 Active tasks revised. 2015-10-02 13:26:34 -07:00
Steve Cadwallader 13ab769dd8 Add suportsSecureCoding to ORKWaitStep, addressing unit test issue. 2015-10-02 16:10:40 -04:00
Steve Cadwallader 30f3900307 Copyright statement updates 2015-10-02 15:52:42 -04:00
Brandon McQuilkin f85a4c0c06 Moved coordinate translator into a helper method. 2015-10-02 15:51:15 -04:00
Steve Cadwallader 32fc46f896 Remove ORKProgressIndicatorMaskNone option, and add additional documentation. 2015-10-02 15:50:34 -04:00
Umer Khan f15940f83e Modified task view controller and ORKStep to allow for custom class variable. 2015-10-02 11:38:03 -07:00
Steve Cadwallader 310080fc8e Switched ORKEmailAnswerFormat to utilize ORKTextAnswerFormat with EmailValidationRegex. Removed isEmailAddressValidWithString. Disabled spell checking and auto correction. 2015-10-02 14:31:33 -04:00
Pavel Kanzelsberger b41e0be80f More refactoring, weakSelf / strongSelf and others... 2015-10-02 09:26:49 +02:00
Pavel Kanzelsberger c7d1d99b32 Switched from UIActivityIndicator to ORKProgressView 2015-10-02 08:55:07 +02:00
Umer Khan 684dd82c15 Added constraints. 2015-10-01 20:56:00 -07:00
Umer Khan c0ff5bc6e0 Minor update. 2015-10-01 18:14:20 -07:00
Umer Khan d2381657fa Adding ORKVerificationStepView foundation. 2015-10-01 18:09:27 -07:00
Umer Khan 3463f1a16f Added ORKVerificationStepViewController foundation. 2015-10-01 17:26:31 -07:00
Umer Khan 9878b34c2a Added Verification Step. 2015-10-01 17:08:30 -07:00
Umer Khan 81bc7221d1 Nit fix. 2015-10-01 16:45:40 -07:00
Umer Khan a5bb7b5506 PR updates. 2015-10-01 16:38:37 -07:00
Nidhi Gupta 921b280a3b Added all the new task in Active task module. 2015-10-01 16:04:51 -07:00
Yuan Zhu d313ab3a45 Merge pull request #497 from oliverschaefer/issue471
IOI 471
2015-10-01 15:32:59 -07:00
Umer Khan 73657854d4 Adding localization fallback to be U.S. English. 2015-10-01 15:18:05 -07:00
Umer Khan 7dc91f531d Quick fix. 2015-10-01 14:44:04 -07:00
Oliver Sch√§fer 294ec34d47 IOI 471 2015-10-01 23:38:01 +02:00
Oliver Sch√§fer ce6c79a60f Minor changes 2015-10-01 23:01:54 +02:00
Oliver Sch√§fer 86bcdaa3ee Minor changes 2015-10-01 22:57:32 +02:00
Umer Khan bcfb0b4dbb Minor keyboard fix. 2015-10-01 13:45:12 -07:00
Umer Khan 82c325d6c7 Updating serialization files. 2015-10-01 10:42:26 -07:00
Oliver Schäfer 6d2c1400b1 Merge remote-tracking branch 'apple/master' 2015-10-01 17:02:45 +02:00
Oliver Sch√§fer 8fa8dbae9e Changed progress label appearance when reviewing a step 2015-10-01 16:50:10 +02:00
Yuan Zhu c7bd1f5c41 Merge pull request #490 from YuanZhu-apple/master_fix_section_title_misalignment
Fixed the section header misalignment in form page.
2015-09-30 22:42:39 -07:00
Yuan Zhu bdb6849ab5 Merge pull request #483 from YuanZhu-apple/master_improve_json_unit_test
Make the test for ORKESerialization to catch unregistered classes.
2015-09-30 22:41:45 -07:00
Yuan Zhu 6d1d22d9fa Fixed the section header misalignment in form page.
1. Created `ORKFormSectionHeaderView` to update it constraint when screen rotates.
2. Use `dequeueReusableHeaderFooterViewWithIdentifier:` to cache created header views.
3. Other code refactoring.
2015-09-30 17:56:52 -07:00
Umer Khan 393a2bf404 Updates to Registration Step. 2015-09-30 17:18:48 -07:00
Yuan Zhu f828fbd8c4 Merge pull request #488 from rsanchezsaez/rsanchezsaez-ORKTest
ORKTest: add 'Passcode' section and sort items alphabetically
2015-09-30 16:15:22 -07:00
Ricardo Sánchez-Sáez 27193727e9 ORKTest: add 'Passcode' section and sort items alphabetically 2015-10-01 00:10:10 +01:00
Yuan Zhu a7173cc746 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master_improve_json_unit_test
Conflicts:
	Testing/ORKTest/ORKTest/ORKESerialization.m
2015-09-30 15:15:42 -07:00
Yuan Zhu b0977b55e0 Merge pull request #487 from umerkhan-apple/touchID
Passcode Module Update
2015-09-30 15:06:40 -07:00
Yuan Zhu 6d792cfd83 Merge pull request #486 from YuanZhu-apple/master_fix_audio_UI
Fix audio task layout problem
2015-09-30 14:57:54 -07:00
Umer Khan fb6b1ab2c5 PR updates. 2015-09-30 14:48:38 -07:00
Yuan Zhu ab729432b4 Merge pull request #456 from umerkhan-apple/screening
Screening Module ⎯ Eligibility Answer Format
2015-09-30 14:29:18 -07:00
Umer Khan 5b5e53bdc3 Minor update. 2015-09-30 14:28:25 -07:00
Umer Khan 2b6c69e01d Resolving merge conflicts. 2015-09-30 14:26:08 -07:00
Umer Khan fb1c5e9b9a Resolving merge conflicts 2015-09-30 14:11:59 -07:00
Umer Khan f4b4d2aee1 Minor fixes. 2015-09-30 14:08:06 -07:00
Umer Khan 96478c583d Error handling updates to Passcode. 2015-09-30 14:04:26 -07:00
Yuan Zhu a796e6cc1e Merge pull request #373 from shazino/9hpt-task
Hole Peg Test task
2015-09-30 14:03:51 -07:00
Umer Khan 8599553a79 Updates to passcode 2015-09-30 11:41:10 -07:00
Yuan Zhu 8197c147e1 Fix audio task layout problem. 2015-09-30 11:19:54 -07:00
Umer Khan 8bdb32fc7a Updates 2015-09-30 10:42:43 -07:00
Julien Thérier 16f9b1dbe1 Merge remote-tracking branch 'origin/9hpt-task' into 9hpt-task 2015-09-30 17:00:14 +02:00
Julien Thérier 9459e330d5 Merge branch 'master' of ResearchKit/ResearchKit 2015-09-30 16:42:27 +02:00
Julien Thérier 78be958aea Fix ORKTest issue. 2015-09-30 16:22:23 +02:00
Pavel Kanzelsberger 3c9291ed24 Refactored code as requested 2015-09-30 09:24:38 +02:00
Yuan Zhu 5454cf83e1 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master_improve_json_unit_test
Conflicts:
	ResearchKit.xcodeproj/project.pbxproj
2015-09-29 23:48:54 -07:00
Yuan Zhu b4e8a91474 Merge pull request #444 from umerkhan-apple/touchID
IOI # 88 - Passcode w/TouchID
2015-09-29 23:45:15 -07:00
Pavel Kanzelsberger 829f93523a Refactored code as requested 2015-09-30 08:22:59 +02:00
Umer Khan 98b0acaeb7 Disabling init for ORKPasscodeViewController. 2015-09-29 20:39:43 -07:00
Umer Khan 91a9acb9ef Modifying question text for eligibility task to the generic example question. 2015-09-29 20:31:50 -07:00
Umer Khan 71bdaab7be Updates to registration step. 2015-09-29 20:27:17 -07:00
Umer Khan 3e18a08690 Added registration step. 2015-09-29 18:07:18 -07:00
Yuan Zhu 63b8bea246 Enhance the test for ORKESerialization to catch unregistered classes.
Also add the missing class registrations.
2015-09-29 18:01:23 -07:00
Ricardo Sánchez-Sáez 7a1a1c6cdd Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-changelog 2015-09-30 01:25:19 +01:00
Ricardo Sánchez-Sáez 2b7f05fd96 RELEASE-NOTES.md: minor improvements 2015-09-30 01:25:08 +01:00
Ricardo Sánchez-Sáez d26712e5a1 README.md: add 'Charts' section
Also add information about the chart examples in ORKCatalog.
2015-09-30 01:23:22 +01:00
Ricardo Sánchez-Sáez 0eba3970b5 README.md and Programming Guide: fix minor formatting issues 2015-09-30 01:20:42 +01:00
Ricardo Sánchez-Sáez 20e9cb24d4 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-documentationformatting
# Conflicts:
#	docs/Overview/GuideOverview-template.markdown
2015-09-29 22:37:51 +01:00
Umer Khan 234f40306a Merging master 2015-09-29 14:00:49 -07:00
Umer Khan 66218e4e28 Added serialization. 2015-09-29 13:56:38 -07:00
Umer Khan 130898cafd Added serialization. 2015-09-29 13:47:10 -07:00
Yuan Zhu 7db4bf50c8 Merge pull request #481 from matteocrippa/pdfsignaturenullable
signature.title exception on null
2015-09-29 13:01:45 -07:00
Pavel Kanzelsberger feb26fa506 Refactored code as requested 2015-09-29 18:15:53 +02:00
Umer Khan c317b30e82 Minor documentation update. 2015-09-28 14:41:46 -07:00
Umer Khan af6b027b7c Added Passcode Task into ORKCatalog and minor fixes. 2015-09-28 14:25:21 -07:00
Matteo Crippa 3c715cc211 fixed Signature capitalized 2015-09-28 23:09:32 +02:00
Matteo Crippa c7bddcf4d5 signature.title exception on null 2015-09-27 15:02:06 +02:00
Julien Therier ad9eefb19a Remove spoken instruction. 2015-09-25 21:01:48 +02:00
Julien Thérier 537e67af78 Fix ORKTest issue. 2015-09-25 11:11:14 +02:00
Julien Thérier 1c16398bc7 Change ORKSide to ORKBodySagittal 2015-09-25 10:09:14 +02:00
Umer Khan ca292c1987 Nits 2015-09-24 18:26:15 -07:00
Umer Khan 7a9009759e Minor fix. 2015-09-24 18:22:09 -07:00
Umer Khan 2040bbd095 Updated documentation in answer format and adde eligibility task example in ORKCatalog. 2015-09-24 18:18:53 -07:00
Umer Khan 111ac5627a Minor refactoring fix. 2015-09-24 15:45:29 -07:00
Umer Khan 57f911a4bb Refactoring ORKEligibilityAnswerFormat after PR discussion. 2015-09-24 15:42:50 -07:00
Eric Rolf 17776d04a4 Merge branch 'master' into LocationQuestion
* master: (114 commits)
  ResearchKit Project: add explicit 'ORK_LOG_LEVEL_WARNING=1'
  ORKImageSelectionView: resolve merge conflict
  ORKTest: fix column width not being updated after rotation
  ORKImageCaptureStepViewController: restore 'queue_' method prefix
  ORKTappingContentView: slight constraint refactor
  ORKSkin: hide 'ORKGetMetricForScreenType()' function; use 'ORKGetMetricForWindow()' instead
  Misc: remove extra newlines before 'else'
  Misc: remove additional space after '!' unary operator
  Misc: homegenize whitespace between consecutive closing and opening brackets
  ORKTaskViewController: whitespace
  Misc: homogenize for the more common 'cannot' instead of 'can not' in exception messages
  Misc: whitespace between '==' operator
  Misc: some additional constraint homogeneization of recently merged active tasks
  Misc: remove needless empty class extensions
  Misc: use 'has' instead of 'have' when refering to singular noun
  ORKFormItemCell: use VerticalMargin and HorizontalMargin const names
  Misc: remove space between '!' unary operator and operand
  Misc: use property syntax for accessing 'font', 'ascender', 'descender', and 'window'
  Misc: use property syntax for 'allValues' and 'allKeys'
  ORKDataLogger: use previous configuration file key for backwards compatibility
  ...
2015-09-24 07:19:45 -04:00
Eric Rolf 66b7806bce Merge branch 'master' into ValidatedText
* master: (114 commits)
  ResearchKit Project: add explicit 'ORK_LOG_LEVEL_WARNING=1'
  ORKImageSelectionView: resolve merge conflict
  ORKTest: fix column width not being updated after rotation
  ORKImageCaptureStepViewController: restore 'queue_' method prefix
  ORKTappingContentView: slight constraint refactor
  ORKSkin: hide 'ORKGetMetricForScreenType()' function; use 'ORKGetMetricForWindow()' instead
  Misc: remove extra newlines before 'else'
  Misc: remove additional space after '!' unary operator
  Misc: homegenize whitespace between consecutive closing and opening brackets
  ORKTaskViewController: whitespace
  Misc: homogenize for the more common 'cannot' instead of 'can not' in exception messages
  Misc: whitespace between '==' operator
  Misc: some additional constraint homogeneization of recently merged active tasks
  Misc: remove needless empty class extensions
  Misc: use 'has' instead of 'have' when refering to singular noun
  ORKFormItemCell: use VerticalMargin and HorizontalMargin const names
  Misc: remove space between '!' unary operator and operand
  Misc: use property syntax for accessing 'font', 'ascender', 'descender', and 'window'
  Misc: use property syntax for 'allValues' and 'allKeys'
  ORKDataLogger: use previous configuration file key for backwards compatibility
  ...

Conflicts:
	ResearchKit/Common/ORKAnswerFormat.m
2015-09-24 07:18:44 -04:00
Eric Rolf c79b228fba Merge branch 'master' into WaitTask
* master: (114 commits)
  ResearchKit Project: add explicit 'ORK_LOG_LEVEL_WARNING=1'
  ORKImageSelectionView: resolve merge conflict
  ORKTest: fix column width not being updated after rotation
  ORKImageCaptureStepViewController: restore 'queue_' method prefix
  ORKTappingContentView: slight constraint refactor
  ORKSkin: hide 'ORKGetMetricForScreenType()' function; use 'ORKGetMetricForWindow()' instead
  Misc: remove extra newlines before 'else'
  Misc: remove additional space after '!' unary operator
  Misc: homegenize whitespace between consecutive closing and opening brackets
  ORKTaskViewController: whitespace
  Misc: homogenize for the more common 'cannot' instead of 'can not' in exception messages
  Misc: whitespace between '==' operator
  Misc: some additional constraint homogeneization of recently merged active tasks
  Misc: remove needless empty class extensions
  Misc: use 'has' instead of 'have' when refering to singular noun
  ORKFormItemCell: use VerticalMargin and HorizontalMargin const names
  Misc: remove space between '!' unary operator and operand
  Misc: use property syntax for accessing 'font', 'ascender', 'descender', and 'window'
  Misc: use property syntax for 'allValues' and 'allKeys'
  ORKDataLogger: use previous configuration file key for backwards compatibility
  ...
2015-09-24 07:12:18 -04:00
Julien Thérier 0398fb3767 Add margins using ORKStandardHorizontalMarginForView. 2015-09-24 12:19:41 +02:00
Julien Thérier f168e02e9e Merge master and fix conflicts. 2015-09-24 11:44:43 +02:00
Julien Thérier 5d1ed481e3 Add margin for pegs. 2015-09-24 10:17:22 +02:00
Umer Khan 7cd75c4d40 PR updates. 2015-09-23 18:01:33 -07:00
Umer Khan aa58b643a0 Merge remote-tracking branch 'upstream/master' into screening 2015-09-23 16:53:20 -07:00
Umer Khan 3b0ce6478b PR changes. 2015-09-23 16:53:04 -07:00
Yuan Zhu c545aa8cbb Merge pull request #449 from rsanchezsaez/rsanchezsaez-logging
Revamp logging system
2015-09-23 16:37:24 -07:00
Ricardo Sánchez-Sáez 74ff026b92 ResearchKit Project: add explicit 'ORK_LOG_LEVEL_WARNING=1'
Adds explicit warning log level to 'Debug' and 'Release' 'Preprocessor Macros' setting in Xcode's Build Settings.
2015-09-24 00:07:40 +01:00
Umer Khan 257ee610b7 Added authenticationPasscodeType property for factory view controller support. 2015-09-23 15:29:06 -07:00
Ricardo Sánchez-Sáez 79b9351433 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules 2015-09-23 21:38:23 +01:00
Ricardo Sánchez-Sáez 359f8f3387 ORKImageSelectionView: resolve merge conflict 2015-09-23 21:37:50 +01:00
Ricardo Sánchez-Sáez 1f7c856fdb Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-logging
# Conflicts:
#	ResearchKit/ActiveTasks/ORKHealthQuantityTypeRecorder.m
#	ResearchKit/ActiveTasks/ORKTowerOfHanoiStep.m
#	ResearchKit/Common/ORKImageSelectionView.m
#	ResearchKit/Common/ORKTaskViewController.m
#	ResearchKit/Consent/ORKEAGLMoviePlayerView.m
2015-09-23 21:37:24 +01:00
Yuan Zhu 58a5a2c3b2 Merge pull request #474 from rsanchezsaez/rsanchezsaez-ORKTest
ORKTest: fix column width not being updated after rotation
2015-09-23 12:50:26 -07:00
Yuan Zhu 54f064247e Merge pull request #343 from rsanchezsaez/rsanchezsaez-constraints
Constraint code homogenization
2015-09-23 12:50:17 -07:00
Ricardo Sánchez-Sáez 3f35a49f50 ORKTest: fix column width not being updated after rotation
Also: make scroll view to use 3 columns for view widths equal or greater than the iPhone 6 in landscape (667 points).
2015-09-23 20:24:12 +01:00
Eric Rolf c16c929054 Updated Attributions. 2015-09-23 10:08:58 -04:00
Eric Rolf be6a922554 Updated Attributions. 2015-09-23 10:07:40 -04:00
Ricardo Sánchez-Sáez 3711ab342c Release Notes: split iPad and iPhone Landscape support into two items 2015-09-23 00:36:07 +01:00
Ricardo Sánchez-Sáez 908f7b0f5f ORKImageCaptureStepViewController: restore 'queue_' method prefix 2015-09-23 00:30:49 +01:00
Ricardo Sánchez-Sáez 1be6949c2d Release Notes: added contributions attribution 2015-09-23 00:21:17 +01:00
Umer Khan fc4e8a9915 PR updates. 2015-09-22 16:15:07 -07:00
Umer Khan 413e607258 PR changes. 2015-09-22 16:08:01 -07:00
Eric Rolf 7847c813a5 Added Location Question to ORKTest. 2015-09-22 18:39:23 -04:00
Eric Rolf 956549c320 Initial commit for location question.
Includes:
Location Question
Location Question Answer Format
Location Question Form Cell
Location Survey Answer
2015-09-22 18:16:08 -04:00
Eric Rolf 709e4b818c Merge branch 'master' into WaitTask
* master:
  Fixes #465
2015-09-22 16:44:23 -04:00
Eric Rolf 8a6f0a35bd Merge branch 'master' into ValidatedText
* master:
  Fixes #465
2015-09-22 16:44:12 -04:00
Umer Khan b218db0f63 Merging master 2015-09-22 12:52:33 -07:00
Umer Khan 8fe483a5e0 Merging master 2015-09-22 12:44:31 -07:00
Umer Khan 3a555592ff PR changes. 2015-09-22 12:38:13 -07:00
Ricardo Sánchez-Sáez 4fb39abac9 Release Notes: indent Result Predicates-related paragraph 2015-09-22 19:50:50 +01:00
Ricardo Sánchez-Sáez fbaf85ae9b Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-changelog 2015-09-22 19:48:54 +01:00
Yuan Zhu 11a0427883 Merge pull request #470 from shazino/fix-#465
Increase tapping timestamp precision
2015-09-22 10:55:16 -07:00
Julien Thérier d23e188d64 Fixes #465 2015-09-22 09:39:55 +02:00
Eric Rolf d70ee216c8 Added Validated text to ORKTest App, updated to support validators. 2015-09-21 21:14:26 -04:00
Eric Rolf 0cd42556f5 Initial Validated Text Commit 2015-09-21 21:07:52 -04:00
Eric Rolf 3daec83a7f ORKTest App updated with WaitTask. 2015-09-21 20:41:21 -04:00
Ricardo Sánchez-Sáez ed44fd84d9 ORKTappingContentView: slight constraint refactor 2015-09-22 01:28:30 +01:00
Eric Rolf be9d2e3486 Wait Task Initial Commit 2015-09-21 20:21:01 -04:00
Ricardo Sánchez-Sáez dc78de8fdd ORKSkin: hide 'ORKGetMetricForScreenType()' function; use 'ORKGetMetricForWindow()' instead
This is simpler to understand and easier to maintain. It handles all 'nil' window cases in one place.
2015-09-22 01:14:07 +01:00
Ricardo Sánchez-Sáez 21f1dbb5af Misc: remove extra newlines before 'else' 2015-09-22 00:55:14 +01:00
Ricardo Sánchez-Sáez 7bc31391fa Misc: remove additional space after '!' unary operator 2015-09-22 00:53:22 +01:00
Ricardo Sánchez-Sáez e932d118b9 Misc: homegenize whitespace between consecutive closing and opening brackets 2015-09-22 00:52:36 +01:00
Ricardo Sánchez-Sáez 874386987a ORKTaskViewController: whitespace 2015-09-22 00:49:00 +01:00
Ricardo Sánchez-Sáez 2b27a9d038 Misc: homogenize for the more common 'cannot' instead of 'can not' in exception messages 2015-09-22 00:47:17 +01:00
Ricardo Sánchez-Sáez 293e0ed23c Misc: whitespace between '==' operator 2015-09-22 00:43:04 +01:00
Ricardo Sánchez-Sáez c322e0455d Misc: some additional constraint homogeneization of recently merged active tasks 2015-09-22 00:41:04 +01:00
Ricardo Sánchez-Sáez 9960b4376f Misc: remove needless empty class extensions 2015-09-22 00:29:24 +01:00
Ricardo Sánchez-Sáez 1d3adbba45 Misc: use 'has' instead of 'have' when refering to singular noun 2015-09-22 00:26:46 +01:00
Ricardo Sánchez-Sáez 07d1aba216 ORKFormItemCell: use VerticalMargin and HorizontalMargin const names 2015-09-22 00:09:16 +01:00
Ricardo Sánchez-Sáez b69d40a86b Misc: remove space between '!' unary operator and operand 2015-09-21 23:49:18 +01:00
Ricardo Sánchez-Sáez 633f9eaaef Misc: use property syntax for accessing 'font', 'ascender', 'descender', and 'window' 2015-09-21 23:44:50 +01:00
Ricardo Sánchez-Sáez 2edf7bc481 Misc: use property syntax for 'allValues' and 'allKeys' 2015-09-20 17:30:22 +01:00
Ricardo Sánchez-Sáez 92620b782b ORKDataLogger: use previous configuration file key for backwards compatibility 2015-09-20 17:09:01 +01:00
Ricardo Sánchez-Sáez 06ca255bb1 Misc: remove 'k' prefix from constants (as per the Coding Style Guide) 2015-09-20 16:51:29 +01:00
Ricardo Sánchez-Sáez 5baa3a423a Misc: more binary operator whitespace fixes 2015-09-20 16:37:39 +01:00
Ricardo Sánchez-Sáez b56e622ea0 Misc: use property format for accessing screen 'scale' 2015-09-20 16:34:33 +01:00
Ricardo Sánchez-Sáez 9fad01dd0c Misc: homogenize whitespace around binary operators
Also remove the 'k' prefix on some constants.
2015-09-20 16:32:34 +01:00
Ricardo Sánchez-Sáez f2c751a71f Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-09-20 16:08:43 +01:00
Ricardo Sánchez-Sáez 06d9244c80 RELEASE-NOTES.md: add notes about 'scale answer format' and 'result predicate' improvements in v1.2
Also use the proper 'Scale Answer Format' name (instead of 'Slider Answer Format').
2015-09-20 15:35:28 +01:00
Ricardo Sánchez-Sáez 6004058c50 RELEASE-NOTES.md: add notes on required Xcode version 2015-09-20 15:13:18 +01:00
Oliver Sch√§fer 29f883b04b Refactored for ResearchKit 1.2 Compatibility 2015-09-20 09:12:01 +02:00
Ricardo Sánchez-Sáez cc1e1ae435 RELEASE-NOTES.md: fix indentation of task descriptions 2015-09-18 12:34:42 +01:00
Yuan Zhu be6d351bb3 Merge pull request #459 from YuanZhu-apple/master_fix_consent_animation
Fix consent animation.
2015-09-17 17:58:02 -07:00
Yuan Zhu eac89e0119 Fix typo and rearrange some restoreGLContext code 2015-09-17 17:56:12 -07:00
Ricardo Sánchez-Sáez e035236314 Add 'RELEASE-NOTES.md' 2015-09-18 00:56:10 +01:00
Pascal Pfiffner 870a9f6ac5 Merge branch 'master' of https://github.com/ResearchKit/ResearchKit 2015-09-17 13:10:03 +02:00
Ricardo Sánchez-Sáez ea0c6a1cf8 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/Consent/ORKConsentReviewController.m
2015-09-17 02:00:00 +01:00
Ricardo Sánchez-Sáez 48cc58f04c Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules 2015-09-17 01:46:03 +01:00
Ricardo Sánchez-Sáez 30a346e94d Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-documentationformatting 2015-09-17 01:45:30 +01:00
Ricardo SaÃÅnchez-SaÃÅez 6c97c550ed ORKEAGLMoviePlayerView: promote OpenGL failure messages from warning to error 2015-09-17 01:20:03 +01:00
Ricardo SaÃÅnchez-SaÃÅez 50b3f1d170 ORKTaskViewController, ORKStepViewController: replace 'NSLog' by 'ORK_Log_Warning' 2015-09-17 01:19:24 +01:00
Umer Khan 601b16a985 Refactored PasscodeTextField logic. 2015-09-16 14:27:09 -07:00
Julien Thérier ecb0fde9c5 Merge remote-tracking branch 'ResearchKit/master' 2015-09-16 17:40:17 +02:00
Yuan Zhu 81be7627eb Fix consent animaton.
Root cause: old playerView's dealloc happens on the new EAGLContext(wrong) of new playerView.

Save/Restore EAGLContext in each of the methods which do GL drawing.
This make more than one GLContext lives together.
2015-09-15 18:18:56 -07:00
Umer Khan f94929daae Added optional error message property. 2015-09-15 11:03:43 -07:00
Ricardo Sánchez-Sáez 8d7ab7861c Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-logging 2015-09-15 15:03:05 +02:00
Yuan Zhu ce3f17d45f Release 1.2.1 with Fix blank consent html review page. 2015-09-14 15:53:06 -07:00
Yuan Zhu 1354181f84 Merge pull request #457 from YuanZhu-apple/master_fix_blank_consent_review
Fix `blank` consent html review page.
2015-09-14 15:41:17 -07:00
Ricardo Sánchez-Sáez 395d2727c6 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-09-14 23:49:40 +02:00
Yuan Zhu 7f67d9c4da Merge pull request #440 from rsanchezsaez/rsanchezsaez-master-charts
Charts: add 'graphChartView:drawsVerticalReferenceLineAtPointIndex:' method
2015-09-14 14:20:19 -07:00
Yuan Zhu 2c5b5cda7d Merge pull request #438 from rsanchezsaez/rsanchezsaez-master-ORKTest
ORKTest: add icon and launch xib
2015-09-14 14:19:48 -07:00
Yuan Zhu 4fd95efe57 Merge pull request #450 from rsanchezsaez/rsanchezsaez-documentation
ORKAnswerFormat: fix headerdoc warnings
2015-09-14 14:19:03 -07:00
Yuan Zhu fb223bb1bb Fix blank consent html review page. 2015-09-14 13:58:30 -07:00
Umer Khan 831f136cd1 Added ability to recover answer and changed label type for form item cell. 2015-09-14 13:27:05 -07:00
Umer Khan 6ad9ad52af Minor fix. 2015-09-13 14:47:25 -07:00
Umer Khan b28d5e6456 Minor fixes. 2015-09-13 14:45:15 -07:00
Umer Khan d7f9987ede Added eligibility answer format. 2015-09-13 14:19:14 -07:00
Ricardo Sánchez-Sáez 86aaeae857 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/ActiveTasks/ORKAudioContentView.m
#	ResearchKit/Common/ORKImageCaptureView.m
2015-09-11 00:45:38 +01:00
Ricardo Sánchez-Sáez 642bc3db80 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules
# Conflicts:
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-09-11 00:36:07 +01:00
Ricardo Sánchez-Sáez 7361442a04 Programming Guide: add formatting for keywords and hard-wrap at line 100 2015-09-11 00:03:54 +01:00
Ricardo Sánchez-Sáez 398ae8029f README.md: add formatting to keywords such 'ResearchKit framework', 'iOS', 'Xcode', etc.
Also: hard-wrap documentation at line 100.
2015-09-10 23:58:38 +01:00
Ricardo Sánchez-Sáez af0ca497d5 ORKAnswerFormat: fix headerdoc wanings
Also: hard wrap documentation at line 100.
2015-09-10 23:47:31 +01:00
Yuan Zhu 75f62ee5f7 Merge pull request #448 from YuanZhu-apple/master_add_workspace
Add a single workspace that includes RK,  ORKTest, and ORKCatalog for convenience
2015-09-10 15:26:08 -07:00
Umer Khan bd63d1576b Minor fix. 2015-09-10 15:22:28 -07:00
Yuan Zhu a4c521203c Merge pull request #443 from rsanchezsaez/rsanchezsaez-OptionalFormItems
ORKFormItem: implement 'optional' property
2015-09-10 14:58:17 -07:00
Umer Khan b8aba5459e Refactored keychain wrapper and added unit tests. 2015-09-10 14:51:49 -07:00
Ricardo Sánchez-Sáez f0507b973f ORKHelpers: add my copyright info to the header 2015-09-10 22:44:34 +01:00
Ricardo Sánchez-Sáez 58a9366bf5 Programming Guide: rename logging section to Logging Errors and Warnings 2015-09-10 22:35:23 +01:00
Ricardo Sánchez-Sáez 5b298d17a7 ORKHelpers: fix 'ORK_LOG_LEVEL_NONE' not working 2015-09-10 22:12:37 +01:00
Ricardo Sánchez-Sáez bca3ceae78 Programming Guide: add 'Logging Level' section 2015-09-10 22:06:45 +01:00
Ricardo Sánchez-Sáez d8c0ecbd1d ORKHelpers: revamped logging system
Also:
- Changes some (mildly) serious error messages from the DEBUG to the WARNING level.
- Remove the line number from ORK logging as it's noisy (we already have the function).

---

There are now four logging levels controlled by 4 preprocessor macros and their corresponding logging macros:
- ORK_LOG_LEVEL_NONE
- ORK_LOG_LEVEL_DEBUG, ORK_Log_Debug()
- ORK_LOG_LEVEL_WARNING, ORK_Log_Warning()
- ORK_LOG_LEVEL_ERROR, ORK_Log_Error()

Setting the ORK_LOG_LEVEL_NONE macro to 1 completely silences all RK logs. Setting ORK_LOG_LEVEL_DEBUG, or one of the higher levels, to 1, enables logging at that level and at all the higher levels.

If you do not specify a log level, 'ORK_LOG_LEVEL_WARNING=1' is used by default.

You have to set this preprocessor macros to your ResearchKit subproject, not to your main project. You can do so in Xcode by adding any of them to the 'Preprocessor Macros' list on your ResearchKit target's Build Settings.

See this resources if you are using ResearchKit through CocoaPods and need to change the log level:
- http://www.mokacoding.com/blog/cocoapods-and-custom-build-configurations/
- http://stackoverflow.com/a/30038120/269753
2015-09-10 21:39:15 +01:00
Yuan Zhu 133b154023 Add a single workspace that includes RK, ORKTest, and ORKCatalog for convenience 2015-09-10 13:10:51 -07:00
Yuan Zhu 95baa8b943 Update README.md
Stable branch works with Xcode 7.0 compatible now.
2015-09-09 17:14:52 -07:00
Yuan Zhu 0e433640c4 Merge branch 'stable' 2015-09-09 17:12:21 -07:00
Yuan Zhu e1faf6587c Release 1.2 2015-09-09 17:02:51 -07:00
Yuan Zhu 939d298809 Update RK and its apps bundle version to 1.2 2015-09-09 16:28:08 -07:00
Ricardo Sánchez-Sáez 1ae771ee80 ORKFormStep: rename 'non-optional' to 'required' on headerdocs and ORKTest's visible strings
It's the recommended practice for expressing non-optionality according to RFC 2119 (https://www.ietf.org/rfc/rfc2119.txt).
2015-09-09 10:49:20 +01:00
Julien Thérier c5b14925bd Merge remote-tracking branch 'ResearchKit/master'
Syncing fork
2015-09-09 10:30:36 +02:00
Umer Khan fa40e30ee3 Updated documentation. 2015-09-08 18:37:13 -07:00
Umer Khan 8736dd5165 Merge remote-tracking branch 'upstream/master' into touchID 2015-09-08 17:54:40 -07:00
Ricardo Sánchez-Sáez 4917b34291 ORKFormItem: set 'optional' default value to 'YES'
Also adds headers to the 'Optional Form' example.
2015-09-09 01:51:36 +01:00
Umer Khan 29d3e0da89 Renamed ORKKeychainStore to ORKKeychainWrapper. 2015-09-08 17:49:11 -07:00
Umer Khan 9b68f5188f Enhancements to keychain store. 2015-09-08 17:31:59 -07:00
Ricardo Sánchez-Sáez ed3503370d ORKDiscreteGraphChartView: fix small typo 2015-09-09 01:20:49 +01:00
Ricardo Sánchez-Sáez 43480170aa ORKFormItem: implement 'optional' property
Also add 'ORKCatalog' example.
2015-09-08 23:52:11 +01:00
Umer Khan fdaf18198f Consolidated delegates, updated API, and minor fixes. 2015-09-08 13:57:36 -07:00
Ricardo Sánchez-Sáez aee5c48875 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-master-charts
# Conflicts:
#	ResearchKit/Charts/ORKGraphChartView.h
#	Testing/ORKTest/ORKTest/Charts/ChartDataSources.swift
#	samples/ORKCatalog/ORKCatalog/Charts/ChartDataSources.swift
2015-09-08 20:38:33 +01:00
Umer Khan 521715f7dd Added keychain for passcode storing. 2015-09-08 11:12:06 -07:00
Yuan Zhu 68572aefe2 Merge branch 'convergence' 2015-09-08 10:50:52 -07:00
Yuan Zhu f179e15e5c Merge pull request #442 from rsanchezsaez/rsanchezsaez-convergence-charts
Charts: update ORKCatalog to use new data source method (convergence)
2015-09-08 10:18:10 -07:00
Ricardo Sánchez-Sáez 731b65d65c ORKCatalog: update graphChartView(graphChartView:, titleForXAxisAtPointIndex:)' method to use new name 2015-09-08 10:00:10 +01:00
Yuan Zhu b584258946 Use ORKLocalizedStringFromNumber()
# Conflicts:
#	Testing/ORKTest/ORKTest/Charts/ChartDataSources.swift
2015-09-08 09:55:28 +01:00
Ricardo Sánchez-Sáez 6ff53717a4 ORKCatalog: update graphChartView(graphChartView:, titleForXAxisAtPointIndex:)' method to use new name 2015-09-08 09:51:46 +01:00
Yuan Zhu d123688395 Merge pull request #441 from YuanZhu-apple/convergence_crash_fix_2
Use `ORKLocalizedStringFromNumber()`
2015-09-08 00:50:35 -07:00
Yuan Zhu ca4a954d08 Use ORKLocalizedStringFromNumber() 2015-09-08 00:47:46 -07:00
Yuan Zhu 57fbde9b46 Merge pull request #439 from rsanchezsaez/rsanchezsaez-convergence-charts
ORKGraphChartView: fix accessibility crash when 'graphChartView:titleForXAxisAtPointIndex:' is not implemented
2015-09-08 00:37:58 -07:00
Ricardo Sánchez-Sáez d46ab216f4 ORKGraphChartView: implement 'graphChartView:drawsVerticalReferenceLineAtPointIndex:' method 2015-09-08 01:55:55 +01:00
Ricardo Sánchez-Sáez b6bee7e9de ORKGraphChartView: fix accessibility crash when 'graphChartView:titleForXAxisAtPointIndex:' is not implemented
# Conflicts:
#	ResearchKit/Charts/ORKGraphChartView.h
2015-09-08 01:55:41 +01:00
Ricardo Sánchez-Sáez 0dd06a572b ORKGraphChartView: fix accessibility crash when 'graphChartView:titleForXAxisAtPointIndex:' is not implemented 2015-09-08 00:53:33 +01:00
Ricardo Sánchez-Sáez 7272291eb7 ORKTest: add new icon 2015-09-07 23:08:09 +01:00
Ricardo Sánchez-Sáez 57be36482c ORKTest: nicer LaunchScreen 2015-09-07 00:34:38 +01:00
Ricardo Sánchez-Sáez c7d180b3ad Misc: update '__nullable' annotations to '_Nullable' (Xcode 7 style)
Also remove unneeded nullability annotations from implementation files.
2015-09-07 00:05:42 +01:00
Ricardo Sánchez-Sáez ed6913e2ad ORKHeadlineLabel: access 'windows' using property syntax 2015-09-06 23:29:13 +01:00
Ricardo SaÃÅnchez-SaÃÅez 9f79e144ce ORKScaleAnswerFormat: small whitespace fix 2015-09-06 23:18:39 +01:00
Ricardo Sánchez-Sáez 185789dfb3 ORKScaleSliderView: homogenize text choice slider constraints
Also, related to text choice slider:
 - Move label-creating code to init.
 - Do not create needless views on init.
 - Other small improvements.
2015-09-06 23:08:50 +01:00
Ricardo Sánchez-Sáez 5445b67b41 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/Common/ORKScaleSlider.m
#	ResearchKit/Common/ORKScaleSliderView.m
2015-09-06 22:28:08 +01:00
Yuan Zhu 66286a80c9 Merge pull request #435 from YuanZhu-apple/master_add_text_init
Add another convenient constructor for ORKQuestionStep
2015-09-04 15:42:44 -07:00
Yuan Zhu a2e4d559bc Merge pull request #437 from rsanchezsaez/rsanchezsaez-convergence-iPadLayout
iPad: fix separator inset in 'numeric' and 'text' questions
2015-09-04 15:42:34 -07:00
Umer Khan d9addcf469 Removing custom keyboard. 2015-09-04 12:32:40 -07:00
Ricardo Sánchez-Sáez f32c069be5 ORKSurveyAnswerCell: clip overflow separator inset (iPad) 2015-09-04 20:05:10 +01:00
Ricardo Sánchez-Sáez c55ce91fb9 ORKTableViewCell: fix wrong separator inset on numeric and text questions (iPad) 2015-09-04 20:03:30 +01:00
Yuan Zhu 7ba00fb853 Remove extra . 2015-09-04 11:29:43 -07:00
Yuan Zhu e4e2626823 Add another convenient constructor for ORKQuestionStep
The `text` attribute is easy missed by developers.
2015-09-04 11:27:56 -07:00
Umer Khan 48178b01c2 Merged master and added accessibility support. 2015-09-04 10:57:35 -07:00
Yuan Zhu 8b847e4de0 Merge pull request #392 from umerkhan-apple/textSlider
IOI # 230 - Text scale slider
2015-09-04 10:54:37 -07:00
Ricardo Sánchez-Sáez 2a76ff2a2e Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/ActiveTasks/ORKTappingContentView.m
#	ResearchKit/ActiveTasks/ORKToneAudiometryContentView.m
#	ResearchKit/ActiveTasks/ORKTowerOfHanoiTowerView.m
#	ResearchKit/Common/ORKFormItemCell.m
#	ResearchKit/Common/ORKHelpers.m
#	ResearchKit/Common/ORKScaleSliderView.m
#	ResearchKit/Common/ORKSkin.h
#	ResearchKit/Common/ORKSkin.m
#	ResearchKit/Common/ORKVerticalContainerView.m
#	ResearchKit/Consent/ORKConsentReviewController.m
#	ResearchKit/Consent/ORKConsentSignatureController.m
#	ResearchKit/Consent/ORKSignatureView.m
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-09-04 18:38:40 +01:00
Julien Thérier caa24b9ae6 Restore Tapping Content View. 2015-09-04 16:45:27 +02:00
Julien Thérier 0a3d938f8a Restore Tapping Content View. 2015-09-04 16:43:08 +02:00
Julien Thérier 1ea4960c29 Merge remote-tracking branch 'ResearchKit/master'
Sync with remote repo.
2015-09-04 15:36:40 +02:00
Julien Thérier 7013e954bc Merge remote-tracking branch 'origin/master' into 9hpt-task
Merge master to fix conflicts.
2015-09-04 15:29:07 +02:00
Julien Thérier ec8c36260c Improve legibility. 2015-09-04 15:17:34 +02:00
Julien Therier cfeb39ef5c Merge pull request #1 from rsanchezsaez/rsanchezsaez-holepegtask
Hole Peg Test Task images
2015-09-04 11:37:28 +02:00
Umer Khan b56bda5aaa Updating constraint merge conflict. 2015-09-03 23:53:30 -07:00
Umer Khan a9857da213 Minor formatting updates. 2015-09-03 23:44:56 -07:00
Umer Khan 3b3ec14acd Merge master 2015-09-03 23:35:26 -07:00
Umer Khan c499309897 Minor formatting updates. 2015-09-03 22:24:59 -07:00
Umer Khan b813690c67 Minor enhancements 2015-09-03 21:29:18 -07:00
Yuan Zhu 714f29e185 Merge pull request #432 from rsanchezsaez/rsanchezsaez-master-ORKTest
ORKTest: project files reorganization
2015-09-03 18:26:58 -07:00
Yuan Zhu d752d4d926 Merge pull request #420 from rsanchezsaez/master-Catalog
Reorganize 'ORKCatalog' into subsections
2015-09-03 18:15:50 -07:00
Umer Khan 050cea0c51 Refactored protocol method name. 2015-09-03 17:55:45 -07:00
Umer Khan 5a20aeab03 Added custom numeric pad keyboard. 2015-09-03 17:54:49 -07:00
Ricardo SaÃÅnchez-SaÃÅez 748d13e56e ORKCatalog: update 'readme.md' to add formatting and information about sections 2015-09-04 00:54:23 +01:00
Ricardo SaÃÅnchez-SaÃÅez e9f3bc919b ResultTableViewProviders: reorder code to match TaskListRow 2015-09-04 00:53:34 +01:00
Ricardo Sánchez-Sáez b17dda9697 ORKCatalog: reorganize project files so they are easier to browse 2015-09-04 00:32:56 +01:00
Ricardo Sánchez-Sáez 729ef4fa58 TaskListRow: reorder 'form task' in front of 'survey task' (alphabetically) 2015-09-04 00:22:57 +01:00
Ricardo Sánchez-Sáez e9cc5ea800 Merge branch 'master' of github.com:ResearchKit/ResearchKit into master-Catalog
# Conflicts:
#	samples/ORKCatalog/ORKCatalog/Tasks/TaskListRow.swift
2015-09-04 00:21:00 +01:00
Ricardo Sánchez-Sáez 090b976083 ResearchKit unit tests: remove needless framework directory
(It caused a warning when running them.)
2015-09-03 22:32:57 +01:00
Ricardo Sánchez-Sáez bd32b0ad24 ORKTest: remove needless framework directory
(It caused a warning when running unit tests.)
2015-09-03 22:32:30 +01:00
Ricardo Sánchez-Sáez d86edbc3f2 ORKTest: file structure reorganization so the project is easier to browse 2015-09-03 22:31:40 +01:00
Umer Khan a7c7aa7466 Adding UI foundation for custom numeric keyboard. 2015-09-03 13:40:43 -07:00
Yuan Zhu 60d2cbeb69 Loc string update (930 12-3) 2015-09-03 13:09:05 -07:00
Yuan Zhu 7bd76e6b5e Merge pull request #418 from YuanZhu-apple/convergence_fix_NaN_in_Chart
Convergence fix NaN crash in chart
2015-09-02 18:19:52 -07:00
Yuan Zhu 9f198a12b6 Merge pull request #423 from YuanZhu-apple/convergence_fix_audio_task_overlapping
Fixed the graph view and time label overlapping.
2015-09-02 18:18:23 -07:00
Yuan Zhu 86634b140c Merge pull request #425 from umerkhan-apple/splitViewFix
Fix for starting image capture step in split view.
2015-09-02 18:01:05 -07:00
Yuan Zhu 72da218778 Add Accessibility section to CONTRIBUTING.md 2015-09-02 17:44:47 -07:00
Yuan Zhu 89571ef876 Merge pull request #426 from rsanchezsaez/rsanchezsaez-master-ORKTest
Use sectioned 'UICollectionView' for presenting buttons in 'ORKTest'
2015-09-02 17:27:07 -07:00
Yuan Zhu b925584f9c Merge pull request #428 from rsanchezsaez/rsanchezsaez-charts-convergence
Charts: add lightweight generics to all array declarations
2015-09-02 17:13:01 -07:00
Yuan Zhu dc6bb27f57 Merge pull request #416 from rsanchezsaez/rsanchezsaez-FormPredicates
Result predicates: add support for form item results and nil results
2015-09-02 17:12:43 -07:00
Ricardo SaÃÅnchez-SaÃÅez 1c200251e8 ORKResultPredicate: update remaining headerdoc comments to reflect the new 'result selector' name 2015-09-03 01:11:50 +01:00
Yuan Zhu 6f0decb0ff Merge pull request #429 from rsanchezsaez/rsanchezsaez-convergence-ChartsHeaderdocs
Charts: additional headerdoc improvements
2015-09-02 17:11:36 -07:00
Ricardo SaÃÅnchez-SaÃÅez 812151c51d Charts: additional headerdoc improvements
Also added my copyright info.
2015-09-03 01:00:06 +01:00
Ricardo SaÃÅnchez-SaÃÅez 14715e2c32 ORKGraphChartView: remove remaining cast 2015-09-03 00:31:46 +01:00
Ricardo SaÃÅnchez-SaÃÅez bdad58b3a7 ORKCatalog: add copyright info and fix leading space omission to the copyright headers 2015-09-03 00:14:53 +01:00
Ricardo SaÃÅnchez-SaÃÅez c79b0eebe9 ORKTest: move 'Mini Form' and 'Selection Survey' to the 'Question Steps' section
Also adds copyright information.
2015-09-03 00:11:43 +01:00
Ricardo Sánchez-Sáez 1a7efab0e6 Merge branch 'convergence' of github.com:ResearchKit/ResearchKit into rsanchezsaez-charts-convergence 2015-09-03 00:02:34 +01:00
Ricardo SaÃÅnchez-SaÃÅez 5df57bcbda Charts: add lightweight generics to all arrays declarations
This allows to remove all the array-accessing casts.
Detected and fixed a few incorrect CALayer to CAShapeLayer casts.
I have also removed the 'dataPointAtPlotIndex:pointIndex:' method since it no longer provides any advantage over directly accessing the generics-parametrized array.
2015-09-03 00:02:08 +01:00
Yuan Zhu a6cea16fef Merge pull request #427 from YuanZhu-apple/convergence_doc_update
Small header doc update
2015-09-02 15:36:25 -07:00
Yuan Zhu 76d4555f74 Small header doc update 2015-09-02 15:35:38 -07:00
Ricardo SaÃÅnchez-SaÃÅez de05c7a632 ORKTest: use sectioned UICollectionView to organize test buttons 2015-09-02 23:21:54 +01:00
Ricardo SaÃÅnchez-SaÃÅez 0d07828edc ORKTest: fix storyboard warnings 2015-09-02 23:19:19 +01:00
Umer Khan bb50755b2e Fix for starting image capture step in split view. 2015-09-02 14:55:01 -07:00
Yuan Zhu 527609982a Merge branch 'convergence' 2015-09-02 14:35:36 -07:00
Yuan Zhu 32b5e37486 Merge branch 'convergence' of github.com:ResearchKit/ResearchKit into convergence_fix_NaN_in_Chart
Conflicts:
	ResearchKit/Charts/ORKGraphChartView.m
2015-09-02 11:15:44 -07:00
Umer Khan 01cb0e77be PR updates. 2015-09-02 11:13:50 -07:00
Yuan Zhu 419f209346 Merge pull request #422 from YuanZhu-apple/convergence_fix_uuid
Fix recorder file naming
2015-09-02 10:58:41 -07:00
Yuan Zhu 2338e097c4 Use dot access 2015-09-02 10:57:48 -07:00
Umer Khan 1fdd29c308 Adding example in main view controller and minor updates. 2015-09-02 10:54:02 -07:00
Yuan Zhu c6a2660a2e Fixed the graph view and time label overlapping.
Some how it works after I removed the constraints in GraphView.
2015-09-01 18:23:20 -07:00
Umer Khan b6e185284b Minor update to consent. 2015-09-01 17:44:05 -07:00
Umer Khan ade8879d54 Refacted factory methods of ORKPasscodeStepViewController into ORKPasscodeViewController 2015-09-01 17:35:08 -07:00
Yuan Zhu 04a1ec81d7 Should use [_recorderUUID uuidString] instead of [_recorderUUID description] 2015-09-01 17:09:10 -07:00
Ricardo SaÃÅnchez-SaÃÅez 015be2da3a ORKCatalog: replace 'Survey Questions' indentation by a new section 2015-09-02 00:56:20 +01:00
Ricardo SaÃÅnchez-SaÃÅez 2650360476 ORKCatalog: reorganize into alphabetically-sorted sections mirroring the project's readme 2015-09-02 00:02:53 +01:00
Yuan Zhu a786a661b2 Loc string update (905 11-5) 2015-09-01 14:48:51 -07:00
Umer Khan d42e7eca38 Adding protocol methods. 2015-09-01 14:42:00 -07:00
Ricardo SaÃÅnchez-SaÃÅez 074a00e2ae ORKResultPredicate: refactor 'ORKResultIdentifier' class by renaming it to 'ORKResultSelector'
Also:
- Improve documentation.
- Update ORKTest example and unit tests.
2015-09-01 22:34:21 +01:00
Yuan Zhu f7b8901fd2 Merge pull request #384 from rsanchezsaez/rsanchezsaez-codingstyleguide
Coding Style Guide: add 'Nullability Annotations' section
2015-09-01 14:04:24 -07:00
Yuan Zhu db5e374880 Merge pull request #403 from rsanchezsaez/rsanchezsaez-iPadLayoutFixes
iPad: constraint and layoutMargin code fixes
2015-09-01 14:03:14 -07:00
Yuan Zhu d2fed86772 Merge pull request #408 from rsanchezsaez/rsanchezsaez-charts-convergence
Charts improvements
2015-09-01 14:02:56 -07:00
Yuan Zhu a8b1c3658e Merge pull request #417 from YuanZhu-apple/convergence_loc_AB_RTL
Should adjust PageViewControllerNavigationDirection for RTL
2015-09-01 14:01:45 -07:00
Ricardo SaÃÅnchez-SaÃÅez c01d530cde ORKCatalog: use new enum to String conversion for identifiers 2015-09-01 20:53:07 +01:00
Yuan Zhu 85598e297b numberOfXAxisPoints should be NSInteger 2015-09-01 12:00:00 -07:00
Yuan Zhu 71b00ba7f6 Fix NaN crash in chart 2015-09-01 11:56:03 -07:00
Ricardo SaÃÅnchez-SaÃÅez 82acd5aedb ORKGraphChartView subclasses: use helper method for accessing data points 2015-09-01 02:23:50 +01:00
Ricardo Sánchez-Sáez 81f4b1e4cc Merge branch 'convergence' of github.com:ResearchKit/ResearchKit into rsanchezsaez-charts-convergence 2015-09-01 01:27:27 +01:00
Yuan Zhu 7c80613f1b Should adjust PageViewControllerNavigationDirection for RTL 2015-08-31 17:23:03 -07:00
Ricardo SaÃÅnchez-SaÃÅez d2c7ac3cd8 ORKGraphChartView: add helper method for accessing data points 2015-09-01 01:16:00 +01:00
Ricardo SaÃÅnchez-SaÃÅez ceec6adf1a ORKResultPredicate: greatly simplified API by introducing the 'ORKResultIdentifier' wrapper class
Also:
- Update tests.
- Update 'Navigable ordered task' example.
2015-09-01 00:56:22 +01:00
Yuan Zhu 2f6247a0ed Merge pull request #411 from YuanZhu-apple/convergence_loc_text_alignment
Fix text label layout problem in right-to-left UI.
2015-08-31 15:01:32 -07:00
Yuan Zhu 87034055b4 Merge pull request #414 from YuanZhu-apple/convergence_consider_placeholder_in_ORKFormItemTextFieldBasedCell_layout
Fix placeholder get truncated in FormItemCell.
2015-08-31 15:00:43 -07:00
Yuan Zhu 0093289888 Refactor the code and add documentation. 2015-08-31 14:03:56 -07:00
Yuan Zhu f8037c08df Merge pull request #413 from YuanZhu-apple/convergence_show_family_name_first_for_Vietnamese
Show family name first for Vietnamese
2015-08-31 13:57:31 -07:00
Yuan Zhu 24a7d469da Format adjustment 2015-08-31 13:54:49 -07:00
Ricardo SaÃÅnchez-SaÃÅez dffbaeee6b ORKResultPredicate: make ORKChoiceQuestionResult predicates to accept any kind of answer object (instead of just strings)
Also:
- Fixed problem in nil answer result predicate methods.
- Updated 'ORKTest' example.
- Updated test cases.
- Removed needless predicate convenience method test cases.
2015-08-31 21:45:54 +01:00
Yuan Zhu 2507aa5804 Merge pull request #410 from YuanZhu-apple/convergence_loc_AB_RTL
Add right arrow backbutton to support `UIUserInterfaceLayoutDirectionRightToLeft`
2015-08-31 13:18:34 -07:00
Ricardo SaÃÅnchez-SaÃÅez c45d2cb856 ORKResultPredicate: use '==' instead of 'like' for plain string comparisons
(We don't generally want to match wildcard characters.)
2015-08-31 20:38:41 +01:00
Umer Khan 7e5b5b45ec Minor updates for authentication flow. 2015-08-31 12:34:09 -07:00
Ricardo Sánchez-Sáez 739d22b5d3 ORKResultPredicate: small headerdoc improvement 2015-08-31 05:53:46 +01:00
Umer Khan 070f449c57 Added more passcode flows. 2015-08-30 20:58:25 -07:00
Ricardo SaÃÅnchez-SaÃÅez 43c544b4d0 ORKGraphChartView: use fixed yAxisView width instead of proportional sizing
It was getting too wide on the landscape orientation and on iPad. I think the developer should be able to size the graph chart view as they wish without that affecting the yAxisView size.
2015-08-31 01:03:30 +01:00
Ricardo SaÃÅnchez-SaÃÅez f76c960846 ORKResultPredicate: add 'predicateForNilQuestionResultWithTaskIdentifier:stepIdentifier:resultIdentifier:' method to match results with a nil answer (skipped steps or unanswered form questions) 2015-08-31 00:31:01 +01:00
Ricardo SaÃÅnchez-SaÃÅez a5640cb4b1 ORKResultPredicate: add optional 'stepIdentifier' argument to all method, to allow matching form item results.
Also: use new methods in newly added form predicate.

Result predicates without a supplied 'stepIdentifier' argument now only match the corresponding question step result, but not any form item result.
2015-08-31 00:03:41 +01:00
Pascal Pfiffner 1c0ac116d1 Backport slider fixes for Xcode 6 2015-08-30 23:36:52 +01:00
Ricardo SaÃÅnchez-SaÃÅez 222c017e0d ORKTaskTests: add some form result predicate tests 2015-08-30 21:14:51 +01:00
Ricardo SaÃÅnchez-SaÃÅez 90c9e1de94 ORKCatalog: fix form step using wrong identifier 2015-08-30 21:13:57 +01:00
Yuan Zhu 38e9b14a87 Fix placeholder get truncated in FormItemCell.
Take _textFieldView.estimatedWidth into consideration.
2015-08-28 18:03:37 -07:00
Umer Khan e8bd259952 Merge remote-tracking branch 'upstream/master' into textSlider 2015-08-28 16:57:35 -07:00
Umer Khan 07736ac5f3 Fixed secureCoding initializer warning. 2015-08-28 16:54:55 -07:00
Umer Khan 21bb2884b5 Laying foundation for different types of passcode flows. 2015-08-28 16:47:47 -07:00
Yuan Zhu be6811d311 Show family name first for Vietnamese 2015-08-28 16:09:23 -07:00
Umer Khan b323bd8980 Added Touch ID and other minor updates. 2015-08-28 16:07:41 -07:00
Yuan Zhu fb609dba72 Fix text label layout problem in right-to-left UI.
- Make the checkmark always in the choiceCell, hide it when the cell is unselected.
So layout code get consistent bounds to calculate label's rect.
2015-08-28 15:43:21 -07:00
Yuan Zhu 7445f7388a Add right arrow backbutton to support UIUserInterfaceLayoutDirectionRightToLeft 2015-08-28 14:39:03 -07:00
Umer Khan f5e2f54979 Removed step progress from navigation item title. 2015-08-28 12:55:01 -07:00
Umer Khan 39ef6a21f0 Overriding vertical class keyboard methods. 2015-08-28 12:17:23 -07:00
Yuan Zhu 0edc9292b3 Merge pull request #409 from YuanZhu-apple/convergence_fix_NSRangeException_in_Hanoi_task
Fix NSRangeException in Hanoi Task
2015-08-28 10:57:15 -07:00
Umer Khan 215e4d6008 PR updates. 2015-08-27 21:23:09 -07:00
Umer Khan 674a131060 Added foundation for Passcode Step 2015-08-27 18:54:29 -07:00
Yuan Zhu 28e1b2092e Fix NSRangeException in Hanoi Task
Tower could be empty, so it is not safe to call `tower.disks[index];` without a check.
Accessibility announcement is only applicable when the both donor and recipient are valid.
2015-08-27 18:38:26 -07:00
Yuan Zhu f8f30d681f Merge pull request #407 from YuanZhu-apple/convergence_fix_multiline_desc_on_slider
Convergence fix multiline desc on slider
2015-08-27 17:47:32 -07:00
Yuan Zhu 35471350a2 Limit the height of description label in sliderView 2015-08-27 17:46:42 -07:00
Ricardo Sánchez-Sáez 2da1b843d0 ORKPieChartView: move 'sharedInit' to original position for easier review 2015-08-28 01:11:04 +01:00
Ricardo Sánchez-Sáez f10195edc4 ORKGraphChartView: move 'sharedInit' to original position for easier review 2015-08-28 01:07:27 +01:00
Ricardo SaÃÅnchez-SaÃÅez 770bec9c31 ChartListViewController: more interesting discrete graph chart test 2015-08-28 01:01:18 +01:00
Ricardo SaÃÅnchez-SaÃÅez 3eea308ed4 ORKGraphChartView: fix animation glitch when you scrub over the graph end, raise the finger, and start scrubbing over the opposite end
Also improve code reuse.
2015-08-28 00:59:40 +01:00
Ricardo SaÃÅnchez-SaÃÅez fda79e945f ORKGraphChartView: fix miscalculation in line animation duration if there is only 1 layer 2015-08-28 00:59:32 +01:00
Ricardo SaÃÅnchez-SaÃÅez b20fd5755b Charts: fix more NSUInteger/NSInteger instances 2015-08-28 00:58:06 +01:00
Ricardo SaÃÅnchez-SaÃÅez 1d5461a037 ORKPieChartView: fix legend content size not being properly calculated after a rotation 2015-08-28 00:57:59 +01:00
Ricardo SaÃÅnchez-SaÃÅez fab251e623 ORKPieChartView: make sure the legendView is not added more than once 2015-08-28 00:57:36 +01:00
Ricardo Sánchez-Sáez 0d914c493a Chart swift files: add my copyright info 2015-08-28 00:57:24 +01:00
Ricardo Sánchez-Sáez d4a20a79d5 ORKPieChartView: make properties with default values 'null_resetable'
Also improve documentation.
2015-08-28 00:56:20 +01:00
Ricardo Sánchez-Sáez 58eaa1d182 ORKGraphChartView: rename 'axisTitleColor' to 'verticalAxisTitleColor' and improve comment 2015-08-28 00:55:44 +01:00
Ricardo Sánchez-Sáez a6f5c39e2c ORKGraphView: make properties with default values 'null_resetable' 2015-08-28 00:55:30 +01:00
Ricardo Sánchez-Sáez 9da358a1f5 ORKGraphChartView: implement 'scrubbingPlotIndexForGraphChartView:' method 2015-08-28 00:51:14 +01:00
Ricardo Sánchez-Sáez a1db939515 ORKGraphChartView: implement 'graphChartView:colorForPlotIndex:' dataSource method 2015-08-28 00:50:48 +01:00
Ricardo Sánchez-Sáez 9462839950 ORKPieChartView: fix animation not working when 'showsPercentageLabels' was set to 'NO' 2015-08-28 00:44:13 +01:00
Ricardo Sánchez-Sáez 29a6e21e49 ORKPieChartView: use tintColor as base for auto-generated colors when the dataSource doesn't provide custom colors 2015-08-28 00:44:02 +01:00
Ricardo Sánchez-Sáez 5739faffe6 ORKGraphChartView: remove debug NSLog() 2015-08-28 00:43:17 +01:00
Yuan Zhu e6e1f49c00 Merge branch 'convergence' of github.com:ResearchKit/ResearchKit into convergence_fix_multiline_desc_on_slider 2015-08-27 15:53:03 -07:00
Yuan Zhu 88ea180068 Fix #381 - description label not showing in vertical scale slider.
Make slider's view bottom greater than slider's bottom, also greater than lower descriptionLabel's bottom.
Make current value above slider's top, also above upper descriptionLabel's top.
2015-08-27 15:52:43 -07:00
Yuan Zhu fb50458d67 Merge pull request #406 from YuanZhu-apple/convergence_fix_crash_caused_by_omitted_fillLayer
Fixed a crash cause by omitted `fillLayer`
2015-08-27 15:38:23 -07:00
Yuan Zhu 9fd9ea3783 remove some newlines 2015-08-27 15:37:33 -07:00
Yuan Zhu 9b4aeab0a1 Fixed a crash cause by omitted fillLayer
`shouldDrawLinesForPlotIndex:` skips certain fillLayers with less than 2 valid data points. Crashed on line 149 `CAShapeLayer *fillLayer = _fillLayers[plotIndex];`.

- Use NSMutableDictionary (instead of a NSMutableArray) to store _fillLayers
- `plotIndex` is used as key in the dictionary.
- Improved _fillLayers iteration
2015-08-26 18:07:58 -07:00
Yuan Zhu 6afa92169d Merge pull request #404 from YuanZhu-apple/convergence_fix_charts_for_loops
Fixed a bug: updating array during a for loop cause incorrect behavior(cause crash)
2015-08-26 15:43:40 -07:00
Yuan Zhu b2496438bf Merge pull request #1 from rsanchezsaez/yuanzhu-convergence_fix_charts_for_loops
Charts mini-improvement
2015-08-26 15:37:26 -07:00
Ricardo SaÃÅnchez-SaÃÅez 238d8a17fe Charts: make sure 'numberOfXAxisPoints' is always used as an 'NSInteger' property; and 'numberOfPlots' as an 'NSInteger' returning method 2015-08-26 23:31:39 +01:00
Yuan Zhu cea248f433 Fixed a bug: updating array during a for loop cause incorrect behavior(leads to crash)
Improved the code quality of `for loops` in charts code.
2015-08-26 13:57:24 -07:00
Ricardo SaÃÅnchez-SaÃÅez 778e8571d2 ORKStepNavigationRule: make ObjC separate array initializers unavailable in Swift (in favor of the array of tuples initializer) 2015-08-26 21:52:01 +01:00
Ricardo Sánchez-Sáez e71356805c Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-navigationrules
# Conflicts:
#	ResearchKit/Common/ORKStepNavigationRule_Private.h
2015-08-26 21:40:52 +01:00
Ricardo SaÃÅnchez-SaÃÅez 1b4569f316 Constraint and layoutMargin code fixes
- Make sure iPad wide margins are enforced when not in Split View mode.
- Make sure all views resize correctly when going in and out of Split View mode.
2015-08-26 18:35:42 +01:00
Yuan Zhu 1c5cab61aa Merge pull request #398 from YuanZhu-apple/convergence_fixCharts_crash
Fix a crash by adding a boundary check
2015-08-25 18:10:49 -07:00
Yuan Zhu b01c7166c4 Also, it is more safe to just use _dataPoints.count to loop plots 2015-08-25 18:09:38 -07:00
Yuan Zhu 49166b553f Fix a crash by adding a boundary check 2015-08-25 18:03:20 -07:00
Yuan Zhu ddb815d2cb Merge pull request #397 from YuanZhu-apple/convergence_apply_loc
Initial Localization update
2015-08-25 16:52:47 -07:00
Yuan Zhu 30aafbd50f Initial Localization update 2015-08-25 16:43:00 -07:00
Ricardo Sánchez-Sáez 25612dc872 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/ActiveTasks/ORKFitnessContentView.m
#	ResearchKit/ActiveTasks/ORKTappingContentView.m
#	ResearchKit/ActiveTasks/ORKToneAudiometryContentView.m
#	ResearchKit/ActiveTasks/ORKTowerOfHanoiTowerView.m
#	ResearchKit/ActiveTasks/ORKWalkingTaskStepViewController.m
#	ResearchKit/Common/ORKContinueButton.m
#	ResearchKit/Common/ORKFormItemCell.m
#	ResearchKit/Common/ORKFormStepViewController.m
#	ResearchKit/Common/ORKHeadlineLabel.m
#	ResearchKit/Common/ORKImageCaptureStepViewController.m
#	ResearchKit/Common/ORKImageCaptureView.m
#	ResearchKit/Common/ORKInstructionStepView.m
#	ResearchKit/Common/ORKQuestionStepViewController.m
#	ResearchKit/Common/ORKResult.m
#	ResearchKit/Common/ORKSkin.m
#	ResearchKit/Common/ORKStepHeaderView.m
#	ResearchKit/Common/ORKSubheadlineLabel.m
#	ResearchKit/Common/ORKVerticalContainerView.m
#	ResearchKit/Common/ORKVerticalContainerView_Internal.h
#	ResearchKit/Consent/ORKConsentSignatureController.m
#	ResearchKit/Consent/ORKVisualConsentStepViewController.m
#	Testing/ORKTest/ORKTest/DynamicTask.m
2015-08-26 00:41:48 +01:00
Yuan Zhu 6ce92f19e0 Merge pull request #391 from YuanZhu-apple/convergence
Fix #390 PSAT Visual mode: digits only appears briefly if set `duration` very close to `interval`
2015-08-25 14:58:54 -07:00
Yuan Zhu 18adca5396 Merge pull request #396 from umerkhan-apple/consentLocKeys
Refactoring consent localization keys
2015-08-25 13:36:35 -07:00
Ricardo Sánchez-Sáez 8087810ac2 Coding Style Guide: improve 'Spaces in Declarations' subsection 2015-08-25 20:59:13 +01:00
Ricardo Sánchez-Sáez 3e99ad04c7 Coding Style Guide: add 'Lightweight Generics' section 2015-08-25 20:57:15 +01:00
Ricardo Sánchez-Sáez 0a1eb9c8a2 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-codingstyleguide 2015-08-25 20:23:43 +01:00
Umer Khan 5e0b696fef Refactoring consent localization keys. 2015-08-25 12:10:58 -07:00
Yuan Zhu adacb612a4 Merge pull request #393 from YuanZhu-apple/convergence_loc_improvement
Improve localization string for accessibility of Hanoi Tower
2015-08-25 11:20:06 -07:00
Yuan Zhu f19fd6187a Remove the initial space from disksString 2015-08-25 11:08:37 -07:00
Yuan Zhu 82630bdbf5 Improve localization string for accessibility of Hanoi Tower 2015-08-24 15:09:30 -07:00
Umer Khan c11e70585a Minor updates. 2015-08-24 14:35:14 -07:00
Umer Khan 045abdd919 Adding type to textChoices and removing NSArray validation for textChoices. 2015-08-24 14:23:05 -07:00
Umer Khan f9ffd5e5f1 Minor changes. 2015-08-24 12:12:24 -07:00
Umer Khan 407a3da80e Added serialization and secure coding tests, with some minor fixes. 2015-08-24 11:57:54 -07:00
Yuan Zhu 68e3f11a74 Fix #390 PSAT Visual mode: digits only appears briefly if set stimulusDuration very close to stimulusInterval
- Improved the naming of the timer
- Used a delay on `ORKActiveStepTimer` to replace the extra `dispatch_after`
- Don't show `-` if the difference between `stimulusDuration` and `interStimulusInterval` is less than timer's resolution (0.05s).

#390
2015-08-24 11:12:08 -07:00
DanKeen c786ed06e1 Merge pull request #389 from rsanchezsaez/rsanchezsaez-readme
README.md improvements
2015-08-23 21:25:51 -07:00
Ricardo Sánchez-Sáez 2765fa5575 README.md: improvements
- Simplify introduction bullet list links.
- Use proper sentences surrounding links to in-depth documentation.
- Replace all instances of 'researchkit.github.io' by 'researchkit.org'.
2015-08-24 02:43:24 +01:00
Ricardo Sánchez-Sáez 835df17c5a README.md: small improvements 2015-08-24 02:23:28 +01:00
Ricardo Sánchez-Sáez 68e0c685db Hole Peg Test Task: improve introduction image 2015-08-24 02:11:55 +01:00
Ricardo Sánchez-Sáez 352fa46668 Hole Peg Test Task: add new instruction images
(Adds pinching fingers to the diagrams.)
2015-08-24 01:41:56 +01:00
Ricardo Sánchez-Sáez 87d8db3218 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-codingstyleguide 2015-08-24 00:15:09 +01:00
Ricardo Sánchez-Sáez 458f290956 Coding Style Guide: fix small grammar issue 2015-08-23 20:13:52 +01:00
Yuan Zhu 0c268974f6 Merge pull request #387 from YuanZhu-apple/convergence
Accessibility enhancement for Charts
2015-08-20 18:08:09 -07:00
Yuan Zhu 33927b17c7 Accessibility enhancement for Charts 2015-08-20 15:19:48 -07:00
Umer Khan f8c492aadd Merge remote-tracking branch 'upstream/master' into textSlider 2015-08-20 11:31:41 -07:00
Umer Khan 22bcc07047 Added ORKTextScaleAnswerFormat 2015-08-20 11:31:20 -07:00
Yuan Zhu ca7479609c Update README.md 2015-08-20 11:31:14 -07:00
Yuan Zhu d1adbf1f50 Merge branch 'convergence' 2015-08-20 11:13:06 -07:00
Ricardo Sánchez-Sáez 321b19adbe Coding Style Guide: add 'Nullability Annotations' section
Also:
- Make new separate section for Header File Example.
- Other very small fixes.
2015-08-19 23:42:28 +01:00
Ricardo Sánchez-Sáez d86fba5c56 ORKPredicateStepNavigationRule: add Swift initializer that takes an array of tuples (result predicate, destination step identifier) instead of two arrays
Add sample code to ORKTest: move Navigable Ordered Task creation to Swift and use the overlay Swift initializer for creating the predicate step navigation rules.
2015-08-19 21:58:24 +01:00
Yuan Zhu 9f00bb182d Add bundle identifier for orktest 2015-08-19 11:44:50 -07:00
Yuan Zhu e69751361a Merge pull request #382 from YuanZhu-apple/convergence
Add strings for accessibility of charts
2015-08-19 00:45:14 -07:00
Yuan Zhu 57447fb562 Add strings for accessibility of charts 2015-08-19 00:43:32 -07:00
Yuan Zhu 9c022c300e Merge branch 'master' into ios9
Conflicts:
	ResearchKit.xcodeproj/xcshareddata/xcschemes/ResearchKit.xcscheme
	ResearchKit.xcodeproj/xcshareddata/xcschemes/docs.xcscheme
	ResearchKit/Common/ORKHelpers.h
	ResearchKit/Common/ORKHelpers.m
	ResearchKit/Common/ORKImageCaptureStepViewController.m
	Testing/ORKTest/ORKTest.xcodeproj/project.pbxproj
	Testing/ORKTest/ORKTest.xcodeproj/xcshareddata/xcschemes/ORKTest.xcscheme
	samples/ORKCatalog/ORKCatalog.xcodeproj/project.pbxproj
	samples/ORKCatalog/ORKCatalog/Results/ResultTableViewProviders.swift
2015-08-18 23:28:57 -07:00
Yuan Zhu 9614d50af9 Merge pull request #377 from chb/feature/consent-signing
Consent section: avoid headers without body
2015-08-18 21:54:27 -07:00
Pascal Pfiffner 42f9f6f03d Merge branch 'master' into feature/consent-signing 2015-08-19 06:47:00 +02:00
Yuan Zhu 445d8af2e3 Merge PSAT. Thanks @julientherier. 2015-08-18 21:22:27 -07:00
Yuan Zhu 2769b268e8 Merge pull request #178 from coxy1989/coxy-graphs
Charts for ResearchKit (Issue #92)
2015-08-18 18:15:08 -07:00
Yuan Zhu 5a4c9e172e Merge pull request #378 from newbyman/master
Performance, Consolidation of Operations, and Formatting
2015-08-18 17:43:52 -07:00
Coxy1989 1c0595f1dc Merge pull request #6 from rsanchezsaez/coxy-graphs
Fix headerdoc typos
2015-08-19 00:13:40 +01:00
Newbyman Enterprises 61ba198cc2 - Reintroduced NSUInteger index with break 2015-08-18 19:06:43 -04:00
Ricardo Sánchez-Sáez 43e4ae11b2 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/ActiveTasks/ORKWalkingTaskStepViewController.m
#	ResearchKit/Common/ORKScaleSliderView.m
#	Testing/ORKTest/ORKTest/CustomRecorder.m
2015-08-18 22:34:31 +01:00
Newbyman Enterprises 54d0ab0e3f - Additional Conditional Formatting, extended out. 2015-08-18 17:18:44 -04:00
Yuan Zhu b74048502f Merge pull request #380 from rsanchezsaez/ios9-towerofhanoi
Alternate fix for Tower of Hanoi iOS 9 constraint crash
2015-08-18 14:01:49 -07:00
Ricardo Sánchez-Sáez e86f3b6491 ORKTowerOfHanoiTowerView: alternate fix for iOS 9 constraint crash 2015-08-18 21:05:27 +01:00
Ricardo Sánchez-Sáez 64a68729a5 Merge branch 'coxy-graphs' of github.com:coxy1989/ResearchKit into coxy-graphs 2015-08-18 20:07:56 +01:00
Ricardo Sánchez-Sáez a289453eaf ORKGraphChartView: fix headerdoc typos 2015-08-18 20:07:43 +01:00
Pascal Pfiffner 848c4dee8b Whitespace fix, thanks Xcode :P 2015-08-18 11:23:22 +02:00
Pascal Pfiffner a750b2718d Add omitFromDocument property to consent section 2015-08-18 11:21:21 +02:00
Pascal Pfiffner 071242f217 Fix whitespace 2015-08-18 00:25:00 +02:00
Coxy1989 ceefc62cf0 Merge pull request #5 from rsanchezsaez/coxy-graphs
Latest charts changes
2015-08-17 23:24:45 +01:00
Yuan Zhu 738c6972a4 Merge pull request #375 from YuanZhu-apple/ios9
Accessibility enhancement of Tower of Hanoi
2015-08-17 14:33:43 -07:00
Ricardo Sánchez-Sáez e8ab35abb8 Charts: refactor 'ORK*GraphView' to 'ORK*GraphChartView' 2015-08-17 21:02:56 +01:00
Ricardo Sánchez-Sáez efba2dabb3 ORKGraphView: call 'setNeedsLayout' from overrided 'setBounds:' rather than from 'traitCollectionDidChange:'
(Fixes a rare bug in which sometimes view width is not correct during 'layoutSubviews' after a portrait to landscape rotation. E.g.: bug is present in ORKTest, but not in ORKCatalog.)
2015-08-17 20:13:01 +01:00
Newbyman Enterprises 64cb0d88bd - Removed the __nonnull declaration in the implementation file, was added back in May/15, keeping with coding style, didn't see any others. 2015-08-17 14:47:53 -04:00
Ricardo Sánchez-Sáez 4bfed38f92 ORKGraphView: share verticalReferenceLineLayer's contents (improves memory usage and performance)
Also, add slight top padding so drawn are doesn't overflow graph view bounds at default text size.
2015-08-17 19:36:51 +01:00
Ricardo Sánchez-Sáez 96fd5872a7 Chart.storyboard: nicer top background color 2015-08-17 19:34:10 +01:00
Newbyman Enterprises b53cdbc27a - Minor formatting updates of condensed if() statements. 2015-08-17 13:58:56 -04:00
Newbyman Enterprises ebdd27d251 - Code formatting updates in accordance with the provided coding style guide 2015-08-17 13:05:44 -04:00
Ricardo Sánchez-Sáez 7b97e2d9bb ORKGraphView: more efficient tintColor change; make sure secondary graph color is updated when changing referenceLineColor 2015-08-17 16:36:42 +01:00
Ricardo Sánchez-Sáez afe1d8a8ee Charts: use NSUIntegers/NSIntegers instead of int 2015-08-17 16:24:57 +01:00
Ricardo Sánchez-Sáez 8833aa841c Charts: minor headerdoc comments improvements 2015-08-17 16:12:55 +01:00
Pascal Pfiffner 52aed1a5b6 Use section title in “Learn More” screen 2015-08-17 16:58:33 +02:00
Pascal Pfiffner 2e736a7306 Consent section: avoid headers without body 2015-08-17 16:21:43 +02:00
Ricardo Sánchez-Sáez b6f2ce945d ORKGraphView: correctly handle tint color
Also fixes a occasional crash if line/point layout is tried before obtaining the normalized y axis points.
2015-08-17 04:46:08 +01:00
Ricardo Sánchez-Sáez 9fc539ec59 Merge branch 'master' of github.com:ResearchKit/ResearchKit into coxy-graphs
# Conflicts:
#	ResearchKit.xcodeproj/project.pbxproj
#	ResearchKit/Common/ORKHelpers.h
#	ResearchKit/Common/ORKHelpers.m
#	Testing/ORKTest/ORKTest.xcodeproj/project.pbxproj
#	Testing/ORKTest/ORKTest/MainViewController.m
2015-08-17 03:52:57 +01:00
Newbyman Enterprises 14e96bce38 - Simplification of operation 2015-08-16 22:40:30 -04:00
Ricardo Sánchez-Sáez 9b8ae3de92 ORKCatalog: simplify chart example to make it more visually compeling 2015-08-17 03:38:20 +01:00
Ricardo Sánchez-Sáez 445eb7deb1 ORKTest: add close button to charts example 2015-08-17 03:37:32 +01:00
Ricardo Sánchez-Sáez 149e341352 ORKTest: add charts example/test 2015-08-17 03:18:32 +01:00
Newbyman Enterprises 1350a20f15 - Formatting Consistency 2015-08-16 22:03:58 -04:00
Newbyman Enterprises aaf9d7dde4 - Leveraged mutable string directly to prevent another string builder request. 2015-08-16 21:58:51 -04:00
Newbyman Enterprises 852102eb99 - Performance consolidation of formatter string building. 2015-08-16 21:57:53 -04:00
Newbyman Enterprises c1f4392dca - Performance breaks, and returns. 2015-08-16 21:49:08 -04:00
Ricardo Sánchez-Sáez 335f887932 ORKPieChartView: implement showsPercentageLabels property
Also:
- Some property renames.
- Make text property of 'copy' type.
- Remove unneeded 'hidesLegend' property.
2015-08-17 02:36:15 +01:00
Ricardo Sánchez-Sáez 3ec1a1385b ORKGraphView: make sure all property changes propagate correctly and cause an immediate layout pass of the appropriate elements 2015-08-17 02:05:42 +01:00
Ricardo Sánchez-Sáez d35cfaacb0 ORKGraphView: make all fonts dependent on user selected contentSizeCategory
Also:
- Remove axisTitleFont property (it was the only font property).
- Extract some magic numbers as constants.
- Slightly tweaks to _scrubberLabel appearance.
- Better handling of _noDataLabel
2015-08-17 00:39:34 +01:00
Ricardo Sánchez-Sáez 1ce5cedd7e ORKPieChartView: dynamically adjust content size category fonts of the legend 2015-08-16 22:47:33 +01:00
Ricardo Sánchez-Sáez 1dc55d1a0c ORKPieChartView: move animation call to 'viewWillAppear:' and update documentation
(The new static constrained cell legend supports animation being triggered there.)
2015-08-16 22:42:20 +01:00
Ricardo Sánchez-Sáez 6939af6599 ORKPieChartLegend: reuse sizing cell instead of creating a new one each time 2015-08-16 22:37:32 +01:00
Ricardo Sánchez-Sáez 6dd1a9d3f1 ORKPieChart: new legend layout 2015-08-16 21:57:15 +01:00
Ricardo Sánchez-Sáez ab281c75ce ORKPieChartView: avoid pure white and pure black in default auto-generated pie chart colors 2015-08-16 21:51:55 +01:00
Ricardo Sánchez-Sáez 291a6fdd0f ChartListViewController: update to use graph animation method 2015-08-16 21:25:20 +01:00
Ricardo Sánchez-Sáez 9ba1f76e53 ChartDataSources: add an empty line after the last value for testing purposes 2015-08-16 21:24:16 +01:00
Ricardo Sánchez-Sáez 5abdbd97dd ORKPieChartView: extract pie, legend and titleText subviews into their own files 2015-08-16 21:23:11 +01:00
Ricardo Sánchez-Sáez b0011de863 ORKGraphView: go back to transparent plotView (it obscures xAxisView tick layers) 2015-08-16 20:54:52 +01:00
Ricardo Sánchez-Sáez be8ecb84f4 ORKGraphView, ORKPieChartView: improve headerdoc comments 2015-08-16 20:46:10 +01:00
Ricardo Sánchez-Sáez 82eb38c815 ORKPieChartView: fix liver updating of percentage labels text size category 2015-08-16 20:22:46 +01:00
Ricardo Sánchez-Sáez 6d9d488fb4 ORKPieChartView: nicer default text, title and legend text color 2015-08-16 20:11:31 +01:00
Ricardo Sánchez-Sáez 6f995d1092 ORKPieChartView: implement support for legend-less pie (when the dataSource's pieChart:titleForSection: method is not implemented) 2015-08-16 19:45:22 +01:00
Ricardo Sánchez-Sáez 02603ee8d7 ORKPieChartView: add titleTextView animation 2015-08-16 19:07:25 +01:00
Ricardo Sánchez-Sáez 70e6a7c58e ORKGraphView: honor animation duration
Now all plots start animating at the same time in multi-plot graphs.
2015-08-16 19:05:11 +01:00
Ricardo Sánchez-Sáez 8ea3ef21a9 ORKGraphView: cache pointLayer contents for points of the same color (increases rotation performance) 2015-08-16 18:24:17 +01:00
Ricardo Sánchez-Sáez 5f627812f5 ORKGraphView: replace shouldAnimate property with optional animation method 2015-08-16 16:42:33 +01:00
Ricardo Sánchez-Sáez 758988e1e5 ORKGraphView: set plotView backgroundColor to white 2015-08-16 00:56:54 +01:00
Ricardo Sánchez-Sáez a988b4dcfb ORKGraphView: store points and line layers in bi-dimensional array for better code encapsulation 2015-08-16 00:34:46 +01:00
Ricardo Sánchez-Sáez 6784af13ed ORKGraphView: split point, line and fill layers creation from layout so layers are reused instead of re-generated each time 2015-08-15 23:37:32 +01:00
Ricardo Sánchez-Sáez b4e9f2ef81 ChartDataSource: start first graph with an empty point to make sure it handles leading blank data correctly 2015-08-15 23:34:49 +01:00
Ricardo Sánchez-Sáez 825241001b Merge branch 'coxy-graphs' of github.com:coxy1989/ResearchKit into coxy-graphs 2015-08-15 06:19:28 +01:00
Ricardo Sánchez-Sáez fae45fe36a ORKGraphView: use local data points for min and max calculation 2015-08-15 05:51:14 +01:00
Ricardo Sánchez-Sáez 8716c92a30 ORKGraphView: directly add reference layers to plotView 2015-08-15 05:44:47 +01:00
Ricardo Sánchez-Sáez ae2ae485db ORKGraphView: remove ORKCircleView class and use layers instead for performance 2015-08-15 05:43:21 +01:00
Ricardo Sánchez-Sáez 8d0c13d09d ORKGraphView: remove needless array 2015-08-15 05:17:58 +01:00
Ricardo Sánchez-Sáez b869eebe9a ORKGraphView: reuse reference line layers instead of recreating them at each draw 2015-08-15 04:56:56 +01:00
Ricardo Sánchez-Sáez 655ff5a50e ORKPieChart: rename some properties; make sure layout is triggered if clockwise property changes 2015-08-15 04:55:39 +01:00
Ricardo Sánchez-Sáez e3bc0ecc4e ORKGraphView: encapsulate yAxisView layout into its own class 2015-08-15 04:06:10 +01:00
Ricardo Sánchez-Sáez b35fbae894 ORKXAxisView: fix issue with caused ticks not to draw 2015-08-15 03:39:42 +01:00
Ricardo Sánchez-Sáez 5cb8ad525f ORKPieChartView: simplify subview initializer methods 2015-08-15 03:04:07 +01:00
Ricardo Sánchez-Sáez 586f9950d2 ORKGraphView: encapsulate ORKXAxisView drawing and layout inside its own implementation 2015-08-15 03:02:59 +01:00
Ricardo Sánchez-Sáez 14afba5f60 ORKGraphView & friends: refactoring with some improvements in performance and safety
Changes:
- X canvas positions are dynamically calculated (instead of constantly packing and unpacking NSNumbers).
- _dataPoints and _yAxisPoints are now a bi-dimensional array holding all the plot values
- Now scrubbing happens over the primary plot (instead of the last one)
- ORKGraphView refreshes itself on traits change without having to manually call setNeedsLayout and refreshGraph
- Fix ORKRangedPoint isUnset method name error
2015-08-15 00:46:15 +01:00
Ricardo Sánchez-Sáez 5b0dc979de ORKAxisView: tintColor management improvements
Also: make _titleLabels an ivar.
2015-08-15 00:36:59 +01:00
Coxy1989 e270ac4c4d Merge pull request #4 from rsanchezsaez/coxy-graphs
Graphs: additional fixes
2015-08-15 00:11:55 +01:00
Yuan Zhu 3afd7ed5e4 Leave only one - after #pragma mark 2015-08-14 15:20:49 -07:00
Umer Khan 217f40e6ec Merge remote-tracking branch 'upstream/master' into textSlider 2015-08-14 15:10:24 -07:00
Yuan Zhu e8d4a17265 Update pragma mark 2015-08-14 14:45:43 -07:00
Yuan Zhu 6dc4f5f714 Add one second delay to avoid Accessibility Notification being canceled. 2015-08-14 14:43:46 -07:00
Yuan Zhu f2447ad1dc Accessibility enhancement of Tower of Hanoi 2015-08-14 13:49:36 -07:00
Yuan Zhu 6064dc8253 Merge branch 'master' into ios9
Conflicts:
	samples/ORKCatalog/ORKCatalog/ResultTableViewProviders.swift
2015-08-14 13:35:09 -07:00
Ricardo Sánchez-Sáez 59cbbf845a ORKPieChartView: call super in '-traitCollectionDidChange:' 2015-08-14 20:58:38 +01:00
Ricardo Sánchez-Sáez fac25d9a1f ORKGraphView: fix crash when trying to scrub over empty areas 2015-08-14 03:19:55 +01:00
Ricardo Sánchez-Sáez 3a277a1658 ORKGraphView: move some ivars from the internal header to the implementation file 2015-08-14 02:52:00 +01:00
Ricardo Sánchez-Sáez d23f8ee8da ChartDataSources: more compact swift 2015-08-14 02:25:01 +01:00
Ricardo Sánchez-Sáez 4dde26d7fd ORKGraphView: adjust Y axis rule length and padding 2015-08-14 02:20:53 +01:00
Ricardo Sánchez-Sáez c3bb0ec1f8 ORKGraphView, ORKPieChartView: fix localization issues of 'noDataText' 2015-08-14 02:15:06 +01:00
Ricardo Sánchez-Sáez a36035f4fa ORKGraphView: fix bugs
1) avoid crash when 'numberOfDivisionsInXAxisForGraphView:' returns a value lower than the number of data points.
2) calculate maximum and minimum value taking all plots into account.
2015-08-14 02:01:23 +01:00
Ricardo Sánchez-Sáez b4ad468974 ORKGraphView: fix bug when secondary plots have more points than primary plot 2015-08-14 01:22:02 +01:00
Ricardo Sánchez-Sáez 04ae04d928 ORKGraphView: using ivars directly instead of property accessors 2015-08-14 00:46:27 +01:00
Ricardo Sánchez-Sáez 24cd69c075 Project: move chart files to their own folder 2015-08-13 23:59:54 +01:00
Ricardo Sánchez-Sáez 597d3c6433 ChartDataSources: change graph sample values 2015-08-13 23:58:49 +01:00
Ricardo Sánchez-Sáez 3b588e39b3 ChartListViewController: caching graph cells to avoid regenerating them on device rotation; add ORKPieChartView appearing animation example code 2015-08-13 20:52:15 +01:00
Ricardo Sánchez-Sáez 60d273db6e ORKPieChartView: extensive refactor improving performance
- Subdivides ORKPieChartView into ORKPieChartTileTextView, ORKPieChartPieView and ORKPieChartLegendView, and uses autolayout to set their sizes.
- Avoids regenerating layers and percentage labels each time layoutSubviews is called.
- Makes appearing animation optional by adding the '- animateWithDuration:' method.
2015-08-13 20:50:38 +01:00
Yuan Zhu 7ee10516db Merge pull request #329 from shazino/timed-walk
Timed-Walk active task
2015-08-13 12:48:40 -07:00
Ricardo Sánchez-Sáez 9468b6e806 PieChartDataSource: show n pie segments rather than n+1 2015-08-13 20:38:33 +01:00
Yuan Zhu 56d76705ff Merge pull request #372 from umerkhan-apple/splitViewFix
iOS9: Split view fix for image capture step.
2015-08-13 10:28:00 -07:00
Julien Thérier 3353ff3dd0 Merge remote-tracking branch 'ResearchKit/master' 2015-08-13 16:30:32 +02:00
Julien Thérier 9e45652356 Fix conflict. 2015-08-13 15:52:19 +02:00
Julien Thérier d83e859d84 Fix conflicts. 2015-08-13 15:47:18 +02:00
Julien Thérier 4195dfe755 Fix conflicts. 2015-08-13 14:57:56 +02:00
Julien Thérier 55aa48b544 Merge remote-tracking branch 'ResearchKit/master' into 9hpt-task 2015-08-13 14:45:43 +02:00
Julien Thérier 78593561d2 Fix merge conflicts. 2015-08-13 11:48:04 +02:00
Julien Thérier 0075ae973c Merge remote-tracking branch 'ResearchKit/master' into timed-walk 2015-08-13 11:34:44 +02:00
Julien Thérier 5d3c846ed7 Add french localisation. 2015-08-13 11:01:11 +02:00
Julien Thérier 17c82175c2 Show time. 2015-08-13 10:50:59 +02:00
Julien Thérier ddeea33a02 Add tests. 2015-08-13 10:45:18 +02:00
Yuan Zhu 85384bbc1d Merge pull request #357 from umerkhan-apple/imageSlider
IOI #356 - Scale slider with images.
2015-08-12 13:14:04 -07:00
Yuan Zhu e322c39942 Merge pull request #370 from YuanZhu-apple/split_view_support
iOS9 iPad split view support
2015-08-12 13:12:14 -07:00
Yuan Zhu 64e8560bca Update CONTRIBUTING.md 2015-08-12 11:01:13 -07:00
Julien Thérier f4d8224164 Add icons. 2015-08-12 14:46:04 +02:00
Umer Khan ae99b8254e Refactored logic for split view error to use setError method. 2015-08-11 15:32:33 -07:00
Umer Khan c62274c103 Adding accessibility hint to image views on scale slider. 2015-08-11 11:12:24 -07:00
Umer Khan 70d449ba1c Refactored UI state code in updateAppearance. 2015-08-11 10:41:38 -07:00
Julien Thérier aa5e5b8394 Add distance result. 2015-08-11 10:36:28 +02:00
Julien Thérier f914263d0e Improve gesture recognition. 2015-08-11 09:30:21 +02:00
Yuan Zhu a2987a4bea Use vertical metrics for ORKScreenMetricTopToIllustration 2015-08-10 17:10:38 -07:00
Yuan Zhu 064af84e38 Remove NSLog 2015-08-10 16:22:23 -07:00
Umer Khan 462543c95d Removed redundant check. 2015-08-10 14:47:27 -07:00
Umer Khan b1ff602e74 Fix for image capture step while in split view. 2015-08-10 14:41:15 -07:00
Yuan Zhu 2d80083177 Merge pull request #342 from rsanchezsaez/rsanchezsaez-customrecorderfix
Fix CustomRecorder example: green filler view and orange tappable button layout
2015-08-10 10:45:10 -07:00
Yuan Zhu f14d775a78 Merge pull request #365 from umerkhan-apple/secureCodingFix
Secure coding fix and delegate fix.
2015-08-10 10:15:07 -07:00
Julien Thérier d3634439af Add results and samples. 2015-08-10 18:18:00 +02:00
Yuan Zhu f0083a3227 Add split view support.
1. Rename `ORKGetScreenTypeForWindow` to `ORKGetVerticalScreenTypeForWindow`
    And introduce `ORKGetHorizontalScreenTypeForWindow`

Use vertical screen type for most the metrics.
Except:
        ORKScreenMetricContinueButtonWidth
        ORKScreenMetricHeadlineSideMargin
        ORKScreenMetricLearnMoreButtonSideMargin
        ORKScreenMetricTopToIllustration

2. Update `layoutMargin` in vertical container view's `updateConstraintConstants`
2015-08-09 01:40:57 -07:00
Julien Thérier b509908b2a Start at first move. 2015-08-07 14:07:29 +02:00
Julien Thérier 6490a7a8c3 Dominant / Non Dominant. 2015-08-07 13:23:16 +02:00
Julien Thérier 162764e508 Right / Left orientation. 2015-08-07 13:17:58 +02:00
Julien Thérier 5d99a54c58 Update text description when fail. 2015-08-07 12:40:54 +02:00
Julien Thérier 7252b83ef2 Rename to "Place" Step. 2015-08-07 11:40:49 +02:00
Julien Thérier a0011f8e90 Comply with spacing guidelines. 2015-08-07 09:36:31 +02:00
Yuan Zhu 04ce2a3be9 Merge pull request #360 from rsanchezsaez/rsanchezsaez-navigationrules
ORKTest: add form step to Navigable Ordered Task example
2015-08-06 16:35:42 -07:00
Ricardo Sánchez-Sáez a10816efd4 ORKTest: remove CustomRecorder example 2015-08-07 01:31:02 +02:00
Umer Khan d47d1cc221 Minor refactoring. 2015-08-06 15:20:32 -07:00
Umer Khan 79a2005505 Added nullable to delegate. 2015-08-06 14:11:29 -07:00
Umer Khan 5f7a28ff3a Add a new line at the end of class. 2015-08-06 14:06:24 -07:00
Umer Khan 5029179b83 PR fixes. 2015-08-06 12:47:34 -07:00
Yuan Zhu 8d65a9e01e Merge pull request #362 from YuanZhu-apple/ios9
Fix a crash case in HanoiTowerView for iOS9
2015-08-06 12:16:23 -07:00
Yuan Zhu e00fc4461c Fix a crash case in HanoiTowerView for iOS9 2015-08-06 10:38:48 -07:00
Julien Thérier 98b6269f11 Update take with translation/rotation thresholds. 2015-08-06 14:50:19 +02:00
Ricardo Sánchez-Sáez 1bfb6f49e1 ORKTest: add form step to ORKNavigableOrderedTask example
Also: rename the button text to "Navigable Ordered Task".
2015-08-06 12:10:18 +02:00
Ricardo Sánchez-Sáez b8ee219a5f Merge branch 'master' of github.com:rsanchezsaez/ResearchKit into rsanchezsaez-constraints 2015-08-06 11:32:16 +02:00
Yuan Zhu 40db9f36d5 Fix a error in Xcode 7 beta 4 2015-08-05 16:36:25 -07:00
Yuan Zhu c2f1c033c8 Merge branch 'master' into ios9 2015-08-05 16:33:46 -07:00
Yuan Zhu d8764a7be6 Merge pull request #347 from oliverschaefer/master
Implementation of issue #346
2015-08-05 16:31:30 -07:00
Yuan Zhu 33879662e8 Merge pull request #358 from YuanZhu-apple/fix_numberOfDisks
Should use `NSUInteger` instead of `int` in the API
2015-08-05 15:59:04 -07:00
Yuan Zhu 6be21169c6 Should use NSUInteger instead of int in the API 2015-08-05 15:54:02 -07:00
Umer Khan 2f00fa57b2 Refactored some code. 2015-08-05 15:44:25 -07:00
Yuan Zhu 7a8780a59a Merge pull request #348 from rsanchezsaez/rsanchezsaez-codingstyleguide
Coding Style Guide improvements
2015-08-05 15:30:25 -07:00
Umer Khan 230e07cc83 Minor fixes 2015-08-05 14:21:33 -07:00
Umer Khan 5dd9e4ae24 Updated serialization and secure coding code. 2015-08-05 14:16:37 -07:00
Umer Khan 3194d9fcc9 Merge remote-tracking branch 'upstream/master' into imageSlider 2015-08-05 13:47:28 -07:00
Yuan Zhu 5145a38e8d Merge pull request #355 from umerkhan-apple/secureCodingFix
Secure coding fix for TowerOfHanoiStep
2015-08-05 13:44:25 -07:00
Umer Khan c32eff2947 Merge remote-tracking branch 'upstream/master' into secureCodingFix 2015-08-05 13:42:47 -07:00
Umer Khan 4070552d36 Secure coding fix for TowerOfHanoiStep 2015-08-05 13:37:56 -07:00
Umer Khan ad1c024455 Updated Documentation and refactored constants for ORKScaleRangeImageView 2015-08-05 13:30:25 -07:00
Umer Khan 66b3f9689d Modified constraints for vertical scale slider and updated example in ORKTest. 2015-08-05 13:21:27 -07:00
Umer Khan 7598debcf6 Adding images to scale 2015-08-05 11:30:05 -07:00
Yuan Zhu 41a24aeffd Merge pull request #351 from YuanZhu-apple/ios9
Merge branch 'master' into ios9
2015-08-05 10:41:20 -07:00
Julien Thérier 01e8c561bb Better UI. 2015-08-05 17:24:36 +02:00
Julien Thérier 71a0646065 Add check success. 2015-08-05 12:23:46 +02:00
Julien Thérier 515bf1de51 Remove notification for distanceLabel locale. 2015-08-05 09:17:28 +02:00
Julien Thérier c8f5a1ccb6 Add 3 arrows. 2015-08-05 09:14:39 +02:00
Oliver Schäfer 014be09d5b Added helper method shouldDisplayProgressLabel 2015-08-05 06:14:40 +02:00
Ricardo Sánchez-Sáez a5072c457c ORKGraphView: fix typo in delegate method name 2015-08-05 05:37:55 +02:00
Yuan Zhu dab245a415 Merge pull request #353 from YuanZhu-apple/issue_352
Expose `secureTextEntry` on ORKTextAnswerFormat
2015-08-04 17:35:48 -07:00
Yuan Zhu ad88999c7b Expose secureTextEntry on ORKTextAnswerFormat 2015-08-04 16:48:21 -07:00
Yuan Zhu 1ab959d8a8 Merge branch 'master' into ios9
Conflicts:
	samples/ORKCatalog/ORKCatalog/ResultTableViewProviders.swift
	samples/ORKCatalog/ORKCatalog/TaskListRow.swift

Also fixed secure coding for `ORKTowerOfHanoiStep`
2015-08-04 13:52:15 -07:00
Yuan Zhu 92028763ad Merge pull request #350 from rsanchezsaez/rsanchezsaez-towerofhanoifixes
Fix small Tower of Hanoi issues
2015-08-04 13:16:41 -07:00
Umer Khan cd43c68dc6 Added image support for scale slider 2015-08-04 11:09:00 -07:00
Ricardo Sánchez-Sáez 714ba82c0c ORKPieChartViewDataSource: add support for multiple pie charts sharing the same data source 2015-08-04 18:47:58 +02:00
Oliver Schäfer fee323588e Added Custom Navigation Item Example 2015-08-04 16:16:56 +02:00
Ricardo Sánchez-Sáez d906b07c55 ORKTowerOfHanoiTowerView: make sure tintColor is honored 2015-08-04 15:52:28 +02:00
Ricardo Sánchez-Sáez 20739d6df5 ORKTowerOfHanoiResult: fix ORKTest's serialization unit test failure due to improper array unarchiving 2015-08-04 15:29:48 +02:00
Ricardo Sánchez-Sáez 2d1c697402 ORKESerialization: refactor NSNumber, NSValue and NSString '*value' methods to property syntax 2015-08-04 15:23:03 +02:00
Ricardo Sánchez-Sáez c96a94c164 Refactor NSNumber, NSValue and NSString '*value' methods to property syntax 2015-08-04 15:22:47 +02:00
Ricardo Sánchez-Sáez 41d346853e Refactor 'value' method syntax to property syntax 2015-08-04 14:16:08 +02:00
Ricardo Sánchez-Sáez ad919639c7 Refactor 'bounds' method syntax to property syntax 2015-08-04 14:10:42 +02:00
Ricardo Sánchez-Sáez 5ebcc6d6b5 Refactor 'bytes/mutableBytes/userInfo' method syntax to property syntax 2015-08-04 14:07:30 +02:00
Ricardo Sánchez-Sáez 27c084707e Refactor 'length' method syntax to property syntax 2015-08-04 14:03:50 +02:00
Ricardo Sánchez-Sáez eeae8f3c1d Refactor 'firstObject/lastObject' method syntax to property syntax 2015-08-04 13:58:46 +02:00
Ricardo Sánchez-Sáez 36f86eb607 Refactor '[object description]' method syntax to 'object.description' property syntax 2015-08-04 13:52:23 +02:00
Ricardo Sánchez-Sáez e69460acfe Refactor '[array count]' method syntax to 'array.count' property syntax 2015-08-04 13:50:00 +02:00
Julien Thérier f7be4f6ae2 Add direction indicator. 2015-08-04 13:40:59 +02:00
Ricardo Sánchez-Sáez ffd404ff6b Coding Style Guide: improve Dot Notation section 2015-08-04 11:20:50 +02:00
Julien Thérier b99ec7b5ca Remove the distanceLabel. 2015-08-04 09:33:13 +02:00
Julien Thérier d7975ec9f2 Add arrow view. 2015-08-04 09:08:19 +02:00
Umer Khan 0405f813a2 Added ORKAnswerFormat support for ORKTextScaleSlider 2015-08-03 15:46:20 -07:00
Ricardo Sánchez-Sáez ee66c66521 Coding Style Guide: add 'Constant Declarations' section 2015-08-04 00:36:03 +02:00
Ricardo Sánchez-Sáez 6e0ee1d079 Coding Style Guide: update property/method syntax section 2015-08-04 00:04:48 +02:00
Ricardo Sánchez-Sáez cda4216d0d Coding Style Guide: better, more interesting, examples 2015-08-03 23:53:29 +02:00
Oliver Schäfer c2dd0a827c Implementation of issue #346 2015-08-03 21:34:32 +02:00
Julien Thérier 8492334353 Improve design. 2015-08-03 15:57:49 +02:00
Coxy1989 9a7d04b684 Merge pull request #3 from rsanchezsaez/coxy-graphs
Apple review improvements
2015-08-02 16:58:17 +01:00
Ricardo Sánchez-Sáez d90cd52913 ORKPieChartView: fix spacing 2015-07-31 23:17:12 +02:00
Ricardo Sánchez-Sáez ce7ff64000 ORKPieChartView: use ORKPieChartLabel class instead of custom dictionary for passing pieLabel/angle pairs 2015-07-31 23:15:30 +02:00
Ricardo Sánchez-Sáez 5f37a4d360 Graphs: use '[array count]' method syntax instead of 'array.count' property syntax 2015-07-31 21:31:41 +02:00
Ricardo Sánchez-Sáez 4215498fbc Graphs: some minor improvements 2015-07-31 21:10:05 +02:00
Ricardo Sánchez-Sáez f15b095e15 Graphs: use newly defined ORKCGFloatInvalidValue constant (CGFLOAT_MAX) as an invalid value 2015-07-31 20:50:25 +02:00
Ricardo Sánchez-Sáez 1e0c22e364 ORKGraphView: better code reuse when adding layer animations 2015-07-31 20:30:26 +02:00
Ricardo Sánchez-Sáez fa66666033 ORKGraphView: better code reuse by using block 2015-07-31 20:22:54 +02:00
Ricardo Sánchez-Sáez b034f195d3 ORKGraphView: coding style and spacing improvements 2015-07-31 20:20:28 +02:00
Ricardo Sánchez-Sáez 8b943730b4 ORKGraphView: more general removal of notification observing 2015-07-31 20:01:55 +02:00
Ricardo Sánchez-Sáez fae4cbfb80 ORKGraphView: make the constants which are unused by subclasses static to the implementation file
Also rename some non-static constants.
2015-07-31 19:56:53 +02:00
Ricardo Sánchez-Sáez a4966c12e6 ORKDiscreteGraphView: extract constant 2015-07-31 19:26:16 +02:00
Ricardo Sánchez-Sáez 378befbf4f ORKCircleView: remove unused property 2015-07-31 19:25:03 +02:00
Ricardo Sánchez-Sáez c9292ca9c3 Rename ORKCentredCollectionViewLayout files to ORKCenteredCollectionViewLayout 2015-07-31 19:24:18 +02:00
Ricardo Sánchez-Sáez 579917ff58 ORKAxisView: extract LastLabelPadding constant 2015-07-31 19:22:45 +02:00
Ricardo Sánchez-Sáez 399da05c61 Add James Cox copyright line to all graph related files 2015-07-31 19:08:40 +02:00
Ricardo Sánchez-Sáez 20e5e6db03 ORKTowerOfHanoiTowerView & ORKTowerOfHanoiStepViewController: homogenize constraint code 2015-07-30 20:56:09 +02:00
Ricardo Sánchez-Sáez ca442e748d Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/Common/ORKContinueButton.m
#	ResearchKit/Common/ORKNavigationContainerView.m
2015-07-30 20:44:23 +02:00
Ricardo Sánchez-Sáez 4e6e3c9ad3 ORKFormItemCell: remove needless screenType property and init method argument 2015-07-30 20:25:12 +02:00
Yuan Zhu 09d7f1f9e4 Merge pull request #337 from umerkhan-apple/decimal
Fixed bug in ORKNumericAnswerFormat so the value shown is the full decimal
2015-07-30 11:21:19 -07:00
Yuan Zhu 7e6b7ba6f4 Merge pull request #318 from coxy1989/coxy-toh
Add Tower of Hanoi Task
2015-07-30 11:20:47 -07:00
Yuan Zhu aad109b533 Merge pull request #338 from oliverschaefer/master
Implementation of issue #336
2015-07-30 11:20:20 -07:00
Ricardo Sánchez-Sáez eeee427c97 Remaining minor constraint code refactoring 2015-07-30 20:16:49 +02:00
Ricardo Sánchez-Sáez 2bc714f05f ORKScaleSliderView: add informative NSLayoutFormatOptions cast for empty options 2015-07-30 20:16:25 +02:00
Ricardo Sánchez-Sáez a07aa08fd4 ORKQuestionStepViewController: add informative NSLayoutFormatOptions cast for empty options 2015-07-30 20:15:43 +02:00
Ricardo Sánchez-Sáez 00ca93e14d ORKActiveStepViewController: add informative NSLayoutFormatOptions cast for empty options 2015-07-30 20:15:13 +02:00
Ricardo Sánchez-Sáez a5e641185b ORKTableContainerView: constraint method rename 2015-07-30 20:13:17 +02:00
Ricardo Sánchez-Sáez ba7433dade ORKSurveyAnswerCellForText: remove needless setNeedsUpdateConstraints 2015-07-30 20:12:39 +02:00
Ricardo Sánchez-Sáez 99f4263417 ORKSurveyAnswerCellForScale: constraint code alignment 2015-07-30 19:55:56 +02:00
Ricardo Sánchez-Sáez a5c16f9d0b ORKSurveyAnswerCellForScale: set layoutMargins outside setUpConstraints 2015-07-30 19:53:54 +02:00
Ricardo Sánchez-Sáez 2d82a2a904 ORKImageChoiceLabel: fix error in calculating the intrinsicContentSize 2015-07-30 19:50:57 +02:00
Ricardo Sánchez-Sáez 286366333f ORKSurveyAnswerCellForImageSelection: homogenize constraint code 2015-07-30 19:34:58 +02:00
Ricardo Sánchez-Sáez a90abe74ae ORKSurveyAnswerCell: constraint code alignment 2015-07-30 19:25:29 +02:00
Ricardo Sánchez-Sáez 9e72e3aaeb ORKStepHeaderView: constraint code alignment 2015-07-30 19:24:01 +02:00
Ricardo Sánchez-Sáez 0af4b33056 ORKSpatialSpanMemoryGameView: use ORKScreenMetricMaxDimension instead of magic number 2015-07-30 19:23:44 +02:00
Ricardo Sánchez-Sáez 62fc9cc6ea ORKSignatureView: move width constraint from ORKConsentSignatureWrapperView 2015-07-30 19:17:00 +02:00
Ricardo Sánchez-Sáez 2b54f90b97 ORKSkin: guard against nil window on ORKWidthForSignatureView() 2015-07-30 19:08:03 +02:00
Ricardo Sánchez-Sáez cfd1724cb0 ORKConsentSignatureController: fix unsatisfiable constraint warning 2015-07-30 19:07:38 +02:00
Ricardo Sánchez-Sáez f6d9feda07 ORKScaleSliderView: use ivars instead of internal properties and refactor constraint code. 2015-07-30 18:39:57 +02:00
Ricardo Sánchez-Sáez be44b0c39a ORKReactionTimeContentView: use ivar instead of internal property 2015-07-30 18:38:22 +02:00
Ricardo Sánchez-Sáez 5e3f4acd78 ORKQuestionStepViewController: homogenize constraint code 2015-07-30 18:26:14 +02:00
Ricardo Sánchez-Sáez fd4557a8e6 ORKNavigationContainerView: refactor constraint code
- Make constraint ivar name clearer.
- Rename updateConstraintConstants to 'updateSkipToContinueButtonConstraint' to reflect that the constraint can get activated/deactivated.
- Call 'setNeedsUpdateConstraints' after 'updateContinueAndSkipEnabled'.
2015-07-30 17:48:26 +02:00
Ricardo Sánchez-Sáez 28f4205bcd ORKInstructionStepView: homogenize constraint code 2015-07-30 17:37:29 +02:00
Ricardo Sánchez-Sáez 7b70f5c362 ORKChoiceButtonView & ORKImageSelectionView: refactor constraint code
- Homogenize constraint code.
- Simplify ORKImageSelectionView by dropping _invisibleLabel (_choiceLabel takes its functionality).
- Extract constraint setup to its own method.
2015-07-30 17:30:40 +02:00
Ricardo Sánchez-Sáez 7f25099acd ORKImageChoiceLabel: make intrinsicContentSize not to change the label itself
(Allows to drop ORKImageSelectionView invisible label.)
2015-07-30 17:25:00 +02:00
Ricardo Sánchez-Sáez fd84d8d893 ORKImageCaptureView: align constraints so they are easier to read 2015-07-30 16:32:28 +02:00
Ricardo Sánchez-Sáez 49bee20f8e ORKImageCaptureStepViewController: extract constraint setup to separate method 2015-07-30 16:29:09 +02:00
Ricardo Sánchez-Sáez 49cbb27222 ORKImageCaptureStepViewController: use ivars instead of internal properties
Also, rename some variables and method names by naming conventions.
2015-07-30 16:25:34 +02:00
Ricardo Sánchez-Sáez 90b4c7b1b6 ORKImageCaptureCameraPreviewView: extract constraint setup to separate method 2015-07-30 16:05:47 +02:00
Ricardo Sánchez-Sáez aa57b8223c ORKImageCaptureCameraPreviewView: use ivars instead of internal properties 2015-07-30 16:00:03 +02:00
Ricardo Sánchez-Sáez db93a6ddc8 ORKFormStepViewController: homogenize constraint code 2015-07-30 15:57:00 +02:00
Ricardo Sánchez-Sáez 41457846e2 ORKFormItemTextCell, ORKFormItemImageSelectionCell & ORKFormItemScaleCell: extract constraint setup to separate method 2015-07-30 15:32:28 +02:00
Ricardo Sánchez-Sáez 08f1b8e3d9 ORKFitnessContentView: better constraint onscreen align 2015-07-30 15:31:50 +02:00
Ricardo Sánchez-Sáez dc5460c120 ORKFitnessContentView: homogenize constraint code 2015-07-30 15:21:01 +02:00
Ricardo Sánchez-Sáez 6a6cb929e1 ORKQuestionStepCellHolderView: homogenize constraint code 2015-07-30 15:07:46 +02:00
Ricardo Sánchez-Sáez fb56d6b64b ORKCountdownView: extract constraint setup to its own method 2015-07-30 15:00:45 +02:00
Ricardo Sánchez-Sáez 2ed0111866 ORKConsentReviewController: homogenize constraint code 2015-07-30 14:53:58 +02:00
Ricardo Sánchez-Sáez ccc615cea6 ORKConsentLearnMoreViewController: homogenize constraint code 2015-07-30 14:51:17 +02:00
Ricardo Sánchez-Sáez 97be632ed8 ORKCompletionStepView: use translatesAutoresizingMaskIntoConstraints property syntax instead of method 2015-07-30 14:49:51 +02:00
Ricardo Sánchez-Sáez 588d9b6528 ORKAudioGraphView: extract constraint setup to its own method 2015-07-30 14:48:34 +02:00
Ricardo Sánchez-Sáez 4d791e96e3 ORKActiveStepViewController: homogenize constraint code 2015-07-30 14:40:00 +02:00
Ricardo Sánchez-Sáez deaa85ad09 ORKActiveStepQuantityView: add space between binary operators 2015-07-30 14:36:03 +02:00
Ricardo Sánchez-Sáez 415a937a7e ORKTest's MainViewController: homogenize constraint code 2015-07-30 14:31:51 +02:00
Ricardo Sánchez-Sáez e15906aeb8 CustomRecorder: homogenize constraint code 2015-07-30 14:14:11 +02:00
Ricardo Sánchez-Sáez 61f9470d84 CustomRecorder: fix green filler view and orange tappable button layout 2015-07-30 14:12:13 +02:00
Ricardo Sánchez-Sáez 853adebbcd ORKVerticalContainerView: rename constraint methods 2015-07-30 12:56:43 +02:00
Julien Thérier 0c39747462 Add first views. 2015-07-30 09:13:30 +02:00
Jamie Cox 311789b4dc resolve merge conflict 2015-07-30 00:12:27 +01:00
Oliver Schäfer 6c52fec789 Changed hasBeenPresented implementation to be a property 2015-07-29 21:47:13 +02:00
Oliver Schäfer 8b18c901f4 Added hasBeenPresented method to address issue #326 2015-07-29 21:30:53 +02:00
Umer Khan a50ae54c6a Fixed bug in ORKNumericAnswerFormat where the value shown is the full decimal. 2015-07-29 11:09:21 -07:00
Ricardo Sánchez-Sáez 7d9e48a8a6 ORKVerticalContainerView: refactor constraint code
- Homogenize code.
- Add constraints by activation.
- Enable autolayout only once for container views.
- Extract static constraint setup to its own method
- Use direct constraint variables instead of dictionary for adjustable constraints.
- Extract some constraint activation/deactivation out from updateConstraintConstants method.
2015-07-29 19:23:10 +02:00
Ricardo Sánchez-Sáez e75f76a1e6 ORKVerticalContainerView: first pass at constraint code homogenization 2015-07-29 18:13:40 +02:00
Julien Thérier 6026246a4b Remove shouldContinueOnFinish override. 2015-07-29 10:03:31 +02:00
Julien Thérier e5ac86f029 First draft for hpt task. 2015-07-29 09:29:51 +02:00
Yuan Zhu 51f9006a59 Merge pull request #331 from rsanchezsaez/rsanchezsaez-compactcontinuebutton
Reduce continue button height on compact vertical size classes
2015-07-27 12:48:51 -07:00
Ricardo Sánchez-Sáez 1ef8b48d2a ORKWalkingContentView: make constraints static 2015-07-25 14:21:44 +02:00
Ricardo Sánchez-Sáez b19f2e06a8 ORKToneAudiometryContentView: refactor constraint code
- Homogenize code.
- Make constraints update after moving to a new window.
2015-07-25 14:13:04 +02:00
Ricardo Sánchez-Sáez 8912749a75 ORKTextFieldView: make constraints static 2015-07-24 21:16:30 +02:00
Yuan Zhu 7c37a54bb2 Merge pull request #312 from umerkhan-apple/iss261
IOI # 261 - Exposing keyboard type property
2015-07-24 10:50:35 -07:00
Umer Khan 537c0a03d5 Updated comment for URL keyboard example. 2015-07-24 10:40:00 -07:00
Ricardo Sánchez-Sáez 033719036f ORKTappingContentView: make constraints static and homogenize code 2015-07-24 18:10:39 +02:00
DanKeen 6e5552d929 Merge pull request #333 from rsanchezsaez/rsanchezsaez-typos
Fix small typos (deleagte -> delegate)
2015-07-24 08:27:54 -07:00
Ricardo Sánchez-Sáez 58edda4a9c Fix small typos 2015-07-24 16:18:51 +02:00
Julien Thérier 78a32cacc9 Change distance to distanceInMeters. 2015-07-24 09:33:23 +02:00
Julien Thérier 2a77a97cc2 Use copy for NSArray properties. 2015-07-24 09:10:52 +02:00
Julien Thérier 07f41ae7d1 Fix timed-walkingman-return@2x.png stopwatch orientation. 2015-07-24 09:05:49 +02:00
Julien Thérier 4bde825ba0 Create task in the list 2015-07-24 09:01:43 +02:00
Umer Khan f222b97ca1 Refactored logic for a textField delegate callback. 2015-07-23 15:04:52 -07:00
Ricardo Sánchez-Sáez 48387caea9 ORKContinueButton: add constraints comments
Also, avoid activating constraints multiples times.
2015-07-23 20:44:17 +02:00
Yuan Zhu 8832fc1a0c Merge pull request #330 from rsanchezsaez/rsanchezsaez-navigationrules
Enhance argument validation for Predicate Step Navigation Rule
2015-07-23 11:20:41 -07:00
Ricardo Sánchez-Sáez ad5aa9912b ORKStepHeaderView: use constraint ivars instead of dictionary (clearer and safer) 2015-07-23 20:13:19 +02:00
Ricardo Sánchez-Sáez 43c6e8b72b ORKStepHeaderView: fix issue in which constraints were not correctly updated for the after moving to a new window 2015-07-23 20:02:01 +02:00
Ricardo Sánchez-Sáez 650c9154b5 ORKSurveyAnswerCellForTextField: make constraints static 2015-07-23 19:42:33 +02:00
Ricardo Sánchez-Sáez deeec06e03 ORKTableContainerView: make constraints static 2015-07-23 19:09:46 +02:00
Ricardo Sánchez-Sáez 2737e60305 ORKSurveyAnswerCellForText: make constraints static and homogenize code 2015-07-23 19:02:24 +02:00
Ricardo Sánchez-Sáez 662e2f746b ORKSurveyAnswerCellForPicker: make constraints static 2015-07-23 18:56:45 +02:00
Ricardo Sánchez-Sáez 43488a1145 ORKSurveyAnswerCellForNumber: refactor constraint code
- Homogenize code.
- Make constraints static.
- Add constraints by activation.
2015-07-23 16:29:07 +02:00
Ricardo Sánchez-Sáez 6d0bd6a66d ORKStepHeaderView: refactor constraint code
- Homogenize code.
- Move initial constraint creation to their own method.
- Add constraints by activation.
- Remove unneeded ivars.
2015-07-23 16:17:13 +02:00
Ricardo Sánchez-Sáez da76a7a174 ORKContinueButton: reduce button height on compact vertical size class on all devices except iPhone 6 Plus 2015-07-23 15:27:16 +02:00
Ricardo Sánchez-Sáez 36d57c9419 ORKSpatialSpanMemoryContentView: make constraints static 2015-07-23 14:40:10 +02:00
Ricardo Sánchez-Sáez 43c75d6d76 ORKNavigationContainerView: refactor constraint code
- Make sure [super updateConstraints] runs last.
- Make most constraints static.
- Add constraints by activation.
- Homogenize code.
2015-07-23 14:25:15 +02:00
Ricardo Sánchez-Sáez e5165b8aa5 ORKTest: slight rewrite to ORKNavigableOrderedTask example so it's easier to read 2015-07-23 13:37:35 +02:00
Ricardo Sánchez-Sáez 28b52a7114 ORKPredicateStepNavigationRule: add validation checking if objects in the passed arrays are of the correct class 2015-07-23 13:36:34 +02:00
Umer Khan 8f4bf262b6 Updated const formatting and added a fix for a bug in textfield cells. 2015-07-22 13:06:06 -07:00
Umer Khan c83351c201 PR updates. 2015-07-22 11:25:35 -07:00
Julien Thérier e9306c8965 Timed-walk active task. 2015-07-22 16:01:15 +02:00
Julien Thérier b0ca0c79db Create walking group. 2015-07-22 15:11:18 +02:00
Julien Thérier 71912aeb1d Update ORKWalkingTaskStepViewController. 2015-07-22 15:08:34 +02:00
Julien Thérier 62827cfefe Extract ORKProgressView. 2015-07-22 15:08:16 +02:00
Coxy bfd209d238 remove spaces 2015-07-21 23:23:50 +01:00
Coxy a6359e176a Add title to active step view 2015-07-21 22:57:15 +01:00
Umer Khan 25378ac9e0 Moved UITextFieldDelegate implementation into superclass UITextFieldBasedCell. 2015-07-21 14:13:18 -07:00
Umer Khan 0fc9bc54af Added PR changes. 2015-07-21 13:33:10 -07:00
Yuan Zhu d89734a682 Merge pull request #306 from brucehappy/issue_228
Implementation of issue #228
2015-07-21 13:15:27 -07:00
Yuan Zhu 318377993c Merge pull request #327 from YuanZhu-apple/issue_294
Fix issue 294, adaptive UI for non-optional single choice step
2015-07-20 15:26:12 -07:00
Yuan Zhu 97ed959b62 Fix issue 294, adaptive UI for non-optional single choice step
- Show choice cells with nextButton on step has an answer
- Show arrowed choice cells without next button on step has no answer
2015-07-20 12:59:17 -07:00
Coxy de40dd7802 rename TOWER_OF_HANOI_TASK_TASK_INTRO_TEXT_FORMAT for correctness 2015-07-18 10:55:38 +01:00
Coxy a6d032db7b prefix constant with k, revert spacing change 2015-07-17 00:51:40 +01:00
Coxy 9453a0c4f7 fix result hierarchy issue, refactor lazy instantiations, adhere to if else code style convention, other small refactorings 2015-07-17 00:46:28 +01:00
Yuan Zhu 39138f818b Merge pull request #326 from umerkhan-apple/iss325
IOI # 325 - Delegate bug in ORKTaskViewController with restorationData
2015-07-16 12:46:26 -07:00
Yuan Zhu ba62daa43c Merge pull request #324 from umerkhan-apple/iss323
IOI # 323 - Refactored ORKRecorder's logName
2015-07-16 11:17:02 -07:00
Ricardo Sánchez-Sáez d146c50cf0 ORKFormItemTextCell, ORKFormItemImageSelectionCell, ORKFormItemScaleCell: refactor constraint code
- Add constraints by activation.
- Homogenize code.
2015-07-16 18:51:09 +02:00
Ricardo Sánchez-Sáez bd6d36fa31 ORKFormItemTextFieldBasedCell: refactor constraint code
- Add constraints by activation
- Homogenize code.
2015-07-16 18:41:11 +02:00
Coxy c502a8a06d Remove dirty newline: Set minimumStepHeaderHeight instead for consistent layout with localized strings 2015-07-16 15:31:16 +01:00
Coxy 952b837a09 ORKTowerOFHanoiResult now includes move records, various refactorings, add documentation 2015-07-16 13:06:09 +01:00
Umer Khan 4aa8a67e99 Fixed delegate bug in ORKTaskViewController when initializing with restorationData. 2015-07-15 16:23:55 -07:00
Umer Khan 0f1a234076 Removed identifiers from logName and added recorderUUID. 2015-07-15 15:50:29 -07:00
Coxy 1b61c97a44 add conclusion step to ordered task for consistency 2015-07-15 20:10:48 +01:00
Coxy 43424a4727 make suggested changes 2015-07-15 20:00:16 +01:00
Ricardo Sánchez-Sáez 27a777a3e7 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-07-15 19:54:08 +02:00
Umer Khan c5809e2f71 Refactored order of step identifier and recorder identifier. 2015-07-15 10:41:25 -07:00
Coxy 632bbd399b invert highlighting of selected disk 2015-07-15 17:13:22 +01:00
Coxy1989 966f8e737d Merge pull request #2 from rsanchezsaez/coxy-toh
Add custom Tower of Hanoi task images
2015-07-15 17:04:30 +01:00
Ricardo Sánchez-Sáez d6297d2300 Add custom Tower of Hanoi task images 2015-07-15 17:27:39 +02:00
Coxy a85ce60704 revert committed redundant change 2015-07-15 09:31:59 +01:00
Coxy b17f01425c Print warning if the number of disks is not sensible + Refactorings suggested in PR. 2015-07-15 09:29:50 +01:00
Umer Khan 1573b011b6 Added step identifier to ORKRecorder logName. 2015-07-14 14:47:36 -07:00
Bruce Duncan 584394be4f Changed both accessibility properties to copy. Updated the example accessibilityInstructions in ORKTest. Updated the accessibilityInstructions documentation to include a better description and example usage. 2015-07-14 15:36:04 -04:00
Umer Khan 5f568e7516 Fixed character count bug for textAnswerFormat with maximum length. 2015-07-14 11:33:58 -07:00
Yuan Zhu 188a96bb4b Merge pull request #315 from umerkhan-apple/iss310
Implementation of issue # 310 - Custom title glitch for bar button items.
2015-07-14 10:41:40 -07:00
Umer Khan f066f4ff4b Added 'isEmailAddress' validation for isEqual in ORKTextAnswerFormat. 2015-07-13 16:19:50 -07:00
Umer Khan 285a04853f Added documentation for setupButtons method placement. 2015-07-13 14:42:27 -07:00
Coxy 255f810b6c Re-implement time formatting with NSDateComponentsFormatter 2015-07-12 19:06:03 +01:00
Umer Khan 84b8501b63 Fixed learnMoreButtonTitle not updating title text. 2015-07-10 15:15:43 -07:00
Yuan Zhu 3e51248aae Merge branch 'master' into ios9 2015-07-10 14:33:22 -07:00
Umer Khan 2054b39cc7 Fixed learnMoreButtonTitle not updating issue. 2015-07-10 11:27:54 -07:00
Coxy 979ba19958 Tower selection color scheme is now visually consistent with RK, Redundant Plist change is reverted, feature is now included in ORKTest 2015-07-10 09:39:46 +01:00
Umer Khan 00d469ca9b Fixed code format for if statement. 2015-07-09 17:36:07 -07:00
Umer Khan 268367bfbe Refactored text and email answer validation. 2015-07-09 17:30:41 -07:00
Umer Khan f7f6143f34 Added context alerts for text and email form items & updated Mini Form in test app. 2015-07-09 14:33:40 -07:00
Yuan Zhu df7428f8c0 Merge pull request #317 from danoli3/ios9-example-fix
Fix: Initializing from a metatype must reference 'init' explicitly
2015-07-09 11:27:35 -07:00
Umer Khan 019742bfc7 Moved validation code from ORKSurveyAnswerCell to ORKAnswerFormat. 2015-07-09 11:10:30 -07:00
Umer Khan 6d20008857 Updated invalid text alert message in localization file. 2015-07-09 10:37:29 -07:00
Umer Khan 86adf5093f Updated text answer validation for email address. 2015-07-09 10:36:13 -07:00
Ricardo Sánchez-Sáez fdedacaa51 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-07-09 15:46:58 +01:00
Coxy 7c9ebe1960 Add Tower of Hanoi Task 2015-07-09 13:10:54 +01:00
Daniel Rosser ef606e38ac Fix: Initializing from a metatype must reference 'init' explicitly 2015-07-09 15:54:38 +10:00
Bruce Duncan b6dce69805 Per feedback from @umerkhan-apple, renamed accessibilityHint on the ORKImageCaptureStep to be accessibilityInstructions, and then added a new accessibilityHint property that represents the accessibilityHint on the "Capture Image" button. 2015-07-08 23:14:43 -04:00
Umer Khan c005814613 Fixed navigation bar button glitch when switching views with custom title. 2015-07-08 15:24:14 -07:00
Allen Tu 1ecf1d7027 Merge remote-tracking branch 'ResearchKit/master' 2015-07-08 13:20:44 -07:00
Umer Khan 324048d709 Modified localized invalid email alert message. 2015-07-07 17:43:16 -07:00
Umer Khan 12ef17ec90 Updated unit tests for ORKEmailAnswerFormat. 2015-07-07 16:35:31 -07:00
Yuan Zhu c856b29933 Merge pull request #314 from ubik2/master
Fix issue #313 Special case handling for HKUnit percentUnit
2015-07-07 16:22:01 -07:00
Umer Khan 4e56c56985 Moved answerFormat from ORKAnswerFormat_Internal to ORKAnswerFormat. 2015-07-07 16:18:11 -07:00
Umer Khan f85964f2f9 Added alert for maximum length exceeded in a text answer. 2015-07-07 16:01:35 -07:00
Robin McCollum 548b38924b Fix issue #313 Special case handling for HKUnit percentUnit default form values 2015-07-07 15:47:21 -07:00
Umer Khan 5665d02cab Updated localizedInvalidValueStringWithAnswerString for email validation only. 2015-07-07 11:06:51 -07:00
Umer Khan 5ae1252bff Fixed ORKSurveyAnswerCellForText email validation. 2015-07-07 10:24:51 -07:00
Umer Khan 3cc9ddcb02 Updated localizedInvalidValueStringWithAnswerString for ORKTextAnswerFormat. 2015-07-06 17:51:45 -07:00
Umer Khan 8a01f9c741 Implemented PR changes. 2015-07-06 17:45:15 -07:00
Umer Khan 3ed95dec20 Updates from PR. 2015-07-06 17:03:47 -07:00
Umer Khan 3d33bb4061 Removed extra imports from ORKAnswerFormatTests. 2015-07-06 16:59:43 -07:00
Umer Khan 1838ebd9cd Added unit tests for email answer format regex validation. 2015-07-06 16:58:16 -07:00
Umer Khan e7058383cf Added ORKFormItemCell implementation for ORKEmailAnswerFormat with MiniForm Test. 2015-07-06 15:30:59 -07:00
Umer Khan cafbd3efb4 Removed ORKQuestionTypeEmail from implementation. 2015-07-06 15:10:53 -07:00
Umer Khan 02fade4c5c Revert correctValueIfNeeded in ORKSurveyAnswerCellForText back to original implementation. 2015-07-06 13:37:59 -07:00
Umer Khan ecdfacd8e4 Added questionResultClass to ORKEmailAnswerFormat. 2015-07-06 13:32:43 -07:00
Umer Khan 4a37a54f24 Updated the documentation for ORKEmailAnswerFormat 2015-07-06 13:27:35 -07:00
Umer Khan 82d1d32149 Added ORKEmailAnswerFormat test into Selection Survey. 2015-07-06 12:53:58 -07:00
Umer Khan ea189b85c5 Add class method implementation for ORKEmailAnswerFormat. 2015-07-06 10:39:08 -07:00
Yuan Zhu 75e5f6846f Merge pull request #307 from weijentu/master
ORKHTMLPDFWriter generates an extra empty page when useMetric is true
2015-07-06 10:19:55 -07:00
Umer Khan d25ee99dd6 Added ORKEmailAnswerFormat to support email answers. 2015-07-02 16:53:35 -07:00
Umer Khan ffef2ffef3 Updating comment for numer pad keyboard test. 2015-07-02 13:56:28 -07:00
Umer Khan eef7a42501 Updating ORKTest with a textAnswerFormat using a number pad keyboard. 2015-07-02 13:39:36 -07:00
Umer Khan 01231010cd Merge remote-tracking branch 'upstream/master' into iss261 2015-07-02 13:29:17 -07:00
Bruce Duncan 90448fe9b4 Per discussion with @umerkhan-apple, removed the recaptureAccessibilityHint and renamed the remaining property to simply be accessibilityHint. Added a new accessibilityLabel localized string for when the preview is showing a captured image. 2015-07-02 16:27:23 -04:00
Umer Khan 8808da5225 Exposed keyboard type property on text entry fields. 2015-07-02 13:22:14 -07:00
Allen Tu 679f8f7f6b ORKHTMLPDFWriter generate an extra empty page when useMetric is true
When useMetric is true, ORKHTMLPDFWriter is going to generate an extra
empty pages before the signature page. To gain little more pixels can
omit this extra empty page.
2015-07-02 09:58:51 -07:00
Yuan Zhu e258f01e0a Merge pull request #304 from weijentu/master
Reverse family/given name order for zh, ko and ja
2015-07-01 16:49:47 -07:00
Allen Tu da117c191f Address an issue that the method familyNameFirstLangs to be constructed multiple times
inline keyword would actually copy the code to the places where it get
referenced. It causes static dispatch_once_t onceToken and static
NSArray *familyNameFirstLangs to be duplicated.
2015-07-01 16:34:55 -07:00
Bruce Duncan 4072b6e285 Implementation of issue #228, with a separate hint for each of the two different modes of the preview view. 2015-07-01 19:11:04 -04:00
Allen Tu dfda44c635 Make the separator explicit 2015-07-01 15:55:55 -07:00
Allen Tu 130c172a6e Move currentLocalePresentsFamilyNameFirst to ORKHelpers
Move currentLocalePresentsFamilyNameFirst to ORKHelpers
2015-07-01 15:38:02 -07:00
Allen Tu 926d6f4a4b Reverse family name first in language configuration with a prefix @"zh", @"ko" or @"ja" when making a pdf consent
Reverse family name first in language configuration with a prefix
@"zh", @"ko" or @"ja" when making a pdf consent
2015-07-01 13:29:46 -07:00
Yuan Zhu 286c26359d Merge pull request #301 from umerkhan-apple/master
Localization for numbers throughout the ResearchKit
2015-07-01 13:05:08 -07:00
Umer Khan bf6c081869 Refactored macro and number formatter for tapping test. 2015-06-29 17:05:43 -07:00
Umer Khan 981103e54c Localized numbers for tapping count. 2015-06-29 16:13:42 -07:00
Umer Khan 16c1b736bc Updated the Localizable.strings files. 2015-06-29 15:36:36 -07:00
Umer Khan 6dabdf1ec1 Refactored localization code with macro. 2015-06-29 15:08:08 -07:00
Umer Khan d4e88e28cb Reverting minor change in Localizable.strings files. 2015-06-29 11:44:49 -07:00
Umer Khan 4fad188807 Minor fix in localized strings file for English (UK). 2015-06-29 11:40:05 -07:00
Umer Khan 399ea5b117 Localized numbers throughout the kit 2015-06-29 11:18:05 -07:00
Yuan Zhu 6fd991a0d7 Merge pull request #298 from YuanZhu-apple/master
Fix issue #292 Value picker in a non optional form allows going to next step
2015-06-26 10:07:46 -07:00
Yuan Zhu 88b1559ad9 Merge pull request #293 from shazino/ork_catalog-app-icon
Add AppIcon for ORKCatalog app
2015-06-23 16:09:38 -07:00
Yuan Zhu 197e0205c6 Remove debug code 2015-06-20 23:53:50 -07:00
Yuan Zhu bdc136b184 Fix issue #292 Value picker in a non optional form allows going to next step
Add a common method `ORKIsAnswerEmpty(id answer)` to judge if an answer is empty.
Also add a non optional form step in ORKTest.
2015-06-20 23:52:08 -07:00
Coxy f98574a483 correct dumb error 2015-06-18 11:16:24 +01:00
Coxy b4e463ed21 make PR suggested changes 2015-06-18 09:13:35 +01:00
Coxy 36a4d7e200 Pie chart title layout is now customisable, apply refactoring suggestions in PR, ORKAxisView now uses autolayout. A few other small changes for cosmetic reasons and consistency 2015-06-17 19:56:46 +01:00
Yuan Zhu 892404fd59 Merge pull request #204 from rsanchezsaez/rsanchezsaez-codingstyleguide
Add coding-sytle-guide.md document
2015-06-16 14:44:35 -07:00
Ricardo Sánchez-Sáez 73bb8b00a5 Coding Style Guide: personalize copyright line in example header 2015-06-16 15:13:13 +01:00
Coxy 54442f56cc pie chart now appears first in catalog, title / text labels now appear above pie chart, pie chart animation is now visible, cosmetic / style issues now resolved. 2015-06-15 19:18:05 +01:00
Ricardo Sánchez-Sáez bc3640c776 Coding Style Guide: add hard wrap guideline to appledoc section 2015-06-15 11:08:34 +01:00
Ricardo Sánchez-Sáez c659231e85 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-codingstyleguide 2015-06-14 23:00:28 +01:00
Ricardo Sánchez-Sáez 2b7efb3d9b Coding Style Guide: add appledoc section 2015-06-14 22:59:07 +01:00
Ricardo Sánchez-Sáez 6e1200ec0f Coding Style Guide: remove redundant wording 2015-06-14 22:33:45 +01:00
Ricardo Sánchez-Sáez 34f63d94e1 Coding Style Guide: add note about implicit nil initialization of object pointers 2015-06-14 22:33:45 +01:00
Ricardo Sánchez-Sáez 23c8f0c3a1 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-codingstyleguide 2015-06-14 22:33:45 +01:00
Ricardo Sánchez-Sáez b7b1cc74eb Add coding-style-guide.md document
Link it from CONTRIBUTING.md. Also: move dependency-management.md to the new docs-standalone folder.
2015-06-14 22:33:45 +01:00
Julien Therier a06c6488a4 Add AppIcon for ORKCatalog app 2015-06-14 16:42:22 +02:00
Yuan Zhu 80bed1dec2 Merge pull request #273 from brucehappy/stepheaderviewlayout
Allow caption and instruction labels to grow or shrink in step header view
2015-06-12 11:22:40 -07:00
Bruce Duncan e31b8f21f8 Moved existing layout debug code up into the initializer and changed the colors to match each separate component's background color. 2015-06-12 14:07:26 -04:00
Yuan Zhu 85cd25741a Merge pull request #265 from rsanchezsaez/rsanchezsaez-imagecapture
Fix Image Capture View constraints not being updated after a rotation
2015-06-12 10:19:53 -07:00
Bruce Duncan 3c01156ea9 Changed the layout debug colors to use alpha. Removed setting of default hugging priority in initializer for caption and instruction labels. 2015-06-12 11:27:39 -04:00
Coxy 45bd2f28e3 line charts now animate out of snapped positions, pie chart line width is configurable and capped when it results in filled pie. 2015-06-12 10:09:10 +01:00
Bruce Duncan 71de23ce43 Merge branch 'master' into stepheaderviewlayout 2015-06-11 20:55:11 -04:00
Ricardo Sánchez-Sáez e2c081dd98 ORKImageCaptureView: use ivars instead of internal properties
Also hard-wraps constraint code.
2015-06-11 00:15:52 +01:00
Ricardo Sánchez-Sáez 040cd69ecf Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-imagecapture
# Conflicts:
#	ResearchKit/Common/ORKImageCaptureView.m
2015-06-11 00:07:10 +01:00
Yuan Zhu 6f44f74028 Merge pull request #278 from coxy1989/coxy-issue193
prevent ORKFormStepViewController proceeding to the next step if the …
2015-06-10 14:26:05 -07:00
Coxy c4bfa99597 improve readability, add documenting comment 2015-06-10 08:54:19 +01:00
Yuan Zhu 57cb115ac4 Merge branch 'stable' 2015-06-09 18:37:44 -07:00
Yuan Zhu fa5214c4bc Update ResearchKit.podspec
To 1.1.2
2015-06-09 18:35:52 -07:00
Yuan Zhu 84ad0d4072 Fix two warnings in release build. 2015-06-09 18:31:52 -07:00
Yuan Zhu 8b9cfb3082 Merge branch 'stable' 2015-06-09 18:17:51 -07:00
Yuan Zhu 9ed835007f Update ResearchKit.podspec
To 1.1.1
2015-06-09 18:15:44 -07:00
Coxy df71dd575e fix 2015-06-09 13:16:15 +01:00
jwe-apple 23d42e1883 Merge pull request #288 from jwe-apple/ios9
Support for iOS 9, Xcode 7, and Swift 2.
2015-06-08 18:35:17 -07:00
John Earl 6ee6c36483 Support for iOS 9, Xcode 7, and Swift 2. 2015-06-08 18:11:07 -07:00
jwe-apple 1e67f88a7f Merge pull request #287 from jwe-apple/serialization-nullability
Add nullability annotation to ORKESerialization
2015-06-08 18:10:07 -07:00
John Earl d616b26fc0 Add nullability annotation to ORKESerialization 2015-06-08 18:05:40 -07:00
John Earl c291842226 Merge branch 'convergence' 2015-06-08 16:51:11 -07:00
Yuan Zhu 544352a288 Merge pull request #274 from niakrise/issue_259
Minor animation glitch when showing keyboard on a form #259
2015-06-08 14:27:38 -07:00
John Earl 33e0f03c37 Merge branch 'convergence' 2015-06-08 14:21:56 -07:00
jwe-apple 333053deb8 Merge pull request #283 from ResearchKit/revert-282-viet
Revert "Vietnamese is a family name first language"
2015-06-08 14:17:59 -07:00
jwe-apple 5a18717615 Revert "Vietnamese is a family name first language" 2015-06-08 14:17:39 -07:00
jwe-apple 6719ad01f0 Merge pull request #282 from jwe-apple/viet
Vietnamese is a family name first language
2015-06-08 14:17:05 -07:00
jwe-apple 9d35a3842b Merge pull request #280 from YuanZhu-apple/master
Fix test failure in ORKTest
2015-06-08 14:08:11 -07:00
Yuan Zhu 5f73e4d1c2 Fix test failure in ORKTest
Make contentURL work as a bookmark URL.
2015-06-08 14:05:36 -07:00
John Earl 0cca4e0852 Merge branch 'convergence' 2015-06-08 09:54:17 -07:00
Coxy a823528eef prevent ORKFormStepViewController proceeding to the next step if the participant has typed an invalid value (issue #193) 2015-06-08 13:57:56 +01:00
Zoya Pribytkova 3c413f3088 resolved conflicts with master branch. 2015-06-08 18:41:56 +07:00
Zoya Pribytkova d155da245a Merge branch 'master' into issue_259 2015-06-08 18:37:32 +07:00
Zoya Pribytkova 5908b3a07b fixed #259 second case. (Switching between placeholder and suffix in ORKUnitTextField) 2015-06-08 14:54:47 +07:00
Zoya Pribytkova b09c054c32 fixed #259 2015-06-06 19:26:03 +07:00
Bruce Duncan 88c207d285 Allow the captionLabel and instructionLabel to either shrink or grow when one is empty and the other is not 2015-06-06 05:30:36 -04:00
John Earl 442e55e14b Merge branch 'convergence' 2015-06-05 16:48:15 -07:00
Coxy 3be88f7d38 address PR review comments, new dynamic pie chart layout implementation 2015-06-05 16:51:06 +01:00
jwe-apple 955f1bede9 Merge pull request #205 from brucehappy/issue_186
Exclusive Text Choices - Issue #186
2015-06-03 18:31:54 -07:00
jwe-apple ededc79153 Merge pull request #220 from jamiedaniel/master
Display document in ORKConsentLearnMoreViewController
2015-06-03 18:31:34 -07:00
Ricardo Sánchez-Sáez 1f3c0bd922 Merge remote-tracking branch '_upstream/master' into rsanchezsaez-imagecapture 2015-06-03 11:27:35 +01:00
Ricardo Sánchez-Sáez 143c29ea10 ORKImageCaptureView: fix constraints not being updated after a rotation 2015-06-03 11:14:35 +01:00
Jamie Daniel 1250da259d Merge remote-tracking branch 'upstream/master' 2015-06-01 00:24:26 -04:00
Ricardo Sánchez-Sáez 38707d4f67 ORKContinueButton: refactor constraint code
- Make most constraints static and lighten updateConstraints.
- Add constraints by activation.
2015-05-29 00:30:58 +01:00
Ricardo Sánchez-Sáez b5b3c61be0 ORKConsentSignatureController: refactor constraint code
- Make most constraints static and lighten updateConstraints.
- Add constraints by activation.
2015-05-29 00:29:45 +01:00
Ricardo Sánchez-Sáez 64f702b826 ORKActiveStepQuantityView: rename local variable (additionalConstraints -> constraints) 2015-05-28 23:23:18 +01:00
Ricardo Sánchez-Sáez fdef4d29bd Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints
# Conflicts:
#	ResearchKit/Common/ORKVerticalContainerView.m
2015-05-28 23:13:44 +01:00
Coxy 2e549a3825 Header comments first draft, some header refactoring, fix line chart scrubbing bug introduced in ~2 2015-05-28 18:00:50 +01:00
Coxy 7aa352d1ca address PR comments: mostly cosmetic 2015-05-28 11:24:55 +01:00
Jamie Daniel 94f82683de Merge remote-tracking branch 'upstream/master' 2015-05-27 15:12:17 -04:00
Jamie Daniel 849b7cefa5 Merge remote-tracking branch 'upstream/master' 2015-05-27 12:06:27 -04:00
Jamie Daniel f891adfaa9 Corrected decode for url and corrected tests for serialization. 2015-05-27 11:48:11 -04:00
Jamie Daniel b29818cb96 Correct name of method to match parameters scheme 2015-05-26 20:40:49 -04:00
Jamie Daniel 21fdd1364c Display document in ORKConsentLearnMoreViewController TESTING
Fixes #215
2015-05-26 03:04:01 -04:00
Jamie Daniel 966790eb47 Display document in ORKConsentLearnMoreViewController
Fixes #215
2015-05-24 00:34:16 -04:00
Jamie Daniel 6b3dd56772 Display document in ORKConsentLearnMoreViewController
Fixes #215
2015-05-22 13:24:27 -04:00
Bruce Duncan 10f89bd445 Removed unused variables 2015-05-22 02:44:09 -04:00
Bruce Duncan 32f580eca9 Missed some uses of choiceWithText 2015-05-22 02:04:34 -04:00
Bruce Duncan b858656fde Removed extraneous choiceWithFormat factory methods and changed code that called them. 2015-05-22 01:48:12 -04:00
Bruce Duncan accc78709c Reworked existing single choice test to take in the format and choices, so that I could use it to test an answer in multiple mode, but that has a set of choices where all are exclusive. Added a two exclusive choice test which tests exclusives unselecting other exclusives. 2015-05-22 01:38:53 -04:00
Bruce Duncan 6c4aafb174 Added copyright to ORKAnswerFormat. Removed convenience initializer for ORKTextChoice and changed the one instance of code using it, per @jwe-apple request. 2015-05-21 18:03:32 -04:00
Bruce Duncan 2ac8d2c5fd Broke getting the current text choice out onto a separate line for readability. 2015-05-21 17:56:57 -04:00
Coxy fdd7a43d96 Dry up graph classes, address other PR comments 2015-05-21 17:13:51 +01:00
Ricardo Sánchez-Sáez e6a27ba94a Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-05-20 20:21:49 +01:00
Coxy c3cb9e042a Merge branch 'master' into coxy-graphs 2015-05-20 10:20:12 +01:00
Bruce Duncan 1194bafcad Neglected to mark exclusive a readonly property 2015-05-20 05:00:02 -04:00
Bruce Duncan 22124fc530 Implemented text choice exclusivity for the multiple-choice style. Exclusive choices can be used for things like "None of the above". 2015-05-20 04:45:19 -04:00
Coxy1989 39d3e3e0f2 Merge pull request #1 from rsanchezsaez/coxy-graphs
ORKCatalog: update the chart tab bar icon to a black template
2015-05-18 19:56:40 +01:00
Ricardo Sánchez-Sáez 9ff14d9f08 ORKCatalog: update the chart tab bar icon to a black template 2015-05-18 18:10:43 +01:00
Coxy 65a7fa342c fix pie chart overlapping dot / title layout issue 2015-05-18 17:24:02 +01:00
Ricardo Sánchez-Sáez ad72ce7347 Merge branch 'master' of github.com:ResearchKit/ResearchKit into rsanchezsaez-constraints 2015-05-17 21:51:24 +01:00
Coxy 360ccab3df conform to RK Coding Style Guide 2015-05-12 11:27:04 +01:00
Coxy a05adeb264 remove remaining APC prefixes 2015-05-12 09:05:08 +01:00
Ricardo Sánchez-Sáez 6b0559b13b ORKAudioContentView: make constraints static 2015-05-12 02:10:27 +01:00
Ricardo Sánchez-Sáez 93bb589eb7 ORKActiveStepTimerView: refactor constraint code
- Make most constraints static and lighten updateConstraints
- Add constraints by activatiion
2015-05-12 02:00:22 +01:00
Ricardo Sánchez-Sáez f923bd7fe0 ORKActiveStepQuantityView: avoid a bit of duplicate constraint code; rename 'setupConstraints' to 'setUpConstraints' 2015-05-12 01:55:09 +01:00
Ricardo Sánchez-Sáez af1ed4425c ORKStepHeaderView & ORKVerticalContainerView: drop '_' prefix from constraint keys 2015-05-12 00:49:19 +01:00
Coxy c14dbe8fd5 Basic charts/graphs API for ResearchKit with demos (issue #92) 2015-05-11 16:49:47 +01:00
1242 changed files with 93203 additions and 20645 deletions
+25 -18
View File
@@ -57,7 +57,7 @@ Develop your changes in your fork<a name="develop"></a>
Develop your changes using your normal development process. If you
already have code from an existing project, you may need to adjust its
style to more closely match that in the ResearchKit framework.
style to more closely match the [ResearchKit framework coding style](./docs-standalone/coding-style-guide.md).
New components may need to expose new Public or Private
headers. Public headers are for APIs that are likely to be a stable
@@ -75,13 +75,19 @@ tests, add UI to at least one test application so that the new
features can be reviewed and tested. Consider also whether to add new
code to other existing demo apps to exercise your feature.
When adding UI driven components, make sure that they are accessible.
Follow the steps outlined in the [Best Practices](../../wiki/best-practices)
section under Accessibility. Before submitting the pull request, you should
audit your components with Voice Over (or other relevant assistive technologies)
enabled.
Keep changes that fix different issues separate. For bug fixes,
separate bugs should be submitted as separate pull requests. A good
way to do this is to create a new branch in your fork for each new
bug work on.
Any new user-visible strings should be included in the English
`Localizable.strings` table so that they can be picked up and
`ResearchKit.strings` table so that they can be picked up and
localized in the next release cycle.
@@ -160,21 +166,22 @@ The `master` branch is used for work in progress. On `master`:
project:
1. If you are submitting a patch to the existing codebase, you
represent that you have the right to license the patch to the
community, and agree by submitting the patch that your changes are
represent that you have the right to license the patch, including
all code and content, to Apple and the community, and agree by
submitting the patch that your changes are
licensed under the existing license terms of the file you are
modifying (i.e., [ResearchKit BSD license](LICENSE)).
Please also add your copyright (name and year) to the relevant
files for changes that are more than 10 lines of code.
2. If you are submitting a new file for inclusion in the ResearchKit framework (no
code copied from another source), please include your copyright (name
and year) and a copy of the ResearchKit BSD license. By submitting
your new file you represent that you have the right to license your
file to the community, and agree that your file is licensed under the
ResearchKit BSD license.
3. If you aren't the author of the patch, you agree to include the
original copyright notices and licensing terms with it, to the extent
that they exist. If there wasn't a copyright notice or license,
please make a note of it. Generally we can only take in patches that
are BSD-licensed in order to maintain license compatibility within the
project.
You confirm that you have added your copyright (name and year) to
the relevant files for changes that are more than 10 lines of code.
2. If you are submitting a new file for inclusion in the ResearchKit
framework (no code or other content is copied from another source), you
have included your copyright (name and year) and a copy of the ResearchKit
BSD license. By submitting your new file you represent that you have the
right to license your file to Apple and the community, and agree that your
file submission is licensed under the ResearchKit BSD license.
3. If you aren't the author of the patch, you agree that you have
the right to submit the patch, and have included the original copyright
notices and licensing terms with it, to the extent that they exist.
If there wasn't a copyright notice or license, please make a note of it
in your response. Generally we can only take in patches that are
BSD-licensed in order to maintain license compatibility within the project.
+90 -81
View File
@@ -1,51 +1,63 @@
ResearchKit Framework
===========
The ResearchKit™ framework is an open source software framework that makes it easy to
create apps for medical research or for other research projects.
The *ResearchKit™ framework* is an open source software framework that makes it easy to create apps
for medical research or for other research projects.
* Getting Started: [Getting Started](#gettingstarted)
* Documentation: ([Programming Guide](http://researchkit.github.io/docs/docs/Overview/GuideOverview.html)) ([API](http://researchkit.github.io/docs/index.html))
* Best practices: [Best Practices](../../wiki/best-practices)
* Contributing to ResearchKit: [Contributing](CONTRIBUTING.md)
* Website and blog: ([researchkit.org](http://researchkit.github.io/index.html)) ([Blog](http://researchkit.github.io/blog.html))
* ResearchKit BSD License: [License](#license)
* [Getting Started](#gettingstarted)
* Documentation:
* [Programming Guide](http://researchkit.org/docs/docs/Overview/GuideOverview.html)
* [Framework Reference](http://researchkit.org/docs/index.html)
* [Best Practices](../../wiki/best-practices)
* [Contributing to ResearchKit](CONTRIBUTING.md)
* [Website](http://researchkit.org) and [Blog](http://researchkit.org/blog.html)
* [ResearchKit BSD License](#license)
Getting More Information
========================
* Join [researchkit-users](https://lists.apple.com/mailman/listinfo/researchkit-users) for discussing uses of the ResearchKit framework and related projects.
* Join [researchkit-dev](https://lists.apple.com/mailman/listinfo/researchkit-dev) for discussing ongoing work to improve and expand the framework.
* Or [contact us](https://developer.apple.com/contact/researchkit/)
* Join the [*ResearchKit* Forum](https://forums.developer.apple.com/community/researchkit) for discussing uses of the *ResearchKit framework and* related projects.
Use Cases
===========
A task in the ResearchKit framework contains a set of steps to present to a
user. Everything, whether its a survey, the consent process, or active tasks,
is represented as a task that can be presented with a task view controller.
A task in the *ResearchKit framework* contains a set of steps to present to a user. Everything,
whether its a *survey*, the *consent process*, or *active tasks*, is represented as a task that can
be presented with a task view controller.
Surveys
-------
The ResearchKit framework provides a pre-built user interface for surveys, which can be
presented modally on an iPhone, iPod Touch, or iPad. [Surveys](http://researchkit.github.io/docs/docs/Survey/CreatingSurveys.html)
The *ResearchKit framework* provides a pre-built user interface for surveys, which can be presented
modally on an *iPhone*, *iPod Touch*, or *iPad*. See
*[Creating Surveys](http://researchkit.org/docs/docs/Survey/CreatingSurveys.html)* for more
information.
Consent
----------------
The ResearchKit framework provides visual consent templates that you can customize to
explain the details of your research study and obtain a signature if needed. [Consent](http://researchkit.github.io/docs/docs/InformedConsent/InformedConsent.html)
The *ResearchKit framework* provides visual consent templates that you can customize to explain the
details of your research study and obtain a signature if needed.
See *[Obtaining Consent](http://researchkit.org/docs/docs/InformedConsent/InformedConsent.html)* for
more information.
Active Tasks
------------
Some studies may need data beyond survey questions or the passive data collection
capabilities available through use of the HealthKit and CoreMotion APIs if you are
programming for iOS. ResearchKit's active tasks invite users to perform activities
under semi-controlled conditions, while iPhone sensors actively collect data. [Active Tasks](http://researchkit.github.io/docs/docs/ActiveTasks/ActiveTasks.html)
Some studies may need data beyond survey questions or the passive data collection capabilities
available through use of the *HealthKit* and *CoreMotion* APIs if you are programming for *iOS*.
*ResearchKit*'s active tasks invite users to perform activities under semi-controlled conditions,
while *iPhone* sensors actively collect data. See
*[Active Tasks](http://researchkit.org/docs/docs/ActiveTasks/ActiveTasks.html)* for more
information.
Charts
------------
*ResearchKit* includes a *Charts module*. It features three chart types: a *pie chart* (`ORKPieChartView`), a *line graph chart* (`ORKLineGraphChartView`), and a *discrete graph chart* (`ORKDiscreteGraphChartView`).
The views in the *Charts module* can be used independently of the rest of *ResearchKit*. They don't automatically connect with any other part of *ResearchKit*: the developer has to supply the data to be displayed through the views' `dataSources`, which allows for maximum flexibility.
Getting Started<a name="gettingstarted"></a>
@@ -55,15 +67,15 @@ Getting Started<a name="gettingstarted"></a>
Requirements
------------
The primary ResearchKit framework codebase supports iOS and requires Xcode 6.3
or newer. The ResearchKit framework has a Base SDK version of 8.0, meaning that apps
using the ResearchKit framework can run on devices with iOS 8.0 or newer.
The primary *ResearchKit framework* codebase supports *iOS* and requires *Xcode 8.0* or newer. The
*ResearchKit framework* has a *Base SDK* version of *8.0*, meaning that apps using the *ResearchKit
framework* can run on devices with *iOS 8.0* or newer.
Installation
------------
The latest stable version of ResearchKit framework can be cloned with
The latest stable version of *ResearchKit framework* can be cloned with
```
git clone -b stable https://github.com/ResearchKit/ResearchKit.git
@@ -78,53 +90,54 @@ git clone https://github.com/ResearchKit/ResearchKit.git
Building
--------
Build the ResearchKit framework by opening `ResearchKit.xcodeproj` and running the
`ResearchKit` framework target. Optionally, run the unit tests too.
Build the *ResearchKit framework* by opening `ResearchKit.xcodeproj` and running the `ResearchKit`
framework target. Optionally, run the unit tests too.
Adding the ResearchKit framework to your App
------------------------------
This walk-through shows how to embed the ResearchKit framework in your app as a
dynamic framework, and present a simple task view controller.
This walk-through shows how to embed the *ResearchKit framework* in your app as a dynamic framework,
and present a simple task view controller.
###1. Add the ResearchKit framework to Your Project
### 1. Add the ResearchKit framework to Your Project
To get started, drag `ResearchKit.xcodeproj` from your checkout into
your iOS app project in Xcode:
To get started, drag `ResearchKit.xcodeproj` from your checkout into your *iOS* app project
in *Xcode*:
<center>
<figure>
<img src="../../wiki/AddingResearchKitXcode.png" alt="Adding the ResearchKit framework to your project" align="middle"/>
<img src="../../wiki/AddingResearchKitXcode.png" alt="Adding the ResearchKit framework to your
project" align="middle"/>
</figure>
</center>
Then, embed the ResearchKit framework as a dynamic framework in your app, by adding
it to the Embedded Binaries section of the General pane for your
target as shown in the figure below.
Then, embed the *ResearchKit framework* as a dynamic framework in your app, by adding it to the
*Embedded Binaries* section of the *General* pane for your target as shown in the figure below.
<center>
<figure>
<img src="../../wiki/AddedBinaries.png" width="100%" alt="Adding the ResearchKit framework to Embedded Binaries" align="middle"/>
<img src="../../wiki/AddedBinaries.png" width="100%" alt="Adding the ResearchKit framework to
Embedded Binaries" align="middle"/>
<figcaption><center>Adding the ResearchKit framework to Embedded Binaries</center></figcaption>
</figure>
</center>
Note: You can also import ResearchKit into your project using a [dependency manager](./dependency_management.md) such as CocoaPods or Carthage.
Note: You can also import *ResearchKit* into your project using a
[dependency manager](./docs-standalone/dependency-management.md) such as *CocoaPods* or *Carthage*.
###2. Create a Step
### 2. Create a Step
In this walk-through, we will use the ResearchKit framework to modally present a
simple single-step task showing a single instruction.
In this walk-through, we will use the *ResearchKit framework* to modally present a simple
single-step task showing a single instruction.
Create a step for your task by adding some code, perhaps in
`viewDidAppear:` of an existing view controller. To keep things
simple, we'll use an instruction step (`ORKInstructionStep`) and name
Create a step for your task by adding some code, perhaps in `viewDidAppear:` of an existing view
controller. To keep things simple, we'll use an instruction step (`ORKInstructionStep`) and name
the step `myStep`.
*Objective-C*
```objc
```objc
ORKInstructionStep *myStep =
[[ORKInstructionStep alloc] initWithIdentifier:@"intro"];
myStep.title = @"Welcome to ResearchKit";
@@ -137,12 +150,11 @@ let myStep = ORKInstructionStep(identifier: "intro")
myStep.title = "Welcome to ResearchKit"
```
###3. Create a Task
### 3. Create a Task
Use the ordered task class (`ORKOrderedTask`) to create a task that
contains `myStep`. An ordered task is just a task where the order and
selection of later steps does not depend on the results of earlier
ones. Name your task `task` and initialize it with `myStep`.
Use the ordered task class (`ORKOrderedTask`) to create a task that contains `myStep`. An ordered
task is just a task where the order and selection of later steps does not depend on the results of
earlier ones. Name your task `task` and initialize it with `myStep`.
*Objective-C*
@@ -157,11 +169,10 @@ ORKOrderedTask *task =
let task = ORKOrderedTask(identifier: "task", steps: [myStep])
```
###4. Present the Task
### 4. Present the Task
Create a task view controller (`ORKTaskViewController`) and initialize
it with your `task`. A task view controller manages a task and collects the
results of each step. In this case, your task view
Create a task view controller (`ORKTaskViewController`) and initialize it with your `task`. A task
view controller manages a task and collects the results of each step. In this case, your task view
controller simply displays your instruction step.
*Objective-C*
@@ -181,9 +192,9 @@ taskViewController.delegate = self
presentViewController(taskViewController, animated: true, completion: nil)
```
The above snippet assumes that your class implements the
`ORKTaskViewControllerDelegate` protocol. This has just one required method,
which you must implement in order to handle the completion of the task:
The above snippet assumes that your class implements the `ORKTaskViewControllerDelegate` protocol.
This has just one required method, which you must implement in order to handle the completion of
the task:
*Objective-C*
@@ -203,20 +214,19 @@ which you must implement in order to handle the completion of the task:
*Swift*
```swift
func taskViewController(taskViewController: ORKTaskViewController,
didFinishWithReason reason: ORKTaskViewControllerFinishReason,
error: NSError?) {
let taskResult = taskViewController.result
// You could do something with the result here.
func taskViewController(_ taskViewController: ORKTaskViewController,
didFinishWith reason: ORKTaskViewControllerFinishReason,
error: Error?) {
let taskResult = taskViewController.result
// You could do something with the result here.
// Then, dismiss the task view controller.
dismissViewControllerAnimated(true, completion: nil)
// Then, dismiss the task view controller.
dismiss(true, completion: nil)
}
```
If you now run your app, you should see your first ResearchKit framework
instruction step:
If you now run your app, you should see your first *ResearchKit framework* instruction step:
<center>
<figure>
@@ -229,38 +239,37 @@ instruction step:
What else can the ResearchKit framework do?
-----------------------------
The ResearchKit [`ORKCatalog`](samples/ORKCatalog) sample app is a
good place to start. Find the project in ResearchKit's
[`samples`](samples) directory. This project includes a list of all
the types of steps supported by the ResearchKit framework in one tab, and displays a
browser for the results of the last completed task in the other tab.
The *ResearchKit* [`ORKCatalog`](samples/ORKCatalog) sample app is a good place to start. Find the
project in ResearchKit's [`samples`](samples) directory. This project includes a list of all the
types of steps supported by the *ResearchKit framework* in the first tab, and displays a browser for the
results of the last completed task in the second tab. The third tab shows some examples from the *Charts module*.
License<a name="license"></a>
=======
The source in the ResearchKit repository is made available under the
following license unless another license is explicitly identified:
The source in the *ResearchKit* repository is made available under the following license unless
another license is explicitly identified:
```
Copyright (c) 2015, Apple Inc. All rights reserved.
Copyright (c) 2015 - 2017, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+346
View File
@@ -0,0 +1,346 @@
# ResearchKit Release Notes
## ResearchKit 1.5 Release Notes
*ResearchKit 1.5* supports *iOS* and requires *Xcode 8.0* or newer. The minimum supported *Base SDK* is *8.0*.
In addition to general stabiltiy and performance improvements, *ResearchKit 1.5* includes the following new features and enhancements.
- **New Active Tasks**
- **Stroop Test**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Stroop Test* shows the participant different combinations of text and tint colors on the screen.
Users must ignore the text and instead select the button that reflects the first letter of the tint color.
- **Trail Making Test**
*Contributed by Faraz Hussain.*
The *Trail Making Test* instructs participants to connect a series of labelled circles and the time to complete the test is recorded.
- **Range of Motion Test**
*Contributed by Daren Levy, Dr. Raj Karia, John Guydo.*
Participants are instructed to follow a series of steps while accelerometer and gyroscope data is captured to measure flexed and extended positions for both the shoulder and knee.
- **Touch Anywhere Active Task**
*Contributed by Daren Levy, Dr. Raj Karia, John Guydo*
Allows the user to get their device in the proper position and then tap the screen to indicate they are ready to begin the next step.
- **New Steps**
- **Video Instruction Step**
*Contributed by [Oliver Schäfer](https://github.com/oliverschaefer).*
The *Video Instruction Step* provides a step to be used to display a video.
This step can be used to display videos to users from either a local or remote source.
- **Other Improvements**
- **Tone Audiometry Test**
*Contributed by [Apple Inc](https://github.com/researchkit).*
Updated to include both a left and right button.
- **Digital Object Identifier**
*Contributed by [Apple Inc](https://github.com/researchkit).*
Assigns a Digital Object Identifier to the ResearchKit repository on GitHub to use when referencing the framework.
## ResearchKit 1.4 Release Notes
*ResearchKit 1.4* supports *iOS* and requires *Xcode 8.0* or newer. The minimum supported *Base SDK* is *8.0*.
In addition to general stabiltiy and performance improvements, *ResearchKit 1.4* includes the following new features and enhancements.
- **New Active Task**
- **Hand Tremor Task**
*Contributed by [Shannon Young](https://github.com/syoung-smallwisdom).*
The *Hand Tremor Task* asks the participant to hold the device with their most affected hand in various positions while accelerometer and motion data is captured.
- **Walk Back and Forth Task**
*Contributed by [Shannon Young](https://github.com/syoung-smallwisdom).*
The *Walk Back and Forth Task* addresses the concern of researchers/participants who have difficulty locating an unobstructed path for 20 steps.
Instructs users to walk and turn in a full circle, allowing the tests to be conducted in a smaller space.
- **New Steps**
- **Video Capture Step**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Video Capture Step* provides a step to be used to record video.
The step can be used as part of a survey to capture video respones as well.
- **Review Step**
*Contributed by [Oliver Schäfer](https://github.com/oliverschaefer).*
The *Review Step* allows a participant to review and modify their answers to a survey.
The step can be used in the middle of a survey, at the end of a survey, or a standalone module.
- **Signature Step**
*Contributed by [Oliver Schäfer](https://github.com/oliverschaefer).*
The *Signature Step* provides an interface for a participant to sign their name.
The step can be used for handwriting detection or simply to sign a document.
- **Table Step**
*Contributed by [Shannon Young](https://github.com/syoung-smallwisdom).*
The *Table Step* provides a way to neatly display data in a table.
- **Other Improvements**
- **Data Collection Module**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Data Collection Module* makes it even easier to aggregate data from HealthKit and device sensors.
- **Tapping Test**
*Contributed by [Michał Zaborowski](https://github.com/m1entus).*
The *Tapping Test* is updated to include tap duration as part of the result.
## ResearchKit 1.3 Release Notes
*ResearchKit 1.3* supports *iOS* and requires *Xcode 7.2* or newer. The minimum supported *Base SDK* is *8.0*.
In addition to general stability and performance improvements, *ResearchKit 1.3* includes the following new features and enhancements.
- **New Active Task**
- **9-Hole Peg Test**
*Contributed by [Julien Therier](https://github.com/julientherier).*
The *9-Hole Peg Test task* is used to test upper extremity functionality.
The test involves putting a variable number of pegs in a hole and subsequently removing them.
The test is documented in the scientific literature to measure the *[MSFC score in Multiple Sclerosis](http://www.nationalmssociety.org/For-Professionals/Researchers/Resources-for-Researchers/Clinical-Study-Measures/9-Hole-Peg-Test-(9-HPT))* or *[Parkinson's Disease](http://www.ncbi.nlm.nih.gov/pubmed/22020457)*.
- **Sample App**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Sample App* (`ORKSample` project on *ResearchKit*'s workspace) serves as a template application that combines different modules from the *ResearchKit framework*.
- **Account Module**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Account Module* provides steps to facilitate account creation and login.
The module includes the following steps:
1. *Registration*, used to allow the participant to create a new account.
2. *Verification*, used to confirm if the participant has verified the provided email address.
3. *Login*, used to allow registered users to login.
- **Passcode with Touch ID**
*Contributed by [Apple Inc](https://github.com/researchkit).*
The *Passcode with Touch ID module* provides the ability to secure any *ResearchKit* application with a numeric passcode.
This module includes a *Keychain Wrapper* that stores the passcode on the device, as well as the option to use *Touch ID* on compatible devices. The passcode module supports 4-digit and 6-digit numeric codes.
The passcode module provides the following components:
1. *Passcode creation step*, which can be used as part of onboarding to create a passcode and store it in the keychain.
2. *Passcode authentication view controller*, which can be modally presented when appropriate.
3. *Passcode modification view controller*, which allows the participant to change their passcode.
- **Other Improvements**
- **Optional Form Items**
*Contributed by [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez).*
Adds the `optional` property to `ORKFormItem`.
The *Continue/Done* button of form steps is enabled when all of the following conditions are met:
- At least one form item has an answer.
- All the non-optional form items have answers.
- All answered form items have valid answers.
- **Location Question**
*Contributed by [Quintiles](https://github.com/QuintilesRK).*
A *Location Question* can be used to request details about the participant's current location or about a specific address.
The question uses *MapKit* to provide a visual representation for the specified address.
- **Wait Step**
*Contributed by [Quintiles](https://github.com/QuintilesRK).*
The *Wait Step* provides a step to be used in-between steps when additional data processing is required.
The step supports both indeterminate and determinate progress views, as well as the ability to show text status updates.
- **Validated Text Answer Format**
*Contributed by [Quintiles](https://github.com/QuintilesRK).*
The *Validated Text Answer Format* enhances the existing *Text Answer Format* by providing input validation using a regular expression.
A valid *NSRegularExpression* object and an *error message* string are required to properly use this answer format.
## ResearchKit 1.2 Release Notes
*ResearchKit 1.2* supports *iOS* and requires *Xcode 7.0* or newer. The minimum supported *Base SDK* is *8.0*.
In addition to general stability and performance improvements, *ResearchKit 1.2* includes the following new features and enhancements.
- **New Active Tasks**
- **Tower of Hanoi Task**
*Contributed by [coxy1989](https://github.com/coxy1989).*
The *[Tower of Hanoi](https://en.wikipedia.org/wiki/Tower_of_Hanoi#Applications) task* is frequently used in psychological research on problem solving.
It is a mathematical puzzle consisting of three rods and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a stack in ascending order of size on one rod (the smallest at the top).
The objective of the puzzle is to move the entire stack to another rod, obeying the following rules:
1. Only one disk can be moved at a time.
2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack.
3. No disk may be placed on top of a smaller disk.
- **Paced Serial Addition Test Task**
*Contributed by [Julien Therier](https://github.com/julientherier).*
The *Paced Serial Addition Test task* provides adaptations of both the *Paced Auditory Serial Addition Test (PASAT)* and the *Paced Visual Serial Addition Test (PVSAT)*.
The *[PASAT](https://en.wikipedia.org/wiki/Paced_Auditory_Serial_Addition_Test)* is a neuropsychological test used to assess capacity and rate of information processing and sustained and divided attention.
Both tests are documented in the scientific literature ([Fos et al., 2000](http://www.ncbi.nlm.nih.gov/pubmed/11125707); [Nagels et al., 2005](http://www.ncbi.nlm.nih.gov/pubmed/15823678)) as a measure of the [*Multiple Sclerosis Functional Score*](http://www.nationalmssociety.org/For-Professionals/Researchers/Resources-for-Researchers/Clinical-Study-Measures/Multiple-Sclerosis-Functional-Composite-%28MSFC%29).
This task generates a series of single digits (for example, 60 of them), at the specific frequency (for example, one new digit every 2 or 3 seconds). The user must add the newly presented digit to the one prior to it.
- **Timed Walk Task**
*Contributed by [Julien Therier](https://github.com/julientherier).*
The *Timed Walk task* measures gait speed and is an adaptation of the [*Timed 25-Foot Walk*](http://www.nationalmssociety.org/For-Professionals/Researchers/Resources-for-Researchers/Clinical-Study-Measures/Timed-25-Foot-Walk-%28T25-FW%29) in the context of *multiple sclerosis*.
Gait speed has been demonstrated to be a useful and reliable functional measure of walking ability. When administering the *Timed Walk Task*, patients are allowed to use assistive devices (canes, crutches, walkers).
- **Charts Module**
*Contributed by [coxy1989](https://github.com/coxy1989) and [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez).*
A *Charts module* has been implemented. It features three chart types: a *pie chart* (`ORKPieChartView`), a *line graph chart* (`ORKLineGraphChartView`), and a *discrete graph chart* (`ORKDiscreteGraphChartView`).
The views in the *Charts module* can be used independently of the rest of *ResearchKit*. It doesn't automatically connect with any other *ResearchKit* module: the developer has to supply the data to be displayed through the views' `dataSources`, which allows for maximum flexibility.
- **Other Improvements**
- **Scale Answer Format**
*Contributed by [Apple Inc](https://github.com/researchkit).*
*Discrete scales* now support *text choice* labels, and all *scales* support images in place of the minimum and maximum range labels.
- **Result Predicates**
*Contributed by [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez).*
The predicate-building methods in `ORKResultPredicate` now use the new `ORKResultSelector` class for unequivocally identifying a *question step result* or a *form item result*.
This eliminates ambiguity when matching results with the same inner scope identifier. For example, a *form item result* can have the same identifier as a *question step result* or as another *form item result* in a different *form step*, and you can now match them separately.
## ResearchKit 1.1 Release Notes
*ResearchKit 1.1* supports *iOS* and requires *Xcode 6.3* or newer. The minimum supported *Base SDK* is *8.0*.
In addition to general stability and performance improvements, *ResearchKit 1.1* includes the following new features and enhancements.
- **Navigable Ordered Task**
*Contributed by [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez).*
A new type of *conditional ordered task* (`ORKNavigableOrderedTask`) has been implemented.
The developer can use the `ORKStepNavigationRule` subclasses to dynamically navigate between the task steps:
- `ORKPredicateStepNavigationRule` allows to make conditional jumps by matching previous results (either those of the ongoing task, or those of any previously stored task result tree). You typically use the class methods in the `ORKResultPredicate` class to match answers in the most commonly used result types.
- `ORKDirectStepNavigationRule` provides support for unconditional jumps.
- **New Active Tasks**
- **Reaction Time Task**
*Contributed by [coxy1989](https://github.com/coxy1989).*
The *Reaction Time Task* is an adaptation of the [*Simple Reaction Time test (SRT)*](http://www.cambridgecognition.com/tests/simple-reaction-time-srt). *SRT* measures reaction time through delivery of a known stimulus to a known location to elicit a known response.
This test is deployed in a range of research questions across fields including medicine, sports science and psychology.
Although it classically involves pressing the space bar or clicking a mouse in response to an event on screen, the *ResearchKit* implementation relies on the study participant shaking the device when she sees a blue circle on the screen, which we think is more correlatable to a true stimulus reaction test.
- **Tone Audiometry Task**
*Contributed by [Vincent Tourraine](https://github.com/vtourraine).*
The *Tone Audiometry Task* is an adaptation of the [*Pure Tone Audiometry test (PTA)*](https://en.wikipedia.org/wiki/Pure_tone_audiometry). *PTA* is a key hearing test used to identify hearing threshold levels of an individual, enabling determination of the degree, type and configuration of a hearing loss.
The *ResearchKit* implementation generates a series of pure sinusoid sounds, with different frequencies and on different channels (left or right). The test starts at the minimum volume and is gradually increased until the participant perceives it and taps a button. At that time, the current sound amplitude, frequency and channel are recorded.
- **Scale Answer Format Enhancements**
*Contributed by [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez) and [Bruce Duncan](https://github.com/brucehappy).*
Support for discrete and continuous *vertical scales* has been added. Some questions, like mood measurement or symptom severity measurement queries may be more naturally presented using a *vertical scale*.
The *Scale Answer Format* has also been improved by making it usable within forms.
- **Image Capture Step**
*Contributed by [Bruce Duncan](https://github.com/brucehappy).*
An *Image Capture Step* has been added. The researcher can ask the participant to take pictures of relevant body parts. The researcher can provide a body part image template to facilitate the scale and orientation of the taken pictures.
- **iPad Support**
*Contributed by [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez) and [Apple Inc](https://github.com/researchkit).*
*iPad support* for all orientations has been implemented.
- **iPhone Landscape Support**
*Contributed by [Apple Inc.](https://github.com/researchkit) and [Ricardo Sánchez-Sáez](https://github.com/rsanchezsaez).*
*iPhone landscape orientation support* has been implemented.
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:ResearchKit.xcodeproj">
</FileRef>
<FileRef
location = "group:Testing/ORKTest/ORKTest.xcodeproj">
</FileRef>
<FileRef
location = "group:samples/ORKCatalog/ORKCatalog.xcodeproj">
</FileRef>
<FileRef
location = "group:samples/ORKSample/ORKSample.xcodeproj">
</FileRef>
</Workspace>
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'ResearchKit'
s.version = '1.0.0'
s.version = '1.5.1'
s.summary = 'ResearchKit is an open source software framework that makes it easy to create apps for medical research or for other research projects.'
s.homepage = 'https://www.github.com/ResearchKit/ResearchKit'
s.documentation_url = 'http://researchkit.github.io/docs/'
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.author = { 'researchkit.org' => 'http://researchkit.org' }
s.source = { :git => 'https://github.com/ResearchKit/ResearchKit.git', :tag => s.version.to_s }
s.public_header_files = `./scripts/find_headers.rb --public --private`.split("\n")
s.source_files = 'ResearchKit/**/*.{h,m}'
s.source_files = 'ResearchKit/**/*.{h,m,swift}'
s.resources = 'ResearchKit/**/*.{fsh,vsh}', 'ResearchKit/Animations/**/*.m4v', 'ResearchKit/Artwork.xcassets', 'ResearchKit/Localized/*.lproj'
s.platform = :ios, '8.0'
s.requires_arc = true
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.8">
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
@@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@@ -48,13 +48,15 @@
ReferencedContainer = "container:ResearchKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@@ -72,10 +74,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0630"
version = "1.8">
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
@@ -23,19 +23,21 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@@ -53,10 +55,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
+2 -1
View File
@@ -30,5 +30,6 @@
// Shared header for accessibility functionality.
#import "UIView+ORKAccessibility.h"
#import "ORKAccessibilityFunctions.h"
#import "ORKLineGraphAccessibilityElement.h"
#import "UIView+ORKAccessibility.h"
@@ -30,9 +30,11 @@
#import "ORKDefines.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
NS_ASSUME_NONNULL_BEGIN
@class ORKScaleSlider;
// Used to properly format values from the ORKScaleSlider.
@@ -43,7 +45,7 @@ ORK_EXTERN NSString *ORKAccessibilityFormatContinuousScaleSliderValue(CGFloat va
ORK_EXTERN void ORKAccessibilityPerformBlockAfterDelay(NSTimeInterval delay, void(^block)(void));
// Convenience for posting an accessibility notification after a delay.
ORK_INLINE void ORKAccessibilityPostNotificationAfterDelay(UIAccessibilityNotifications notification, id argument, NSTimeInterval delay) {
ORK_INLINE void ORKAccessibilityPostNotificationAfterDelay(UIAccessibilityNotifications notification, _Nullable id argument, NSTimeInterval delay) {
ORKAccessibilityPerformBlockAfterDelay(delay, ^{
UIAccessibilityPostNotification(notification, argument);
});
@@ -52,3 +54,5 @@ ORK_INLINE void ORKAccessibilityPostNotificationAfterDelay(UIAccessibilityNotifi
// Creates a string suitable for Voice Over by joining the variables with ", " and avoiding nil and empty strings.
#define ORKAccessibilityStringForVariables(...) _ORKAccessibilityStringForVariables(ORK_NARG(__VA_ARGS__), ##__VA_ARGS__)
ORK_EXTERN NSString *_ORKAccessibilityStringForVariables(NSInteger numParameters, NSString *baseString, ...);
NS_ASSUME_NONNULL_END
@@ -29,11 +29,14 @@
*/
#import <UIKit/UIKit.h>
#import "ORKAccessibilityFunctions.h"
#import "ORKAnswerFormat_Internal.h"
@import UIKit;
#import "ORKScaleSlider.h"
#import "ORKScaleSliderView.h"
#import "ORKAnswerFormat_Internal.h"
#import "ORKAccessibilityFunctions.h"
#import "UIView+ORKAccessibility.h"
@@ -0,0 +1,43 @@
/*
Copyright (c) 2015, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@interface ORKLineGraphAccessibilityElement : UIAccessibilityElement
- (nonnull instancetype)initWithAccessibilityContainer:(nonnull UIView *)container index:(NSInteger)index maxIndex:(NSInteger)maxIndex;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,66 @@
/*
Copyright (c) 2015, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKLineGraphAccessibilityElement.h"
@interface ORKLineGraphAccessibilityElement()
@property (assign, nonatomic) NSInteger index;
@property (assign, nonatomic) NSInteger maxIndex;
@end
@implementation ORKLineGraphAccessibilityElement
- (nonnull instancetype)initWithAccessibilityContainer:(nonnull UIView *)container index:(NSInteger)index maxIndex:(NSInteger)maxIndex {
self = [super initWithAccessibilityContainer:container];
if (self) {
self.index = index;
self.maxIndex = maxIndex;
}
return self;
}
- (CGRect)accessibilityFrame {
if (self.maxIndex == 0) {
return [super accessibilityFrame];
}
CGRect containerFrame = [self.accessibilityContainer frame];
CGFloat height = CGRectGetHeight(containerFrame);
CGFloat width = CGRectGetWidth(containerFrame) / self.maxIndex;
CGFloat x = self.index * width;
return UIAccessibilityConvertFrameToScreenCoordinates(CGRectMake(x, 0, width, height), self.accessibilityContainer);
}
@end
@@ -29,8 +29,7 @@
*/
#import <UIKit/UIKit.h>
#import <ResearchKit/ResearchKit.h>
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@@ -29,8 +29,7 @@
*/
#import <CoreLocation/CoreLocation.h>
#import <ResearchKit/ResearchKit.h>
@import CoreLocation;
NS_ASSUME_NONNULL_BEGIN
@@ -30,7 +30,8 @@
#import "CLLocation+ORKJSONDictionary.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
@implementation CLLocation (ORKJSONDictionary)
@@ -45,10 +46,11 @@
NSDate *timestamp = self.timestamp;
CLFloor *floor = self.floor;
NSMutableDictionary *dictionary = [@{@"timestamp" : ORKStringFromDateISO8601(timestamp)} mutableCopy];
NSMutableDictionary *dictionary = [@{ @"timestamp": ORKStringFromDateISO8601(timestamp) } mutableCopy];
if (horizAccuracy >= 0) {
dictionary[@"coordinate"] = @{ @"latitude" : [NSDecimalNumber numberWithDouble:coord.latitude], @"longitude" : [NSDecimalNumber numberWithDouble:coord.longitude]};
dictionary[@"coordinate"] = @{ @"latitude": [NSDecimalNumber numberWithDouble:coord.latitude],
@"longitude": [NSDecimalNumber numberWithDouble:coord.longitude]};
dictionary[@"horizontalAccuracy"] = [NSDecimalNumber numberWithDouble:horizAccuracy];
}
if (vertAccuracy >= 0) {
@@ -29,8 +29,7 @@
*/
#import <CoreMotion/CoreMotion.h>
#import <ResearchKit/ResearchKit.h>
@import CoreMotion;
NS_ASSUME_NONNULL_BEGIN
@@ -35,10 +35,10 @@
@implementation CMAccelerometerData (ORKJSONDictionary)
- (NSDictionary *)ork_JSONDictionary {
NSDictionary *dictionary = @{@"timestamp": [NSDecimalNumber numberWithDouble:self.timestamp],
@"x" : [NSDecimalNumber numberWithDouble:self.acceleration.x],
@"y" : [NSDecimalNumber numberWithDouble:self.acceleration.y],
@"z" : [NSDecimalNumber numberWithDouble:self.acceleration.z]
NSDictionary *dictionary = @{ @"timestamp": [NSDecimalNumber numberWithDouble:self.timestamp],
@"x": [NSDecimalNumber numberWithDouble:self.acceleration.x],
@"y": [NSDecimalNumber numberWithDouble:self.acceleration.y],
@"z": [NSDecimalNumber numberWithDouble:self.acceleration.z]
};
return dictionary;
}
@@ -29,8 +29,7 @@
*/
#import <CoreMotion/CoreMotion.h>
#import <ResearchKit/ResearchKit.h>
@import CoreMotion;
NS_ASSUME_NONNULL_BEGIN
@@ -42,34 +42,34 @@
CMCalibratedMagneticField field = self.magneticField;
NSDictionary *dictionary = @{@"timestamp": [NSDecimalNumber numberWithDouble:self.timestamp],
@"attitude" : @{
@"x" : [NSDecimalNumber numberWithDouble:attitude.x],
@"y" : [NSDecimalNumber numberWithDouble:attitude.y],
@"z" : [NSDecimalNumber numberWithDouble:attitude.z],
@"w" : [NSDecimalNumber numberWithDouble:attitude.w]
},
@"rotationRate" : @{
@"x" : [NSDecimalNumber numberWithDouble:rotationRate.x],
@"y" : [NSDecimalNumber numberWithDouble:rotationRate.y],
@"z" : [NSDecimalNumber numberWithDouble:rotationRate.z]
},
@"gravity" : @{
@"x" : [NSDecimalNumber numberWithDouble:gravity.x],
@"y" : [NSDecimalNumber numberWithDouble:gravity.y],
@"z" : [NSDecimalNumber numberWithDouble:gravity.z]
},
@"userAcceleration" : @{
@"x" : [NSDecimalNumber numberWithDouble:userAccel.x],
@"y" : [NSDecimalNumber numberWithDouble:userAccel.y],
@"z" : [NSDecimalNumber numberWithDouble:userAccel.z]
},
@"magneticField" : @{
@"x" : [NSDecimalNumber numberWithDouble:field.field.x],
@"y" : [NSDecimalNumber numberWithDouble:field.field.y],
@"z" : [NSDecimalNumber numberWithDouble:field.field.z],
@"accuracy" : [NSDecimalNumber numberWithDouble:field.accuracy]
}
};
@"attitude": @{
@"x": [NSDecimalNumber numberWithDouble:attitude.x],
@"y": [NSDecimalNumber numberWithDouble:attitude.y],
@"z": [NSDecimalNumber numberWithDouble:attitude.z],
@"w": [NSDecimalNumber numberWithDouble:attitude.w]
},
@"rotationRate": @{
@"x": [NSDecimalNumber numberWithDouble:rotationRate.x],
@"y": [NSDecimalNumber numberWithDouble:rotationRate.y],
@"z": [NSDecimalNumber numberWithDouble:rotationRate.z]
},
@"gravity": @{
@"x": [NSDecimalNumber numberWithDouble:gravity.x],
@"y": [NSDecimalNumber numberWithDouble:gravity.y],
@"z": [NSDecimalNumber numberWithDouble:gravity.z]
},
@"userAcceleration": @{
@"x": [NSDecimalNumber numberWithDouble:userAccel.x],
@"y": [NSDecimalNumber numberWithDouble:userAccel.y],
@"z": [NSDecimalNumber numberWithDouble:userAccel.z]
},
@"magneticField": @{
@"x": [NSDecimalNumber numberWithDouble:field.field.x],
@"y": [NSDecimalNumber numberWithDouble:field.field.y],
@"z": [NSDecimalNumber numberWithDouble:field.field.z],
@"accuracy": [NSDecimalNumber numberWithDouble:field.accuracy]
}
};
return dictionary;
}
@@ -29,8 +29,7 @@
*/
#import <CoreMotion/CoreMotion.h>
#import <ResearchKit/ResearchKit.h>
@import CoreMotion;
NS_ASSUME_NONNULL_BEGIN
@@ -30,54 +30,55 @@
#import "CMMotionActivity+ORKJSONDictionary.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
static NSString *const kActivityUnknown = @"unknown";
static NSString *const kActivityStationary = @"stationary";
static NSString *const kActivityWalking = @"walking";
static NSString *const kActivityRunning = @"running";
static NSString *const kActivityAutomotive = @"automotive";
static NSString *const kStartDateKey = @"startDate";
static NSString *const kEndDateKey = @"endDate";
static NSString *const ActivityUnknown = @"unknown";
static NSString *const ActivityStationary = @"stationary";
static NSString *const ActivityWalking = @"walking";
static NSString *const ActivityRunning = @"running";
static NSString *const ActivityAutomotive = @"automotive";
static NSString *const StartDateKey = @"startDate";
static NSString *const EndDateKey = @"endDate";
static NSString *stringFromActivityConfidence(CMMotionActivityConfidence confidence) {
NSDictionary *confidences = @{@(CMMotionActivityConfidenceHigh) : @"high",
@(CMMotionActivityConfidenceMedium) : @"medium",
@(CMMotionActivityConfidenceLow) : @"low"};
NSDictionary *confidences = @{@(CMMotionActivityConfidenceHigh): @"high",
@(CMMotionActivityConfidenceMedium): @"medium",
@(CMMotionActivityConfidenceLow): @"low"};
return confidences[@(confidence)];
}
static NSArray *activityArray(CMMotionActivity *activity) {
NSMutableArray *array = [NSMutableArray array];
if (activity.unknown) {
[array addObject:kActivityUnknown];
[array addObject:ActivityUnknown];
}
if (activity.stationary) {
[array addObject:kActivityStationary];
[array addObject:ActivityStationary];
}
if (activity.walking) {
[array addObject:kActivityWalking];
[array addObject:ActivityWalking];
}
if (activity.running) {
[array addObject:kActivityRunning];
[array addObject:ActivityRunning];
}
if (activity.automotive) {
[array addObject:kActivityAutomotive];
[array addObject:ActivityAutomotive];
}
return array;
}
static NSString *const kActivityKey = @"activity";
static NSString *const ActivityKey = @"activity";
static NSString *const ConfidenceKey = @"confidence";
static NSString *const kConfidenceKey = @"confidence";
@implementation CMMotionActivity (ORKJSONDictionary)
- (NSDictionary *)ork_JSONDictionary {
return @{kConfidenceKey : stringFromActivityConfidence(self.confidence),
kActivityKey : activityArray(self),
kStartDateKey : ORKStringFromDateISO8601(self.startDate)};
return @{ConfidenceKey: stringFromActivityConfidence(self.confidence),
ActivityKey: activityArray(self),
StartDateKey: ORKStringFromDateISO8601(self.startDate)};
}
@end
@@ -29,8 +29,7 @@
*/
#import <CoreMotion/CoreMotion.h>
#import <ResearchKit/ResearchKit.h>
@import CoreMotion;
NS_ASSUME_NONNULL_BEGIN
@@ -30,17 +30,17 @@
#import "CMPedometerData+ORKJSONDictionary.h"
#import "ORKHelpers.h"
#import <CoreMotion/CoreMotion.h>
#import "ORKHelpers_Internal.h"
@import CoreMotion;
@implementation CMPedometerData (ORKJSONDictionary)
- (NSDictionary *)ork_JSONDictionary {
NSMutableDictionary *dictionary = [@{@"startDate": ORKStringFromDateISO8601(self.startDate),
@"endDate": ORKStringFromDateISO8601(self.endDate)
} mutableCopy];
for (NSString *key in @[@"numberOfSteps", @"distance", @"floorsAscended", @"floorsDescended"]) {
NSMutableDictionary *dictionary = [@{ @"startDate": ORKStringFromDateISO8601(self.startDate), @"endDate": ORKStringFromDateISO8601(self.endDate) } mutableCopy];
for (NSString *key in @[ @"numberOfSteps", @"distance", @"floorsAscended", @"floorsDescended" ]) {
[dictionary setValue:[self valueForKey:key] forKey:key];
}
return dictionary;
@@ -29,8 +29,7 @@
*/
#import <HealthKit/HealthKit.h>
#import <ResearchKit/ResearchKit.h>
@import HealthKit;
NS_ASSUME_NONNULL_BEGIN
@@ -30,19 +30,20 @@
#import "HKSample+ORKJSONDictionary.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
static NSString *const kHKSampleIdentifierKey = @"type"; // For compatibility with Health XML export
static NSString *const kHKUUIDKey = @"uuid";
static NSString *const kHKSampleStartDateKey = @"startDate";
static NSString *const kHKSampleEndDateKey = @"endDate";
static NSString *const kHKSampleValue = @"value";
static NSString *const kHKMetadataKey = @"metadata";
static NSString *const kHKSourceKey = @"source";
static NSString *const kHKUnitKey = @"unit";
static NSString *const kHKCorrelatedObjectsKey = @"objects";
// static NSString *const kHKSourceIdentifierKey = @"sourceBundleIdentifier";
static NSString *const HKSampleIdentifierKey = @"type"; // For compatibility with Health XML export
static NSString *const HKUUIDKey = @"uuid";
static NSString *const HKSampleStartDateKey = @"startDate";
static NSString *const HKSampleEndDateKey = @"endDate";
static NSString *const HKSampleValue = @"value";
static NSString *const HKMetadataKey = @"metadata";
static NSString *const HKSourceKey = @"source";
static NSString *const HKUnitKey = @"unit";
static NSString *const HKCorrelatedObjectsKey = @"objects";
// static NSString *const HKSourceIdentifierKey = @"sourceBundleIdentifier";
@implementation HKSample (ORKJSONDictionary)
@@ -52,31 +53,31 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
// Type identification
HKSampleType *sampleType = [self sampleType];
mutableDictionary[kHKSampleIdentifierKey] = [sampleType identifier];
mutableDictionary[HKSampleIdentifierKey] = [sampleType identifier];
// consider adding @"class" : NSStringFromClass(sampleType) ?
// Start and end dates
NSDate *startDate = [self startDate];
if (startDate) {
mutableDictionary[kHKSampleStartDateKey] = ORKStringFromDateISO8601(startDate);
mutableDictionary[HKSampleStartDateKey] = ORKStringFromDateISO8601(startDate);
}
NSDate *endDate = [self endDate];
if (endDate) {
mutableDictionary[kHKSampleEndDateKey] = ORKStringFromDateISO8601(endDate);
mutableDictionary[HKSampleEndDateKey] = ORKStringFromDateISO8601(endDate);
}
if (unit) {
mutableDictionary[kHKUnitKey] = [unit unitString];
mutableDictionary[HKUnitKey] = [unit unitString];
}
if ((options & ORKSampleIncludeUUID)) {
NSUUID *uuid = [self UUID];
if (uuid) {
mutableDictionary[kHKUUIDKey] = [uuid UUIDString];
mutableDictionary[HKUUIDKey] = uuid.UUIDString;
}
}
if ( (options & ORKSampleIncludeMetadata) && [self.metadata count] > 0) {
if ( (options & ORKSampleIncludeMetadata) && self.metadata.count > 0) {
NSMutableDictionary *metadata = [self.metadata mutableCopy];
for (NSString *k in metadata) {
id obj = metadata[k];
@@ -85,13 +86,13 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
}
}
mutableDictionary[kHKMetadataKey] = metadata;
mutableDictionary[HKMetadataKey] = metadata;
}
if (options & ORKSampleIncludeSource) {
HKSource *source = [self source];
HKSource *source = [[self sourceRevision] source];
if (source.name) {
mutableDictionary[kHKSourceKey] = source.name;
mutableDictionary[HKSourceKey] = source.name;
}
}
@@ -115,8 +116,8 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
- (NSDictionary *)ork_JSONDictionaryWithOptions:(ORKSampleJSONOptions)options unit:(HKUnit *)unit {
NSMutableDictionary *dictionary = [self ork_JSONMutableDictionaryWithOptions:options unit:unit];
NSInteger value = [self value];
dictionary[kHKSampleValue] = @(value);
NSInteger value = self.value;
dictionary[HKSampleValue] = @(value);
return dictionary;
}
@@ -136,7 +137,7 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
HKQuantity *quantity = [self quantity];
double value = [quantity doubleValueForUnit:unit];
dictionary[kHKSampleValue] = @(value);
dictionary[HKSampleValue] = @(value);
return dictionary;
@@ -151,7 +152,7 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
NSMutableDictionary *mutableDictionary = [self ork_JSONMutableDictionaryWithOptions:options unit:nil];
// The correlated objects
NSMutableArray *correlatedObjects = [NSMutableArray arrayWithCapacity:[sampleTypes count]];
NSMutableArray *correlatedObjects = [NSMutableArray arrayWithCapacity:sampleTypes.count];
for (HKSample *sample in self.objects) {
NSUInteger idx = [sampleTypes indexOfObject:sample.sampleType];
if (idx == NSNotFound) {
@@ -160,7 +161,7 @@ static NSString *const kHKCorrelatedObjectsKey = @"objects";
[correlatedObjects addObject:[sample ork_JSONDictionaryWithOptions:options unit:units[idx]]];
}
mutableDictionary[kHKCorrelatedObjectsKey] = correlatedObjects;
mutableDictionary[HKCorrelatedObjectsKey] = correlatedObjects;
return mutableDictionary;
}
@@ -29,6 +29,7 @@
*/
@import UIKit;
#import <ResearchKit/ORKRecorder.h>
@@ -58,7 +59,7 @@ ORK_CLASS_AVAILABLE
@return An initialized accelerometer recorder.
*/
- (instancetype)initWithIdentifier:(NSString *)identifer
- (instancetype)initWithIdentifier:(NSString *)identifier
frequency:(double)frequency
step:(nullable ORKStep *)step
outputDirectory:(nullable NSURL *)outputDirectory;
@@ -30,12 +30,15 @@
#import "ORKAccelerometerRecorder.h"
#import "ORKDataLogger.h"
#import "CMAccelerometerData+ORKJSONDictionary.h"
#import <CoreMotion/CoreMotion.h>
#import "ORKRecorder_Internal.h"
#import "ORKRecorder_Private.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
#import "CMAccelerometerData+ORKJSONDictionary.h"
@import CoreMotion;
@interface ORKAccelerometerRecorder () {
@@ -70,7 +73,7 @@
}
- (void)setFrequency:(double)frequency {
if (frequency <=0) {
if (frequency <= 0) {
_frequency = 1;
} else {
_frequency = frequency;
@@ -86,40 +89,35 @@
self.motionManager = [self createMotionManager];
if (! _logger) {
NSError *err = nil;
_logger = [self makeJSONDataLoggerWithError:&err];
if (! _logger) {
[self finishRecordingWithError:err];
if (!_logger) {
NSError *error = nil;
_logger = [self makeJSONDataLoggerWithError:&error];
if (!_logger) {
[self finishRecordingWithError:error];
return;
}
}
if (! self.motionManager || ! self.motionManager.accelerometerAvailable) {
if (!self.motionManager || !self.motionManager.accelerometerAvailable) {
NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain
code:NSFeatureUnsupportedError
userInfo:@{@"recorder" : self}];
userInfo:@{@"recorder": self}];
[self finishRecordingWithError:error];
return;
}
self.motionManager.accelerometerUpdateInterval = 1.0/_frequency;
self.motionManager.accelerometerUpdateInterval = 1.0 / _frequency;
self.uptime = [NSProcessInfo processInfo].systemUptime;
[self.motionManager stopAccelerometerUpdates];
[self.motionManager
startAccelerometerUpdatesToQueue:[[NSOperationQueue alloc] init]
withHandler:^(CMAccelerometerData *data, NSError *error)
{
[self.motionManager startAccelerometerUpdatesToQueue:[[NSOperationQueue alloc] init] withHandler:^(CMAccelerometerData *data, NSError *error) {
BOOL success = NO;
if (data)
{
if (data) {
success = [_logger append:[data ork_JSONDictionary] error:&error];
}
if (!success)
{
if (!success) {
dispatch_async(dispatch_get_main_queue(), ^{
_recordingError = error;
[self stop];
@@ -129,7 +127,7 @@
}
- (NSDictionary *)userInfo {
return @{ @"frequency" : @(self.frequency) };
return @{ @"frequency": @(self.frequency) };
}
- (void)stop {
@@ -177,11 +175,6 @@
@end
@interface ORKAccelerometerRecorderConfiguration ()
@end
@implementation ORKAccelerometerRecorderConfiguration
#pragma clang diagnostic push
+24 -15
View File
@@ -29,11 +29,13 @@
*/
#import <ResearchKit/ORKDefines.h>
@import UIKit;
@import HealthKit;
#import <ResearchKit/ORKStep.h>
#import <UIKit/UIKit.h>
@class ORKRecorderConfiguration;
NS_ASSUME_NONNULL_BEGIN
/**
@@ -101,6 +103,17 @@ automatically navigates forward when the timer expires.
*/
@property (nonatomic) BOOL shouldSpeakCountDown;
/**
A Boolean value indicating whether to speak the halfway point in the count down of the
duration of a timed step.
When the value of this property is `YES`, `AVSpeechSynthesizer` is used to synthesize the countdown. Note that this property is ignored if VoiceOver is enabled.
The default value of this property is `NO`.
*/
@property (nonatomic) BOOL shouldSpeakRemainingTimeAtHalfway;
/**
A Boolean value indicating whether to start the count down timer automatically when the step starts, or
require the user to take some explicit action to start the step, such as tapping a button.
@@ -169,6 +182,14 @@ The default value of this property is `NO`.
*/
@property (nonatomic, copy, nullable) NSString *spokenInstruction;
/**
Localized text that represents an instructional voice prompt for when the step finishes.
Instructional speech begins when the step finishes. If VoiceOver is active,
the instruction is spoken by VoiceOver.
*/
@property (nonatomic, copy, nullable) NSString *finishedSpokenInstruction;
/**
An image to be displayed below the instructions for the step.
@@ -191,19 +212,7 @@ The default value of this property is `NO`.
See also: `ORKRecorderConfiguration` and `ORKRecorder`.
*/
@property (nonatomic, copy, nullable) NSArray *recorderConfigurations;
/**
The set of HealthKit types the step requests for reading. (read-only)
The task view controller uses this set of types when constructing a list of
all the HealthKit types required by all the steps in a task, so that it can
present the HealthKit access dialog just once during that task.
By default, the property scans the recorders and collates the HealthKit
types the recorders require. Subclasses may override this implementation.
*/
@property (nonatomic, readonly, nullable) NSSet *requestedHealthKitTypesForReading;
@property (nonatomic, copy, nullable) NSArray<ORKRecorderConfiguration *> *recorderConfigurations;
@end
+19 -6
View File
@@ -30,12 +30,15 @@
#import "ORKActiveStep.h"
#import "ORKHelpers.h"
#import "ORKStep_Private.h"
#import "ORKActiveStep_Internal.h"
#import "ORKActiveStepViewController.h"
#import "ORKRecorder_Private.h"
#import "ORKStep_Private.h"
#import "ORKHelpers_Internal.h"
@implementation ORKActiveStep
@@ -62,7 +65,9 @@
}
- (BOOL)hasVoice {
return (_spokenInstruction != nil && _spokenInstruction.length > 0);
BOOL hasSpokenInstruction = (_spokenInstruction != nil && _spokenInstruction.length > 0);
BOOL hasFinishedSpokenInstruction = (_finishedSpokenInstruction != nil && _finishedSpokenInstruction.length > 0);
return (hasSpokenInstruction || hasFinishedSpokenInstruction);
}
- (BOOL)isRestorable {
@@ -86,6 +91,7 @@
step.stepDuration = self.stepDuration;
step.shouldStartTimerAutomatically = self.shouldStartTimerAutomatically;
step.shouldSpeakCountDown = self.shouldSpeakCountDown;
step.shouldSpeakRemainingTimeAtHalfway = self.shouldSpeakRemainingTimeAtHalfway;
step.shouldShowDefaultTimer = self.shouldShowDefaultTimer;
step.shouldPlaySoundOnStart = self.shouldPlaySoundOnStart;
step.shouldPlaySoundOnFinish = self.shouldPlaySoundOnFinish;
@@ -94,6 +100,7 @@
step.shouldUseNextAsSkipButton = self.shouldUseNextAsSkipButton;
step.shouldContinueOnFinish = self.shouldContinueOnFinish;
step.spokenInstruction = self.spokenInstruction;
step.finishedSpokenInstruction = self.finishedSpokenInstruction;
step.recorderConfigurations = [self.recorderConfigurations copy];
step.image = self.image;
return step;
@@ -105,6 +112,7 @@
ORK_DECODE_DOUBLE(aDecoder, stepDuration);
ORK_DECODE_BOOL(aDecoder, shouldStartTimerAutomatically);
ORK_DECODE_BOOL(aDecoder, shouldSpeakCountDown);
ORK_DECODE_BOOL(aDecoder, shouldSpeakRemainingTimeAtHalfway);
ORK_DECODE_BOOL(aDecoder, shouldShowDefaultTimer);
ORK_DECODE_BOOL(aDecoder, shouldPlaySoundOnStart);
ORK_DECODE_BOOL(aDecoder, shouldPlaySoundOnFinish);
@@ -113,6 +121,7 @@
ORK_DECODE_BOOL(aDecoder, shouldUseNextAsSkipButton);
ORK_DECODE_BOOL(aDecoder, shouldContinueOnFinish);
ORK_DECODE_OBJ_CLASS(aDecoder, spokenInstruction, NSString);
ORK_DECODE_OBJ_CLASS(aDecoder, finishedSpokenInstruction, NSString);
ORK_DECODE_IMAGE(aDecoder, image);
ORK_DECODE_OBJ_ARRAY(aDecoder, recorderConfigurations, ORKRecorderConfiguration);
}
@@ -124,6 +133,7 @@
ORK_ENCODE_DOUBLE(aCoder, stepDuration);
ORK_ENCODE_BOOL(aCoder, shouldStartTimerAutomatically);
ORK_ENCODE_BOOL(aCoder, shouldSpeakCountDown);
ORK_ENCODE_BOOL(aCoder, shouldSpeakRemainingTimeAtHalfway);
ORK_ENCODE_BOOL(aCoder, shouldShowDefaultTimer);
ORK_ENCODE_BOOL(aCoder, shouldPlaySoundOnStart);
ORK_ENCODE_BOOL(aCoder, shouldPlaySoundOnFinish);
@@ -133,6 +143,7 @@
ORK_ENCODE_BOOL(aCoder, shouldContinueOnFinish);
ORK_ENCODE_IMAGE(aCoder, image);
ORK_ENCODE_OBJ(aCoder, spokenInstruction);
ORK_ENCODE_OBJ(aCoder, finishedSpokenInstruction);
ORK_ENCODE_OBJ(aCoder, recorderConfigurations);
}
@@ -142,12 +153,14 @@
__typeof(self) castObject = object;
return (isParentSame &&
ORKEqualObjects(self.spokenInstruction, castObject.spokenInstruction) &&
ORKEqualObjects(self.finishedSpokenInstruction, castObject.finishedSpokenInstruction) &&
ORKEqualObjects(self.recorderConfigurations, castObject.recorderConfigurations) &&
ORKEqualObjects(self.image, castObject.image) &&
(self.stepDuration == castObject.stepDuration) &&
(self.shouldShowDefaultTimer == castObject.shouldShowDefaultTimer) &&
(self.shouldStartTimerAutomatically == castObject.shouldStartTimerAutomatically) &&
(self.shouldSpeakCountDown == castObject.shouldSpeakCountDown) &&
(self.shouldSpeakRemainingTimeAtHalfway == castObject.shouldSpeakRemainingTimeAtHalfway) &&
(self.shouldPlaySoundOnStart == castObject.shouldPlaySoundOnStart) &&
(self.shouldPlaySoundOnFinish == castObject.shouldPlaySoundOnFinish) &&
(self.shouldVibrateOnStart == castObject.shouldVibrateOnStart) &&
@@ -156,10 +169,10 @@
(self.shouldUseNextAsSkipButton == castObject.shouldUseNextAsSkipButton));
}
- (NSSet *)requestedHealthKitTypesForReading {
NSMutableSet *set = [NSMutableSet set];
- (NSSet<HKObjectType *> *)requestedHealthKitTypesForReading {
NSMutableSet<HKObjectType *> *set = [NSMutableSet set];
for (ORKRecorderConfiguration *config in self.recorderConfigurations) {
NSSet *subset = [config requestedHealthKitTypesForReading];
NSSet<HKObjectType *> *subset = [config requestedHealthKitTypesForReading];
if (subset) {
[set unionSet:subset];
}
@@ -29,7 +29,7 @@
*/
#import <ResearchKit/ResearchKit_Private.h>
@import UIKit;
#import "ORKLabel.h"
@@ -30,10 +30,12 @@
#import "ORKActiveStepQuantityView.h"
#import "ORKHelpers.h"
#import "ORKSkin.h"
#import "ORKTintedImageView.h"
#import "ORKSubheadlineLabel.h"
#import "ORKTintedImageView.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
@implementation ORKQuantityLabel
@@ -84,15 +86,14 @@
view.isAccessibilityElement = NO;
}
[self setupConstraints];
[self setNeedsUpdateConstraints];
[self setUpConstraints];
}
return self;
}
- (void)setEnabled:(BOOL)enabled {
_enabled = enabled;
self.hidden = ! enabled;
self.hidden = !enabled;
[self setNeedsUpdateConstraints];
}
@@ -111,91 +112,89 @@
_imageView.image = image;
}
- (void)setupConstraints {
- (void)setUpConstraints {
const CGFloat TitleBaselineToValueBaseline = 40;
const CGFloat ValueBaselineToBottom = 36;
NSMutableArray *additionalConstraints = [NSMutableArray array];
NSMutableArray *constraints = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_titleLabel, _valueLabel, _imageView);
[additionalConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_titleLabel]"
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_titleLabel]"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
[additionalConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_titleLabel]|"
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_titleLabel]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
[additionalConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_imageView]-10-[_valueLabel]|"
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_imageView]-10-[_valueLabel]|"
options:NSLayoutFormatAlignAllCenterY
metrics:nil
views:views]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
attribute:NSLayoutAttributeFirstBaseline
relatedBy:NSLayoutRelationEqual
toItem:_titleLabel
attribute:NSLayoutAttributeLastBaseline
multiplier:1.0
constant:TitleBaselineToValueBaseline]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:self
[constraints addObject:[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:_valueLabel
attribute:NSLayoutAttributeLastBaseline
multiplier:1.0
constant:ValueBaselineToBottom]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:_valueHolder
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:0.0]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueLabel
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:_valueHolder
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:0.0]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:self
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:0.0]];
[additionalConstraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
[constraints addObject:[NSLayoutConstraint constraintWithItem:_valueHolder
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:0.0]];
for (NSLayoutConstraint *constraint in additionalConstraints) {
constraint.priority = UILayoutPriorityRequired-2;
for (NSLayoutConstraint *constraint in constraints) {
constraint.priority = UILayoutPriorityRequired - 2;
}
[NSLayoutConstraint activateConstraints:additionalConstraints];
[NSLayoutConstraint activateConstraints:constraints];
NSLayoutConstraint *zeroWidthConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:0.0];
zeroWidthConstraint.priority = UILayoutPriorityRequired-1;
_zeroWidthConstraint = zeroWidthConstraint;
_zeroWidthConstraint.active = !_enabled;
_zeroWidthConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:0.0];
_zeroWidthConstraint.priority = UILayoutPriorityRequired - 1;
[self setNeedsUpdateConstraints];
}
- (void)updateConstraints {
@@ -245,18 +244,18 @@
[self addSubview:_leftView];
[self addSubview:_rightView];
[self addSubview:_metricKeyline];
[self setupConstraints];
[self setUpConstraints];
}
return self;
}
- (void)setupConstraints {
- (void)setUpConstraints {
NSMutableArray *constraints = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_leftView, _rightView, _metricKeyline);
// Leave space for the keyline between these views, and then constrain it to be 1px wide and go from top to bottom baseline of metric views.
CGFloat scale = [[UIScreen mainScreen] scale];
CGFloat scale = [UIScreen mainScreen].scale;
NSArray *vertConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_leftView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
@@ -265,10 +264,10 @@
NSArray *horizConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_leftView]-s-[_rightView]-|"
options:NSLayoutFormatAlignAllTop|NSLayoutFormatAlignAllBottom|NSLayoutFormatDirectionLeftToRight
metrics:@{ @"s": @(1/scale) }
metrics:@{ @"s": @(1.0 / scale) }
views:views];
for (NSLayoutConstraint *constraint in horizConstraints) {
constraint.priority = UILayoutPriorityDefaultHigh+1;
constraint.priority = UILayoutPriorityDefaultHigh + 1;
}
[constraints addObjectsFromArray:horizConstraints];
@@ -290,7 +289,7 @@
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_leftView][_metricKeyline(==s)]"
options:NSLayoutFormatAlignAllTop|NSLayoutFormatDirectionLeftToRight
metrics:@{ @"s": @(1/scale) }
metrics:@{ @"s": @(1.0 / scale) }
views:views]];
NSLayoutConstraint *keylineBottom = [NSLayoutConstraint constraintWithItem:_metricKeyline
attribute:NSLayoutAttributeBottom
@@ -308,7 +307,7 @@
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:ORKScreenMetricMaxDimension];
maxWidthConstraint.priority = UILayoutPriorityRequired-2;
maxWidthConstraint.priority = UILayoutPriorityRequired - 2;
[constraints addObject:maxWidthConstraint];
+1 -2
View File
@@ -29,8 +29,7 @@
*/
#import <Foundation/Foundation.h>
#import <ResearchKit/ResearchKit.h>
@import Foundation;
NS_ASSUME_NONNULL_BEGIN
+9 -5
View File
@@ -30,9 +30,12 @@
#import "ORKActiveStepTimer.h"
#import "ORKHelpers_Internal.h"
@import UIKit;
#include <mach/mach.h>
#include <mach/mach_time.h>
#import <UIKit/UIKit.h>
static NSTimeInterval timeIntervalFromMachTime(uint64_t delta) {
@@ -44,6 +47,7 @@ static NSTimeInterval timeIntervalFromMachTime(uint64_t delta) {
return elapsedNano * 1.0 / NSEC_PER_SEC;
}
@implementation ORKActiveStepTimer {
uint64_t _startTime;
NSTimeInterval _preExistingRuntime;
@@ -56,7 +60,7 @@ static NSTimeInterval timeIntervalFromMachTime(uint64_t delta) {
- (instancetype)initWithDuration:(NSTimeInterval)duration interval:(NSTimeInterval)interval runtime:(NSTimeInterval)runtime handler:(ORKActiveStepTimerHandler)handler {
self = [super init];
if (self) {
if (! handler) {
if (!handler) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Handler is required" userInfo:nil];
}
@@ -197,9 +201,9 @@ static NSTimeInterval timeIntervalFromMachTime(uint64_t delta) {
assert(0);
return;
}
__weak typeof(self) weakSelf = self;
ORKWeakTypeOf(self) weakSelf = self;
dispatch_source_set_event_handler(_timer, ^{
typeof(self) strongSelf = weakSelf;
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf hiqueue_event];
});
@@ -224,7 +228,7 @@ static NSTimeInterval timeIntervalFromMachTime(uint64_t delta) {
_preExistingRuntime += timeIntervalFromMachTime(now - _startTime);
_startTime = 0;
if (! atFinish) {
if (!atFinish) {
// If we are atFinish, the task will be released after the handler completes
[self queue_releaseBackgroundTask];
}
@@ -29,18 +29,20 @@
*/
#import <UIKit/UIKit.h>
#import <ResearchKit/ResearchKit_Private.h>
@import UIKit;
#import "ORKCustomStepView_Internal.h"
#import "ORKCountdownLabel.h"
#import "ORKTextButton.h"
NS_ASSUME_NONNULL_BEGIN
@class ORKActiveStep;
@class ORKCountdownLabel;
@class ORKTextButton;
@interface ORKActiveStepTimerView : ORKActiveStepCustomView
@property (nonatomic, strong, nullable) ORKCountdownLabel *countDownLabel;
@property (nonatomic, strong, nullable) ORKTextButton *startTimerButton;
@property (nonatomic, strong, nullable) ORKActiveStep *step;
@@ -30,21 +30,30 @@
#import "ORKActiveStepTimerView.h"
#import "ORKActiveStepTimer.h"
#import "ORKHelpers.h"
#import "ORKSkin.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKVoiceEngine.h"
#import "ORKCountdownLabel.h"
#import "ORKSurveyAnswerCellForText.h"
#import "ORKSurveyAnswerCellForNumber.h"
#import "ORKActiveStep_Internal.h"
#import "ORKTextButton.h"
#import "ORKVoiceEngine.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKStepViewController_Internal.h"
#import "ORKActiveStep_Internal.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
@implementation ORKActiveStepTimerView {
BOOL _started;
BOOL _registeredForNotifications;
NSLayoutConstraint *_countDownLabelBottomToStartTimerButtonTopConstraint;
NSLayoutConstraint *_countDownLabelZeroHeightConstraint;
NSLayoutConstraint *_startTimerButtonZeroHeightConstraint;
}
- (instancetype)initWithFrame:(CGRect)frame {
@@ -70,7 +79,8 @@
_countDownLabel.accessibilityTraits |= UIAccessibilityTraitUpdatesFrequently;
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
self.translatesAutoresizingMaskIntoConstraints = NO;
[self setUpConstraints];
}
return self;
}
@@ -88,11 +98,11 @@
}
registered = _registeredForNotifications;
NSNotificationCenter *nfc = [NSNotificationCenter defaultCenter];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
if (registered) {
[nfc addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
} else {
[nfc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
}
}
@@ -144,56 +154,80 @@
- (void)finishStep:(ORKActiveStepViewController *)viewController {
}
- (void)setNeedsUpdateConstraints {
[NSLayoutConstraint deactivateConstraints:[self constraints]];
[super setNeedsUpdateConstraints];
static const CGFloat CountDownLabelToButtonMargin = 2.0;
- (void)setUpConstraints {
NSDictionary *views = NSDictionaryOfVariableBindings(_countDownLabel, _startTimerButton);
ORKEnableAutoLayoutForViews(views.allValues);
NSMutableArray *constraints = [NSMutableArray new];
for (UIView *view in views.allValues) {
[constraints addObject:[NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self
attribute:NSLayoutAttributeWidth
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:view
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
}
[constraints addObject:[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:_countDownLabel
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:0.0]];
_countDownLabelBottomToStartTimerButtonTopConstraint = [NSLayoutConstraint constraintWithItem:_startTimerButton
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:_countDownLabel
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:CountDownLabelToButtonMargin];
[constraints addObject:_countDownLabelBottomToStartTimerButtonTopConstraint];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_startTimerButton
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:0.0]];
[NSLayoutConstraint activateConstraints:constraints];
_countDownLabelZeroHeightConstraint = [NSLayoutConstraint constraintWithItem:_countDownLabel
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:0.0];
_startTimerButtonZeroHeightConstraint = [NSLayoutConstraint constraintWithItem:_startTimerButton
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:0.0];
[self setNeedsUpdateConstraints];
}
- (void)updateConstraints {
NSDictionary *dictionary = NSDictionaryOfVariableBindings(_countDownLabel, _startTimerButton);
NSDictionary *metrics = @{@"CS" : @(2)};
ORKEnableAutoLayoutForViews([dictionary allValues]);
for (UIView *view in [dictionary allValues]) {
[self addConstraint:[NSLayoutConstraint
constraintWithItem:view
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self
attribute:NSLayoutAttributeWidth
multiplier:1
constant:0]];
[self addConstraint:[NSLayoutConstraint
constraintWithItem:view
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1
constant:0]];
}
if (! _countDownLabel.hidden) {
NSMutableString *verticalLayout = [NSMutableString new];
[verticalLayout appendString:@"V:|[_countDownLabel]"];
if (! _startTimerButton.hidden) {
[verticalLayout appendString:@"-CS-[_startTimerButton]"];
}
[verticalLayout appendString:@"|"];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:verticalLayout
options:NSLayoutFormatAlignAllCenterX
metrics:metrics
views:dictionary]];
} else {
[self addConstraint:[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:0]];
}
_countDownLabelZeroHeightConstraint.active = _countDownLabel.hidden;
_startTimerButtonZeroHeightConstraint.active = (_countDownLabel.hidden || _startTimerButton.hidden);
_countDownLabelBottomToStartTimerButtonTopConstraint.constant =
(_countDownLabel.hidden || _startTimerButton.hidden) ? 0.0 : CountDownLabelToButtonMargin;
[super updateConstraints];
}
@@ -29,6 +29,7 @@
*/
@import UIKit;
#import <ResearchKit/ORKStepViewController.h>
#import <ResearchKit/ORKRecorder.h>
@@ -30,23 +30,27 @@
#import "ORKActiveStepViewController.h"
#import "ORKVoiceEngine.h"
#import "ORKSkin.h"
#import "ORKHelpers.h"
#import "ORKActiveStep.h"
#import "ORKTask.h"
#import "ORKTaskViewController.h"
#import "ORKVerticalContainerView.h"
#import "ORKStepViewController_Internal.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKActiveStep_Internal.h"
#import "ORKRecorder_Internal.h"
#import "ORKTaskViewController_Internal.h"
#import "ORKActiveStepTimerView.h"
#import "ORKActiveStepTimer.h"
#import "ORKAccessibility.h"
#import "ORKStepHeaderView_Internal.h"
#import "ORKActiveStepTimerView.h"
#import "ORKActiveStepView.h"
#import "ORKNavigationContainerView.h"
#import "ORKStepHeaderView_Internal.h"
#import "ORKVerticalContainerView.h"
#import "ORKVoiceEngine.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKStepViewController_Internal.h"
#import "ORKTaskViewController_Internal.h"
#import "ORKRecorder_Internal.h"
#import "ORKActiveStep_Internal.h"
#import "ORKResult.h"
#import "ORKTask.h"
#import "ORKAccessibility.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
@interface ORKActiveStepViewController () {
@@ -57,6 +61,7 @@
SystemSoundID _alertSound;
NSURL *_alertSoundURL;
BOOL _hasSpokenHalfwayCountdown;
}
@property (nonatomic, strong) NSArray *recorders;
@@ -92,6 +97,7 @@
}
- (ORKActiveStep *)activeStep {
NSAssert(self.step == nil || [self.step isKindOfClass:[ORKActiveStep class]], @"Step should be a subclass of an ORKActiveStep");
return (ORKActiveStep *)self.step;
}
@@ -103,7 +109,7 @@
[super viewDidLoad];
_activeStepView = [[ORKActiveStepView alloc] initWithFrame:self.view.bounds];
[_activeStepView setTranslatesAutoresizingMaskIntoConstraints:NO];
_activeStepView.translatesAutoresizingMaskIntoConstraints = NO;
[_activeStepView setCustomView:_customView];
[self updateContinueButtonItem];
_activeStepView.headerView.learnMoreButtonItem = self.learnMoreButtonItem;
@@ -111,9 +117,17 @@
_activeStepView.continueSkipContainer.continueEnabled = _finished;
[self.view addSubview:_activeStepView];
NSMutableArray *constraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[s]|" options:0 metrics:nil views:@{@"s":_activeStepView}]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[tg][s]|" options:0 metrics:nil views:@{@"s":_activeStepView,@"tg":self.topLayoutGuide}]];
[self.view addConstraints:constraints];
NSMutableArray *constraints = [NSMutableArray new];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[activeStepView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:@{@"activeStepView": _activeStepView}]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topLayoutGuide][activeStepView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:@{@"activeStepView": _activeStepView,
@"topLayoutGuide": self.topLayoutGuide}]];
[NSLayoutConstraint activateConstraints:constraints];
[self prepareStep];
}
@@ -155,7 +169,10 @@
// Wait for animation complete
dispatch_async(dispatch_get_main_queue(), ^{
if ([[self activeStep] shouldStartTimerAutomatically]) {
if(self.started){
// Should call resume instead of start when the task has been started.
[self resume];
} else if ([[self activeStep] shouldStartTimerAutomatically]) {
[self start];
}
});
@@ -194,7 +211,9 @@
- (ORKStepResult *)result {
ORKStepResult *sResult = [super result];
sResult.results = _recorderResults;
if (_recorderResults) {
sResult.results = [sResult.results arrayByAddingObjectsFromArray:_recorderResults] ? : _recorderResults;
}
return sResult;
}
@@ -313,7 +332,7 @@
- (void)suspend {
ORK_Log_Debug(@"%@",self);
if (self.finished || ! self.started) {
if (self.finished || !self.started) {
return;
}
@@ -325,7 +344,7 @@
- (void)resume {
ORK_Log_Debug(@"%@",self);
if (self.finished || ! self.started) {
if (self.finished || !self.started) {
return;
}
@@ -351,7 +370,10 @@
if (self.activeStep.shouldVibrateOnFinish) {
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
}
if (! self.activeStep.startsFinished) {
if (self.activeStep.hasVoice && self.activeStep.finishedSpokenInstruction) {
[[ORKVoiceEngine sharedVoiceEngine] speakText:self.activeStep.finishedSpokenInstruction];
}
if (!self.activeStep.startsFinished) {
if (self.activeStep.shouldContinueOnFinish) {
[self goForward];
}
@@ -379,12 +401,12 @@
NSTimeInterval stepDuration = self.activeStep.stepDuration;
if (stepDuration > 0) {
__weak typeof(self) weakSelf = self;
ORKWeakTypeOf(self) weakSelf = self;
_activeStepTimer = [[ORKActiveStepTimer alloc] initWithDuration:stepDuration
interval:_timerUpdateInterval
runtime:0
handler:^(ORKActiveStepTimer *timer, BOOL finished) {
typeof(self) strongSelf = weakSelf;
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf countDownTimerFired:timer finished:finished];
}];
[_activeStepTimer resume];
@@ -399,6 +421,7 @@
ORKActiveStepCustomView *customView = _activeStepView.activeCustomView;
[customView updateDisplay:self];
ORKVoiceEngine *voice = [ORKVoiceEngine sharedVoiceEngine];
if (!finished && self.activeStep.shouldSpeakCountDown) {
@@ -412,6 +435,13 @@
[voice speakInt:countDownValue];
}
}
BOOL isHalfway = !_hasSpokenHalfwayCountdown && timer.runtime > timer.duration / 2.0;
if (!finished && self.activeStep.shouldSpeakRemainingTimeAtHalfway && !UIAccessibilityIsVoiceOverRunning() && isHalfway) {
_hasSpokenHalfwayCountdown = YES;
NSString *text = [NSString localizedStringWithFormat:ORKLocalizedString(@"COUNTDOWN_SPOKEN_REMAINING_%@", nil), @(countDownValue)];
[voice speakText:text];
}
}
- (BOOL)timerActive {
@@ -439,7 +469,7 @@
- (void)recorder:(ORKRecorder *)recorder didFailWithError:(NSError *)error {
if (error) {
STRONGTYPE(self.delegate) strongDelegate = self.delegate;
ORKStrongTypeOf(self.delegate) strongDelegate = self.delegate;
if ([strongDelegate respondsToSelector:@selector(stepViewController:recorder:didFailWithError:)]) {
[strongDelegate stepViewController:self recorder:recorder didFailWithError:error];
}
@@ -30,11 +30,11 @@
#import "ORKActiveStepViewController.h"
#import "ORKActiveStepTimer.h"
NS_ASSUME_NONNULL_BEGIN
@class ORKActiveStepTimer;
@class ORKActiveStepView;
@interface ORKActiveStepViewController ()
@@ -29,14 +29,14 @@
*/
#import <ResearchKit/ORKActiveStep.h>
#import "ORKActiveStep.h"
NS_ASSUME_NONNULL_BEGIN
@interface ORKActiveStep ()
/**
Convenience methods.
*/
// Convenience methods.
- (BOOL)startsFinished;
- (BOOL)hasCountDown;
- (BOOL)hasTitle;
@@ -44,3 +44,5 @@
- (BOOL)hasVoice;
@end
NS_ASSUME_NONNULL_END
@@ -29,7 +29,7 @@
*/
#import <UIKit/UIKit.h>
@import UIKit;
#import "ORKCustomStepView_Internal.h"
+64 -72
View File
@@ -30,11 +30,13 @@
#import "ORKAudioContentView.h"
#import "ORKHelpers.h"
#import "ORKSkin.h"
#import "ORKLabel.h"
#import "ORKHeadlineLabel.h"
#import "ORKLabel.h"
#import "ORKAccessibility.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
// The central blue region.
@@ -56,39 +58,38 @@ static const CGFloat GraphViewRedZoneHeight = 25;
@end
static const CGFloat kValueLineWidth = 4.5;
static const CGFloat kValueLineMargin = 1.5;
static const CGFloat ValueLineWidth = 4.5;
static const CGFloat ValueLineMargin = 1.5;
@implementation ORKAudioGraphView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
NSLayoutConstraint *constraint1 = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:CGFLOAT_MAX];
constraint1.priority = UILayoutPriorityFittingSizeLevel;
NSLayoutConstraint *constraint2 = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:CGFLOAT_MAX];
constraint2.priority = UILayoutPriorityFittingSizeLevel;
[NSLayoutConstraint activateConstraints:@[constraint1, constraint2]];
[self setUpConstraints];
#if TARGET_IPHONE_SIMULATOR
_values = @[@(0.2),@(0.6),@(0.55), @(0.1), @(0.75), @(0.7)];
_values = @[ @(0.2), @(0.6), @(0.55), @(0.1), @(0.75), @(0.7) ];
#endif
}
return self;
}
- (void)setUpConstraints {
NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:CGFLOAT_MAX];
heightConstraint.priority = UILayoutPriorityFittingSizeLevel;
[NSLayoutConstraint activateConstraints:@[heightConstraint]];
}
- (void)setValues:(NSArray *)values {
_values = [values copy];
[self setNeedsDisplay];
@@ -116,41 +117,41 @@ static const CGFloat kValueLineMargin = 1.5;
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
CGContextFillRect(context, bounds);
CGFloat scale = [self.window.screen scale];
CGFloat scale = self.window.screen.scale;
CGFloat midY = CGRectGetMidY(bounds);
CGFloat maxX = CGRectGetMaxX(bounds);
CGFloat halfHeight = bounds.size.height/2;
CGFloat halfHeight = bounds.size.height / 2;
CGContextSaveGState(context);
{
UIBezierPath *centerLine = [UIBezierPath new];
[centerLine moveToPoint:(CGPoint){.x=0,.y=midY}];
[centerLine addLineToPoint:(CGPoint){.x=maxX,.y=midY}];
[centerLine moveToPoint:(CGPoint){.x = 0, .y = midY}];
[centerLine addLineToPoint:(CGPoint){.x = maxX, .y = midY}];
CGContextSetLineWidth(context, 1/scale);
CGContextSetLineWidth(context, 1.0 / scale);
[_keyColor setStroke];
CGFloat lengths[2] = {3,3};
CGFloat lengths[2] = {3, 3};
CGContextSetLineDash(context, 0, lengths, 2);
[centerLine stroke];
}
CGContextRestoreGState(context);
CGFloat lineStep = kValueLineMargin + kValueLineWidth;
CGFloat lineStep = ValueLineMargin + ValueLineWidth;
CGContextSaveGState(context);
{
CGFloat x = maxX - lineStep/2;
CGContextSetLineWidth(context, kValueLineWidth);
CGFloat x = maxX - lineStep / 2;
CGContextSetLineWidth(context, ValueLineWidth);
CGContextSetLineCap(context, kCGLineCapRound);
UIBezierPath *path1 = [UIBezierPath new];
path1.lineCapStyle = kCGLineCapRound;
path1.lineWidth = kValueLineWidth;
path1.lineWidth = ValueLineWidth;
UIBezierPath *path2 = [path1 copy];
for (NSNumber *value in [_values reverseObjectEnumerator]) {
CGFloat floatValue = [value doubleValue];
CGFloat floatValue = value.doubleValue;
UIBezierPath *path = nil;
if (floatValue > _alertThreshold) {
@@ -160,8 +161,8 @@ static const CGFloat kValueLineMargin = 1.5;
path = path2;
[_keyColor setStroke];
}
[path moveToPoint:(CGPoint){.x=x,.y=midY-floatValue*halfHeight}];
[path addLineToPoint:(CGPoint){.x=x,.y=midY+floatValue*halfHeight}];
[path moveToPoint:(CGPoint){.x = x, .y = midY - floatValue*halfHeight}];
[path addLineToPoint:(CGPoint){.x = x, .y = midY + floatValue*halfHeight}];
x -= lineStep;
@@ -194,7 +195,7 @@ static const CGFloat kValueLineMargin = 1.5;
+ (UIFont *)defaultFont {
UIFontDescriptor *descriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleSubheadline];
UIFontDescriptor *alternativeDescriptor = ORKFontDescriptorForLightStylisticAlternative(descriptor);
return [UIFont fontWithDescriptor:alternativeDescriptor size:[alternativeDescriptor pointSize]+4];
return [UIFont fontWithDescriptor:alternativeDescriptor size:[alternativeDescriptor pointSize] + 4];
}
@end
@@ -210,7 +211,6 @@ static const CGFloat kValueLineMargin = 1.5;
@implementation ORKAudioContentView {
NSArray *_constraints;
NSMutableArray *_samples;
UIColor *_keyColor;
}
@@ -238,11 +238,11 @@ static const CGFloat kValueLineMargin = 1.5;
_timerLabel.text = @"06:00";
_alertLabel.text = ORKLocalizedString(@"AUDIO_TOO_LOUD_LABEL", nil);
self.alertThreshold = GraphViewBlueZoneHeight/(GraphViewRedZoneHeight*2+GraphViewBlueZoneHeight);
self.alertThreshold = GraphViewBlueZoneHeight / ((GraphViewRedZoneHeight * 2) + GraphViewBlueZoneHeight);
[self updateGraphSamples];
[self applyKeyColor];
[self setNeedsUpdateConstraints];
[self setUpConstraints];
}
return self;
}
@@ -251,7 +251,7 @@ static const CGFloat kValueLineMargin = 1.5;
[self applyKeyColor];
}
-(void)setFailed:(BOOL)failed {
- (void)setFailed:(BOOL)failed {
_failed = failed;
_alertLabel.text = failed ? ORKLocalizedString(@"AUDIO_GENERIC_ERROR_LABEL", nil) : ORKLocalizedString(@"AUDIO_TOO_LOUD_LABEL", nil);
[self updateAlertLabelHidden];
@@ -283,27 +283,21 @@ static const CGFloat kValueLineMargin = 1.5;
_graphView.alertColor = alertColor;
}
- (void)updateConstraints {
if ([_constraints count]) {
[NSLayoutConstraint deactivateConstraints:_constraints];
_constraints = nil;
}
- (void)setUpConstraints {
NSMutableArray *constraints = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_timerLabel, _alertLabel, _graphView);
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_graphView]-[_alertLabel]|"
options:0
metrics:nil
views:views]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_graphView]-[_alertLabel]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_alertLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1
constant:0]];
multiplier:1.0
constant:0.0]];
const CGFloat sideMargin = self.layoutMargins.left + (2 * ORKStandardLeftMarginForTableViewCell(self));
const CGFloat innerMargin = 2;
@@ -314,18 +308,15 @@ static const CGFloat kValueLineMargin = 1.5;
metrics:@{@"sideMargin": @(sideMargin), @"innerMargin": @(innerMargin)}
views:views]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_graphView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:(GraphViewBlueZoneHeight+GraphViewRedZoneHeight*2)]];
multiplier:1.0
constant:(GraphViewBlueZoneHeight + GraphViewRedZoneHeight * 2)]];
_constraints = constraints;
[NSLayoutConstraint activateConstraints:constraints];
[super updateConstraints];
}
- (void)setAlertThreshold:(CGFloat)alertThreshold {
@@ -340,17 +331,16 @@ static const CGFloat kValueLineMargin = 1.5;
}
- (void)updateTimerLabel {
static NSDateComponentsFormatter *_formatter = nil;
static NSDateComponentsFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSDateComponentsFormatter *formatter = [NSDateComponentsFormatter new];
formatter.unitsStyle = NSDateComponentsFormatterUnitsStylePositional;
formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorPad;
formatter.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitSecond;
_formatter = formatter;
});
NSString *string = [_formatter stringFromTimeInterval:MAX(round(_timeLeft),0)];
NSString *string = [formatter stringFromTimeInterval:MAX(round(_timeLeft),0)];
_timerLabel.text = string;
_timerLabel.hidden = (string == nil);
}
@@ -361,8 +351,12 @@ static const CGFloat kValueLineMargin = 1.5;
}
- (void)updateAlertLabelHidden {
NSNumber *sample = [_samples lastObject];
BOOL show = (! _finished && ([sample doubleValue] > _alertThreshold)) || _failed;
NSNumber *sample = _samples.lastObject;
BOOL show = (!_finished && (sample.doubleValue > _alertThreshold)) || _failed;
if (_alertLabel.hidden && show) {
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, _alertLabel.text);
}
_alertLabel.hidden = !show;
}
@@ -373,13 +367,13 @@ static const CGFloat kValueLineMargin = 1.5;
- (void)addSample:(NSNumber *)sample {
NSAssert(sample != nil, @"Sample should be non-nil");
if (! _samples) {
if (!_samples) {
_samples = [NSMutableArray array];
}
[_samples addObject:sample];
// Try to keep around 250 samples
if ([_samples count] > 500) {
_samples = [[_samples subarrayWithRange:(NSRange){250,_samples.count-250}] mutableCopy];
if (_samples.count > 500) {
_samples = [[_samples subarrayWithRange:(NSRange){250, _samples.count - 250}] mutableCopy];
}
[self updateGraphSamples];
}
@@ -396,11 +390,9 @@ static const CGFloat kValueLineMargin = 1.5;
}
- (NSString *)accessibilityLabel {
if (_alertLabel.isHidden) {
return _timerLabel.accessibilityLabel;
}
return ORKAccessibilityStringForVariables(_timerLabel.accessibilityLabel, _alertLabel.accessibilityLabel);
NSString *timerAxString = _timerLabel.isHidden ? nil : _timerLabel.accessibilityLabel;
NSString *alertAxString = _alertLabel.isHidden ? nil : _alertLabel.accessibilityLabel;
return ORKAccessibilityStringForVariables(ORKLocalizedString(@"AX_AUDIO_BAR_GRAPH", nil), timerAxString, alertAxString);
}
- (UIAccessibilityTraits)accessibilityTraits {
+5 -2
View File
@@ -49,8 +49,11 @@
3. This notice may not be removed or altered from any source distribution.
*/
#import <ResearchKit/ORKRecorder.h>
#import <AVFoundation/AVFoundation.h>
@import UIKit;
@import AVFoundation;
#import "ORKTypes.h"
NS_ASSUME_NONNULL_BEGIN
+20 -21
View File
@@ -49,15 +49,15 @@
3. This notice may not be removed or altered from any source distribution.
*/
#import "ORKAudioGenerator.h"
@import AudioToolbox;
@interface ORKAudioGenerator () {
@public
AudioComponentInstance _toneUnit;
@public
@interface ORKAudioGenerator () {
@public
AudioComponentInstance _toneUnit;
double _frequency;
double _theta;
ORKAudioChannel _activeChannel;
@@ -103,8 +103,7 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
bufferActive[frame] = bufferValue;
if (audioGenerator->_playsStereo) {
bufferNonActive[frame] = bufferValue;
}
else {
} else {
bufferNonActive[frame] = 0;
}
@@ -113,7 +112,7 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
theta -= 2.0 * M_PI;
}
fadeInFactor += 1/(ORKSineWaveToneGeneratorSampleRateDefault * audioGenerator->_fadeInDuration);
fadeInFactor += 1.0 / (ORKSineWaveToneGeneratorSampleRateDefault * audioGenerator->_fadeInDuration);
if (fadeInFactor >= 1) {
fadeInFactor = 1;
}
@@ -149,15 +148,15 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
- (void)applicationDidBecomeActive:(NSNotification *)notification {
if (_toneUnit) {
OSErr err = AudioOutputUnitStart(_toneUnit);
NSAssert1(err == noErr, @"Error starting unit: %hd", err);
__unused OSErr error = AudioOutputUnitStart(_toneUnit);
NSAssert1(error == noErr, @"Error starting unit: %hd", error);
}
}
- (void)applicationWillResignActive:(NSNotification *)notification {
if (_toneUnit) {
OSErr err = AudioOutputUnitStop(_toneUnit);
NSAssert1(err == noErr, @"Error stopping unit: %hd", err);
__unused OSErr error = AudioOutputUnitStop(_toneUnit);
NSAssert1(error == noErr, @"Error stopping unit: %hd", error);
}
}
@@ -195,12 +194,12 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
[self createToneUnit];
// Stop changing parameters on the unit
OSErr err = AudioUnitInitialize(_toneUnit);
NSAssert1(err == noErr, @"Error initializing unit: %hd", err);
OSErr error = AudioUnitInitialize(_toneUnit);
NSAssert1(error == noErr, @"Error initializing unit: %hd", error);
// Start playback
err = AudioOutputUnitStart(_toneUnit);
NSAssert1(err == noErr, @"Error starting unit: %hd", err);
error = AudioOutputUnitStart(_toneUnit);
NSAssert1(error == noErr, @"Error starting unit: %hd", error);
}
}
@@ -241,20 +240,20 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
NSAssert(defaultOutput, @"Can't find default output");
// Create a new unit based on this that we'll use for output
OSErr err = AudioComponentInstanceNew(defaultOutput, &_toneUnit);
NSAssert1(_toneUnit, @"Error creating unit: %hd", err);
OSErr error = AudioComponentInstanceNew(defaultOutput, &_toneUnit);
NSAssert1(_toneUnit, @"Error creating unit: %hd", error);
// Set our tone rendering function on the unit
AURenderCallbackStruct input;
input.inputProc = ORKAudioGeneratorRenderTone;
input.inputProcRefCon = (__bridge void *)(self);
err = AudioUnitSetProperty(_toneUnit,
error = AudioUnitSetProperty(_toneUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&input,
sizeof(input));
NSAssert1(err == noErr, @"Error setting callback: %hd", err);
NSAssert1(error == noErr, @"Error setting callback: %hd", error);
// Set the format to 32 bit, single channel, floating point, linear PCM
const int four_bytes_per_float = 4;
@@ -268,13 +267,13 @@ OSStatus ORKAudioGeneratorRenderTone(void *inRefCon,
streamFormat.mBytesPerFrame = four_bytes_per_float;
streamFormat.mChannelsPerFrame = 2;
streamFormat.mBitsPerChannel = four_bytes_per_float * eight_bits_per_byte;
err = AudioUnitSetProperty (_toneUnit,
error = AudioUnitSetProperty (_toneUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&streamFormat,
sizeof(AudioStreamBasicDescription));
NSAssert1(err == noErr, @"Error setting stream format: %hd", err);
NSAssert1(error == noErr, @"Error setting stream format: %hd", error);
}
- (void)handleInterruption:(id)sender {
@@ -0,0 +1,77 @@
/*
Copyright (c) 2016, Sage Bionetworks
Copyright (c) 2016, Apple Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <ResearchKit/ORKStepNavigationRule.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKAudioLevelNavigationRule : ORKStepNavigationRule
/*
The `init` and `new` methods are unavailable.
`ORKStepNavigationRule` classes should be initialized with custom designated initializers on each
subclass.
*/
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/**
Returns an initialized direct-step navigation rule using the specified destination step identifier.
@param audioLevelStepIdentifier The identifier of the step with the audio file to check.
@param destinationStepIdentifier The identifier of the destination step if audio test passes.
@param recordingSettings Use key AVNumberOfChannelsKey to sepcify the number of recording channels.
@return A audio level step navigation rule.
*/
- (instancetype)initWithAudioLevelStepIdentifier:(NSString *)audioLevelStepIdentifier
destinationStepIdentifier:(NSString *)destinationStepIdentifier
recordingSettings:(NSDictionary *)recordingSettings NS_DESIGNATED_INITIALIZER;
/**
Returns a new direct-step navigation rule initialized from data in a given unarchiver.
@param aDecoder The coder from which to initialize the step navigation rule.
@return A new direct-step navigation rule.
*/
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
@property (nonatomic, copy, readonly) NSString *audioLevelStepIdentifier;
@property (nonatomic, copy, readonly) NSString *destinationStepIdentifier;
@property (nonatomic, copy, readonly) NSDictionary *recordingSettings;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,217 @@
/*
Copyright (c) 2016, Sage Bionetworks
Copyright (c) 2016, Apple Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKAudioLevelNavigationRule.h"
#import "ORKResult.h"
#import "ORKResultPredicate.h"
#import "ORKStepNavigationRule_Internal.h"
#import "ORKHelpers_Internal.h"
#import <AVFoundation/AVFoundation.h>
Float32 const VolumeThreshold = 0.45;
UInt16 const LinearPCMBitDepth = 16;
Float32 const MaxAmplitude = 32767.0;
Float32 const VolumeClamp = 60.0;
@interface ORKAudioLevelNavigationRule ()
@property (nonatomic, copy, readwrite) NSString *audioLevelStepIdentifier;
@property (nonatomic, copy, readwrite) NSString *destinationStepIdentifier;
@property (nonatomic, copy, readwrite) NSDictionary *recordingSettings;
@end
@implementation ORKAudioLevelNavigationRule
+ (instancetype)new {
ORKThrowMethodUnavailableException();
}
- (instancetype)init {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithAudioLevelStepIdentifier:(NSString *)audioLevelStepIdentifier
destinationStepIdentifier:(NSString *)destinationStepIdentifier
recordingSettings:(NSDictionary *)recordingSettings
{
ORKThrowInvalidArgumentExceptionIfNil(audioLevelStepIdentifier);
ORKThrowInvalidArgumentExceptionIfNil(destinationStepIdentifier);
ORKThrowInvalidArgumentExceptionIfNil(recordingSettings);
self = [super init];
if (self) {
_audioLevelStepIdentifier = [audioLevelStepIdentifier copy];
_destinationStepIdentifier = [destinationStepIdentifier copy];
_recordingSettings = [recordingSettings copy];
}
return self;
}
#pragma mark NSSecureCoding
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_OBJ_CLASS(aDecoder, audioLevelStepIdentifier, NSString);
ORK_DECODE_OBJ_CLASS(aDecoder, destinationStepIdentifier, NSString);
ORK_DECODE_OBJ_CLASS(aDecoder, recordingSettings, NSDictionary);
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
ORK_ENCODE_OBJ(aCoder, audioLevelStepIdentifier);
ORK_ENCODE_OBJ(aCoder, destinationStepIdentifier);
ORK_ENCODE_OBJ(aCoder, recordingSettings);
}
#pragma mark NSCopying
- (instancetype)copyWithZone:(NSZone *)zone {
typeof(self) rule = [[[self class] allocWithZone:zone] initWithAudioLevelStepIdentifier:self.audioLevelStepIdentifier destinationStepIdentifier:self.destinationStepIdentifier recordingSettings:self.recordingSettings];
return rule;
}
- (BOOL)isEqual:(id)object {
BOOL isParentSame = [super isEqual:object];
__typeof(self) castObject = object;
return (isParentSame
&& ORKEqualObjects(self.audioLevelStepIdentifier, castObject.audioLevelStepIdentifier)
&& ORKEqualObjects(self.destinationStepIdentifier, castObject.destinationStepIdentifier)
&& ORKEqualObjects(self.recordingSettings, castObject.recordingSettings));
}
- (NSUInteger)hash {
return _audioLevelStepIdentifier.hash ^ _destinationStepIdentifier.hash ^ _recordingSettings.hash;
}
#pragma mark - Required overrides
- (NSString *)identifierForDestinationStepWithTaskResult:(ORKTaskResult *)taskResult {
// Get the result file
ORKStepResult *stepResult = (ORKStepResult *)[taskResult resultForIdentifier:self.audioLevelStepIdentifier];
ORKFileResult *audioLevelResult = (ORKFileResult *)[stepResult.results firstObject];
// Check the volume
if ((audioLevelResult.fileURL != nil) && [self checkAudioLevelFromSoundFile:audioLevelResult.fileURL]) {
// Returning nil will drop through to the next step (which should be the the step that has the instructions
// for moving to a quieter room).
return nil;
}
return self.destinationStepIdentifier;
}
- (BOOL)checkAudioLevelFromSoundFile:(NSURL *)fileURL {
// Setup reader
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:fileURL options:nil];
if (urlAsset.tracks.count == 0) {
NSLog(@"No tracks found for urlAsset: %@", fileURL);
return NO;
}
NSError *error = nil;
AVAssetReader *reader = [[AVAssetReader alloc] initWithAsset:urlAsset error:&error];
AVAssetTrack *track = [urlAsset.tracks objectAtIndex:0];
NSDictionary *outputSettings = @{AVFormatIDKey: @(kAudioFormatLinearPCM),
AVLinearPCMBitDepthKey: @(LinearPCMBitDepth),
AVLinearPCMIsBigEndianKey: @(NO),
AVLinearPCMIsFloatKey: @(NO),
AVLinearPCMIsNonInterleaved: @(NO)};
AVAssetReaderTrackOutput *output = [[AVAssetReaderTrackOutput alloc] initWithTrack:track outputSettings:outputSettings];
[reader addOutput:output];
// Setup initial values - Assume 2 channels if not in recording settings
const UInt32 channelCount = (UInt32)[self.recordingSettings[AVNumberOfChannelsKey] unsignedIntegerValue] ? : 2;
const UInt32 bytesPerSample = 2 * channelCount;
// setup criteria block - Use a high-pass filter and a rolling average of the amplitude
// normalized to be < 1
__block Float32 rollingAvg = 0;
__block UInt64 totalCount = 0;
void (^processVolume)(Float32) = ^(Float32 amplitude) {
if (amplitude != 0) {
Float32 dB = 20 * log10(ABS(amplitude) / MaxAmplitude);
float clampedValue = MAX(dB / VolumeClamp, -1) + 1;
totalCount++;
rollingAvg = (rollingAvg * (totalCount - 1) + clampedValue) / totalCount;
}
};
// While there are samples to read and the number of samples above the decibel threshold
// is less than the total number of allowed samples over the limit, keep going
[reader startReading];
while (reader.status == AVAssetReaderStatusReading) {
AVAssetReaderTrackOutput *trackOutput = (AVAssetReaderTrackOutput *)[reader.outputs objectAtIndex:0];
CMSampleBufferRef sampleBufferRef = [trackOutput copyNextSampleBuffer];
if (sampleBufferRef) {
CMBlockBufferRef blockBufferRef = CMSampleBufferGetDataBuffer(sampleBufferRef);
size_t length = CMBlockBufferGetDataLength(blockBufferRef);
NSMutableData *data = [NSMutableData dataWithLength:length];
CMBlockBufferCopyDataBytes(blockBufferRef, 0, length, data.mutableBytes);
SInt16 *samples = (SInt16 *) data.mutableBytes;
UInt64 sampleCount = length / bytesPerSample;
for (UInt32 i = 0; i < sampleCount ; i++) {
Float32 left = (Float32) *samples++;
processVolume(left);
if (channelCount == 2) {
Float32 right = (Float32) *samples++;
processVolume(right);
}
}
CMSampleBufferInvalidate(sampleBufferRef);
CFRelease(sampleBufferRef);
}
}
return rollingAvg > VolumeThreshold;
}
@end
+2 -1
View File
@@ -29,8 +29,9 @@
*/
@import UIKit;
@import AVFoundation;
#import <ResearchKit/ORKRecorder.h>
#import <AVFoundation/AVFoundation.h>
NS_ASSUME_NONNULL_BEGIN
+37 -28
View File
@@ -30,10 +30,10 @@
#import "ORKAudioRecorder.h"
#import "ORKHelpers.h"
#import "ORKRecorder_Internal.h"
#import "ORKRecorder_Private.h"
#import "ORKDefines_Private.h"
#import "ORKHelpers_Internal.h"
@interface ORKAudioRecorder ()
@@ -42,6 +42,8 @@
@property (nonatomic, copy) NSDictionary *recorderSettings;
@property (nonatomic, copy) NSString *savedSessionCategory;
@end
@@ -68,10 +70,10 @@
if (self) {
self.continuesInBackground = YES;
if (! recorderSettings) {
if (!recorderSettings) {
recorderSettings = [[self class] defaultRecorderSettings];
}
if (! [recorderSettings isKindOfClass:[NSDictionary class]]) {
if (![recorderSettings isKindOfClass:[NSDictionary class]]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"recorderSettings should be a dictionary" userInfo:recorderSettings];
}
self.recorderSettings = recorderSettings;
@@ -79,23 +81,34 @@
return self;
}
- (void)restoreSavedAudioSessionCategory {
if (_savedSessionCategory) {
NSError *error;
if (![[AVAudioSession sharedInstance] setCategory:_savedSessionCategory error:&error]) {
ORK_Log_Error(@"Failed to restore the audio session category: %@", [error localizedDescription]);
}
_savedSessionCategory = nil;
}
}
- (void)start {
if (self.outputDirectory == nil) {
@throw [NSException exceptionWithName:NSDestinationInvalidException reason:@"audioRecorder requires an output directory" userInfo:nil];
}
// Only create the file when we should actually start recording.
if (! _audioRecorder) {
if (!_audioRecorder) {
NSError *error = nil;
NSURL *soundFileURL = [self recordingFileURL];
if (! [self recreateFileWithError:&error]) {
if (![self recreateFileWithError:&error]) {
[self finishRecordingWithError:error];
return;
}
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
if (! [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]) {
_savedSessionCategory = audioSession.category;
if (![audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error]) {
[self finishRecordingWithError:error];
return;
}
@@ -105,19 +118,19 @@
initWithURL:soundFileURL
settings:self.recorderSettings
error:&error];
if (! _audioRecorder) {
if (!_audioRecorder) {
[self finishRecordingWithError:error];
return;
}
#if ! TARGET_IPHONE_SIMULATOR
#if !TARGET_IPHONE_SIMULATOR
if (!_audioRecorder.recording) {
[_audioRecorder prepareToRecord];
}
#endif
}
#if ! TARGET_IPHONE_SIMULATOR
#if !TARGET_IPHONE_SIMULATOR
if (!_audioRecorder.recording) {
[_audioRecorder prepareToRecord];
[_audioRecorder record];
@@ -128,7 +141,7 @@
}
- (void)stop {
if (! _audioRecorder) {
if (!_audioRecorder) {
// Error has already been returned.
return;
}
@@ -136,7 +149,7 @@
[self doStopRecording];
NSURL *fileUrl = [self recordingFileURL];
if (! [[NSFileManager defaultManager] fileExistsAtPath:[[self recordingFileURL] path]]) {
if (![[NSFileManager defaultManager] fileExistsAtPath:[[self recordingFileURL] path]]) {
fileUrl = nil;
}
@@ -151,12 +164,12 @@
- (NSString *)mimeType {
NSDictionary *recorderSettings = [self recorderSettings];
unsigned int recorderFormat = [recorderSettings[AVFormatIDKey] unsignedIntValue];
unsigned int recorderFormat = ((NSNumber *)recorderSettings[AVFormatIDKey]).unsignedIntValue;
NSString *contentType = @"audio";
switch (recorderFormat) {
case kAudioFormatLinearPCM: {
int numBits = [recorderSettings[AVLinearPCMBitDepthKey] intValue] ? : 16;
int numBits = ((NSNumber *)recorderSettings[AVLinearPCMBitDepthKey]).intValue ? : 16;
contentType = [NSString stringWithFormat:@"audio/L%d", numBits];
break;
}
@@ -191,18 +204,19 @@
[self applyFileProtection:ORKFileProtectionComplete toFileAtURL:[self recordingFileURL]];
#endif
[self restoreSavedAudioSessionCategory];
}
}
- (void)finishRecordingWithError:(NSError *)error {
[self doStopRecording];
[super finishRecordingWithError:error];
}
- (NSString *)extension {
NSDictionary *recorderSettings = [self recorderSettings];
unsigned int recorderFormat = [recorderSettings[AVFormatIDKey] unsignedIntValue];
unsigned int recorderFormat = ((NSNumber *)recorderSettings[AVFormatIDKey]).unsignedIntValue;
NSString *extension = @"au";
switch (recorderFormat) {
@@ -231,9 +245,9 @@
return [[self recordingDirectoryURL] URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [self logName], [self extension]]];
}
- (BOOL)recreateFileWithError:(NSError * __autoreleasing *)error {
- (BOOL)recreateFileWithError:(NSError **)error {
NSURL *url = [self recordingFileURL];
if (! url) {
if (!url) {
if (error) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteInvalidFileNameError userInfo:@{NSLocalizedDescriptionKey:ORKLocalizedString(@"ERROR_RECORDER_NO_OUTPUT_DIRECTORY", nil)}];
}
@@ -242,18 +256,18 @@
NSFileManager *fileManager = [NSFileManager defaultManager];
if (! [fileManager createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:error]) {
if (![fileManager createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:error]) {
return NO;
}
if ([fileManager fileExistsAtPath:[url path]]) {
if (! [fileManager removeItemAtPath:[url path] error:error]) {
if (![fileManager removeItemAtPath:[url path] error:error]) {
return NO;
}
}
[fileManager createFileAtPath:[url path] contents:nil attributes:nil];
[fileManager setAttributes:@{NSFileProtectionKey : ORKFileProtectionFromMode(ORKFileProtectionCompleteUnlessOpen)} ofItemAtPath:[url path] error:error];
[fileManager setAttributes:@{NSFileProtectionKey: ORKFileProtectionFromMode(ORKFileProtectionCompleteUnlessOpen)} ofItemAtPath:[url path] error:error];
return YES;
}
@@ -266,11 +280,6 @@
@end
@interface ORKAudioRecorderConfiguration ()
@end
@implementation ORKAudioRecorderConfiguration
#pragma clang diagnostic push
@@ -283,7 +292,7 @@
recorderSettings:(NSDictionary *)recorderSettings {
self = [super initWithIdentifier:identifier];
if (self) {
if (recorderSettings && ! [recorderSettings isKindOfClass:[NSDictionary class]]) {
if (recorderSettings && ![recorderSettings isKindOfClass:[NSDictionary class]]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"recorderSettings should be a dictionary" userInfo:recorderSettings];
}
_recorderSettings = recorderSettings;
+1
View File
@@ -29,6 +29,7 @@
*/
@import Foundation;
#import <ResearchKit/ORKActiveStep.h>
+6 -2
View File
@@ -30,10 +30,13 @@
#import "ORKAudioStep.h"
#import "ORKAudioStepViewController.h"
#import "ORKHelpers.h"
#import "ORKStep_Private.h"
#import "ORKHelpers_Internal.h"
@implementation ORKAudioStep
@@ -45,6 +48,7 @@
self = [super initWithIdentifier:identifier];
if (self) {
self.shouldShowDefaultTimer = NO;
self.shouldStartTimerAutomatically = YES;
}
return self;
}
@@ -55,7 +59,7 @@
NSTimeInterval const ORKAudioTaskMinimumDuration = 5.0;
if ( self.stepDuration < ORKAudioTaskMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration can not be shorter than %@ seconds.", @(ORKAudioTaskMinimumDuration)] userInfo:nil];
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration cannot be shorter than %@ seconds.", @(ORKAudioTaskMinimumDuration)] userInfo:nil];
}
}
@@ -29,7 +29,9 @@
*/
#import <ResearchKit/ResearchKit_Private.h>
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
@@ -37,6 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKAudioStepViewController : ORKActiveStepViewController
@property (nonatomic, assign) CGFloat alertThreshold;
@end
NS_ASSUME_NONNULL_END
@@ -30,17 +30,22 @@
#import "ORKAudioStepViewController.h"
#import "ORKAudioContentView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKVerticalContainerView.h"
#import <AVFoundation/AVFoundation.h>
#import "ORKActiveStepTimer.h"
#import "ORKHelpers.h"
#import "ORKStep_Private.h"
#import "ORKAudioStep.h"
#import "ORKAudioRecorder.h"
#import "ORKActiveStepView.h"
#import "ORKAudioContentView.h"
#import "ORKCustomStepView_Internal.h"
#import "ORKVerticalContainerView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKAudioRecorder.h"
#import "ORKAudioStep.h"
#import "ORKStep_Private.h"
#import "ORKHelpers_Internal.h"
@import AVFoundation;
@interface ORKAudioStepViewController ()
@@ -66,17 +71,24 @@
return self;
}
- (void)setAlertThreshold:(CGFloat)alertThreshold {
_alertThreshold = alertThreshold;
if (self.isViewLoaded && alertThreshold > 0) {
_audioContentView.alertThreshold = alertThreshold;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
_audioContentView = [ORKAudioContentView new];
_audioContentView.timeLeft = self.audioStep.stepDuration;
self.activeStepView.activeCustomView = _audioContentView;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self start];
if (self.alertThreshold > 0) {
_audioContentView.alertThreshold = self.alertThreshold;
}
self.activeStepView.activeCustomView = _audioContentView;
}
- (void)audioRecorderDidChange {
@@ -107,17 +119,17 @@
[_avAudioRecorder updateMeters];
float value = [_avAudioRecorder averagePowerForChannel:0];
// Assume value is in range roughly -60dB to 0dB
float clampedValue = MAX(value/60.0, -1) + 1;
float clampedValue = MAX(value / 60.0, -1) + 1;
[_audioContentView addSample:@(clampedValue)];
_audioContentView.timeLeft = [_timer duration] - [_timer runtime];
}
- (void)startNewTimerIfNeeded {
if (! _timer) {
if (!_timer) {
NSTimeInterval duration = self.audioStep.stepDuration;
__weak typeof(self) weakSelf = self;
_timer = [[ORKActiveStepTimer alloc] initWithDuration:duration interval:duration/100 runtime:0 handler:^(ORKActiveStepTimer *timer, BOOL finished) {
typeof(self) strongSelf = weakSelf;
ORKWeakTypeOf(self) weakSelf = self;
_timer = [[ORKActiveStepTimer alloc] initWithDuration:duration interval:duration / 100 runtime:0 handler:^(ORKActiveStepTimer *timer, BOOL finished) {
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf doSample];
if (finished) {
[strongSelf finish];
@@ -170,7 +182,7 @@
_avAudioRecorder = recorder;
}
- (void) recorder:(ORKRecorder *)recorder didFailWithError:(NSError *)error {
- (void)recorder:(ORKRecorder *)recorder didFailWithError:(NSError *)error {
[super recorder:recorder didFailWithError:error];
_audioRecorderError = error;
_audioContentView.failed = YES;
+6 -1
View File
@@ -29,10 +29,13 @@
*/
#import <ResearchKit/ResearchKit.h>
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
NS_ASSUME_NONNULL_BEGIN
/**
The `ORKCountdownStep` class represents a step that displays a label and a
countdown for a time equal to its duration.
@@ -46,3 +49,5 @@ ORK_CLASS_AVAILABLE
@interface ORKCountdownStep : ORKActiveStep
@end
NS_ASSUME_NONNULL_END
+2 -1
View File
@@ -30,6 +30,7 @@
#import "ORKCountdownStep.h"
#import "ORKCountdownStepViewController.h"
@@ -57,7 +58,7 @@
NSTimeInterval const ORKCountdownStepMinimumDuration = 3.0;
if ( self.stepDuration < ORKCountdownStepMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration can not be shorter than %@ seconds.", @(ORKCountdownStepMinimumDuration)] userInfo:nil];
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration cannot be shorter than %@ seconds.", @(ORKCountdownStepMinimumDuration)] userInfo:nil];
}
}
@@ -29,9 +29,13 @@
*/
#import <ResearchKit/ResearchKit_Private.h>
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
/**
The `ORKCountdownStepViewController` class represents the step view controller that corresponds to an `ORKCountdownStep`.
@@ -43,3 +47,5 @@ ORK_CLASS_AVAILABLE
@interface ORKCountdownStepViewController : ORKActiveStepViewController
@end
NS_ASSUME_NONNULL_END
@@ -30,23 +30,29 @@
#import "ORKCountdownStepViewController.h"
#import "ORKCustomStepView_Internal.h"
#import "ORKActiveStepViewController_internal.h"
#import "ORKVerticalContainerView.h"
#import "ORKStepViewController_Internal.h"
#import "ORKActiveStepTimer.h"
#import "ORKResult.h"
#import "ORKActiveStepView.h"
#import "ORKCustomStepView_Internal.h"
#import "ORKLabel.h"
#import "ORKSubheadlineLabel.h"
#import "ORKHelpers.h"
#import "ORKVerticalContainerView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKStepViewController_Internal.h"
#import "ORKActiveStep.h"
#import "ORKResult.h"
#import "ORKAccessibility.h"
#import "ORKActiveStepView.h"
#import "ORKHelpers_Internal.h"
@interface ORKCountDownViewLabel : ORKLabel
@end
@implementation ORKCountDownViewLabel
+ (UIFont *)defaultFont {
return ORKThinFontWithSize(56);
@@ -69,6 +75,9 @@
CAShapeLayer *_circleLayer;
}
static const CGFloat ProgressIndicatorDiameter = 104.0;
static const CGFloat ProgressIndicatorOuterMargin = 1.0;
- (instancetype)init {
self = [super init];
if (self) {
@@ -88,55 +97,11 @@
[self addSubview:_progressView];
self.translatesAutoresizingMaskIntoConstraints = NO;
static const CGFloat ProgressIndicatorDiameter = 104;
static const CGFloat ProgressIndicatorOuterMargin = 1;
NSDictionary *metrics = @{@"d":@(ProgressIndicatorDiameter+2*ProgressIndicatorOuterMargin)};
NSDictionary *views = NSDictionaryOfVariableBindings(_textLabel, _timeLabel, _progressView);
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_textLabel]-(>=0)-[_progressView(==d)]|"
options:NSLayoutFormatDirectionLeadingToTrailing|NSLayoutFormatAlignAllCenterX
metrics:metrics
views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(>=0)-[_textLabel]-(>=0)-|"
options:NSLayoutFormatDirectionLeadingToTrailing
metrics:metrics
views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(>=0)-[_progressView(==d)]-(>=0)-|"
options:NSLayoutFormatDirectionLeadingToTrailing
metrics:metrics
views:views]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:_progressView
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0 constant:0]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:_timeLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:_progressView
attribute:NSLayoutAttributeCenterX
multiplier:1.0 constant:0]];
// Constant required in order to give appearance of vertical centering (compensating for leading on font)
[self addConstraint:[NSLayoutConstraint constraintWithItem:_timeLabel
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:_progressView
attribute:NSLayoutAttributeCenterY
multiplier:1.0 constant:-3]];
[self addConstraint:[NSLayoutConstraint constraintWithItem:_progressView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:_textLabel
attribute:NSLayoutAttributeLastBaseline
multiplier:1 constant:16-ProgressIndicatorOuterMargin]];
[self setUpConstraints];
_circleLayer = [CAShapeLayer layer];
static const CGFloat ProgressIndicatorRadius = ProgressIndicatorDiameter/2;
_circleLayer.path = [[UIBezierPath bezierPathWithArcCenter:CGPointMake(ProgressIndicatorRadius+ProgressIndicatorOuterMargin, ProgressIndicatorRadius+ProgressIndicatorOuterMargin)
static const CGFloat ProgressIndicatorRadius = ProgressIndicatorDiameter / 2;
_circleLayer.path = [[UIBezierPath bezierPathWithArcCenter:CGPointMake(ProgressIndicatorRadius + ProgressIndicatorOuterMargin, ProgressIndicatorRadius + ProgressIndicatorOuterMargin)
radius:ProgressIndicatorRadius
startAngle:M_PI + M_PI_2
endAngle:-M_PI_2
@@ -154,16 +119,68 @@
return self;
}
- (void)setUpConstraints {
NSMutableArray *constraints = [NSMutableArray new];
NSDictionary *metrics = @{@"d": @(ProgressIndicatorDiameter + 2 * ProgressIndicatorOuterMargin)};
NSDictionary *views = NSDictionaryOfVariableBindings(_textLabel, _timeLabel, _progressView);
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_textLabel]-(>=0)-[_progressView(==d)]|"
options:NSLayoutFormatDirectionLeadingToTrailing | NSLayoutFormatAlignAllCenterX
metrics:metrics
views:views]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(>=0)-[_textLabel]-(>=0)-|"
options:NSLayoutFormatDirectionLeadingToTrailing
metrics:metrics
views:views]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(>=0)-[_progressView(==d)]-(>=0)-|"
options:NSLayoutFormatDirectionLeadingToTrailing
metrics:metrics
views:views]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_progressView
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_timeLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:_progressView
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
// Constant required in order to give appearance of vertical centering (compensating for leading on font)
[constraints addObject:[NSLayoutConstraint constraintWithItem:_timeLabel
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:_progressView
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:-3.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_progressView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:_textLabel
attribute:NSLayoutAttributeLastBaseline
multiplier:1.0
constant:16.0 - ProgressIndicatorOuterMargin]];
[NSLayoutConstraint activateConstraints:constraints];
}
- (void)tintColorDidChange {
_circleLayer.strokeColor = self.tintColor.CGColor;
}
- (void)startAnimateWithDuration:(NSTimeInterval)duration {
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"];
animation.duration = duration*2;
animation.duration = duration * 2;
animation.removedOnCompletion = YES;
animation.values = @[@(1.0), @(0.0), @(0.0)];
animation.keyTimes = @[@(0.0), @(0.5), @(1.0)];
animation.values = @[ @(1.0), @(0.0), @(0.0) ];
animation.keyTimes = @[ @(0.0), @(0.5), @(1.0) ];
animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
[_circleLayer addAnimation:animation forKey:@"drawCircleAnimation"];
}
@@ -224,16 +241,16 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, [@(_countDown) stringValue]);
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @(_countDown).stringValue);
[_countdownView startAnimateWithDuration:[(ORKActiveStep *)self.step stepDuration]];
}
- (void)updateCountdownLabel {
_countdownView.timeLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)_countDown];
_countdownView.timeLabel.text = ORKLocalizedStringFromNumber(@(_countDown));
}
- (void)countDownTimerFired:(ORKActiveStepTimer *)timer finished:(BOOL)finished {
_countDown = MAX((_countDown-1), 0);
_countDown = MAX((_countDown - 1), 0);
[self updateCountdownLabel];
if (UIAccessibilityIsVoiceOverRunning()) {
@@ -247,7 +264,7 @@
}];
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, ORKLocalizedString(@"AX_ANNOUNCE_BEGIN_TASK", nil));
} else {
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, [@(_countDown) stringValue]);
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @(_countDown).stringValue);
[super countDownTimerFired:timer finished:finished];
}
} else {
+56 -22
View File
@@ -29,8 +29,8 @@
*/
#import <Foundation/Foundation.h>
#import <ResearchKit/ORKDefines.h>
@import Foundation;
#import <ResearchKit/ORKTypes.h>
NS_ASSUME_NONNULL_BEGIN
@@ -65,6 +65,18 @@ NS_ASSUME_NONNULL_BEGIN
@end
@protocol ORKDataLoggerExtendedDelegate <ORKDataLoggerDelegate>
@optional
/**
Tells the delegate that the maximum current log file lifetime changed.
@param dataLogger Source of this event.
*/
- (void)dataLoggerThresholdsDidChange:(ORKDataLogger *)dataLogger;
@end
@class ORKLogFormatter;
/**
@@ -101,6 +113,9 @@ ORK_CLASS_AVAILABLE
*/
+ (ORKDataLogger *)JSONDataLoggerWithDirectory:(NSURL *)url logName:(NSString *)logName delegate:(nullable id<ORKDataLoggerDelegate>)delegate;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/**
Returns an initialized data logger using the specified URL, log name, formatter, and delegate.
@@ -164,7 +179,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the enumeration was successful; otherwise, `NO`.
*/
- (BOOL)enumerateLogs:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error;
- (BOOL)enumerateLogs:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * _Nullable *)error;
/**
Enumerates the URLs of completed log files not yet marked uploaded,
@@ -179,7 +194,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the enumeration was successful; otherwise, `NO`.
*/
- (BOOL)enumerateLogsNeedingUpload:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error;
- (BOOL)enumerateLogsNeedingUpload:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * _Nullable *)error;
/**
Enumerates the URLs of completed log files not already marked uploaded,
@@ -194,7 +209,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the enumeration was successful; otherwise, `NO`.
*/
- (BOOL)enumerateLogsAlreadyUploaded:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error;
- (BOOL)enumerateLogsAlreadyUploaded:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * _Nullable *)error;
/**
Appends an object to the log file, which is formatted with `logFormatter`.
@@ -205,12 +220,12 @@ ORK_CLASS_AVAILABLE
log data is made. If an attempt is made to log data and there is no access due
to file protection, the log is immediately rolled over and a new file created.
@param object Should be an object of a class that is accepted by the logFormatter.
@param error Error output, if the append fails.
@param object Should be an object of a class that is accepted by the logFormatter.
@param error Error output, if the append fails.
@return `YES` if appending succeeds; otherwise, `NO`.
*/
- (BOOL)append:(id)object error:(NSError * __autoreleasing *)error;
- (BOOL)append:(id)object error:(NSError * _Nullable *)error;
/**
Appends multiple objects to the log file.
@@ -218,12 +233,12 @@ ORK_CLASS_AVAILABLE
This method formats and appends all the objects at once. Using this method may have efficiency
and atomicity gains for error handling, compared to making multiple calls to `append:error`.
@param objects An array of objects of a class that is accepted by the logFormatter.
@param error Error output, if the append fails.
@param objects An array of objects of a class that is accepted by the logFormatter.
@param error Error output, if the append fails.
@return `YES` if appending succeeds; otherwise, `NO`.
*/
- (BOOL)appendObjects:(NSArray *)objects error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)appendObjects:(NSArray *)objects error:(NSError * _Nullable *)error;
/**
Checks whether a file has been marked as uploaded.
@@ -249,7 +264,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if adding or removing the attribute succeeded; otherwise, `NO`.
*/
- (BOOL)markFileUploaded:(BOOL)uploaded atURL:(NSURL *)url error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)markFileUploaded:(BOOL)uploaded atURL:(NSURL *)url error:(NSError * _Nullable *)error;
/**
Removes files if they are marked uploaded.
@@ -263,7 +278,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if removing the files succeeded; otherwise, `NO`.
*/
- (BOOL)removeUploadedFiles:(NSArray *)fileURLs withError:(NSError * __nullable __autoreleasing *)error;
- (BOOL)removeUploadedFiles:(NSArray<NSURL *> *)fileURLs withError:(NSError * _Nullable *)error;
/**
Removes all files managed by this logger (files that have the `logName` prefix).
@@ -272,7 +287,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if removing the files succeeded.; otherwise, `NO`.
*/
- (BOOL)removeAllFilesWithError:(NSError *__nullable __autoreleasing *)error;
- (BOOL)removeAllFilesWithError:(NSError * _Nullable *)error;
@end
@@ -318,7 +333,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the write succeeds; otherwise, `NO`.
*/
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError * _Nullable *)error;
/**
Appends the specified object to the log file.
@@ -329,7 +344,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the write succeeds; otherwise, `NO`.
*/
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError * _Nullable *)error;
/**
Appends the specified objects to the log file.
@@ -340,7 +355,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the write succeeds; otherwise, `NO`.
*/
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError * _Nullable *)error;
@end
@@ -423,6 +438,9 @@ ORK_CLASS_AVAILABLE
ORK_CLASS_AVAILABLE
@interface ORKDataLoggerManager : NSObject <ORKDataLoggerDelegate>
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/**
Returns an initialized data logger manager using the specified directory and delegate.
@@ -489,7 +507,7 @@ ORK_CLASS_AVAILABLE
- (void)removeDataLogger:(ORKDataLogger *)logger;
/// Returns the set of log names of the data loggers managed by this object.
- (NSArray *)logNames;
- (NSArray<NSString *> *)logNames;
/**
Enumerates all the logs that need upload across all data loggers, sorted from oldest to first.
@@ -501,7 +519,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the enumeration succeeds; otherwise, `NO`.
*/
- (BOOL)enumerateLogsNeedingUpload:(void (^)(ORKDataLogger *dataLogger, NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error;
- (BOOL)enumerateLogsNeedingUpload:(void (^)(ORKDataLogger *dataLogger, NSURL *logFileUrl, BOOL *stop))block error:(NSError * _Nullable *)error;
/**
Unmarks the set of uploaded files.
@@ -514,7 +532,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the operation succeeds; otherwise, `NO`.
*/
- (BOOL)unmarkUploadedFiles:(NSArray *)fileURLs error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)unmarkUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError * _Nullable *)error;
/**
Removes a set of uploaded files.
@@ -528,7 +546,7 @@ ORK_CLASS_AVAILABLE
@return `YES` if the operation succeeds; otherwise, `NO`.
*/
- (BOOL)removeUploadedFiles:(NSArray *)fileURLs error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)removeUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError * _Nullable *)error;
/**
Removes old and uploaded logs to bring total bytes down to a threshold.
@@ -541,7 +559,23 @@ ORK_CLASS_AVAILABLE
@return `YES` if the operation succeeds; otherwise, `NO`.
*/
- (BOOL)removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError * __nullable __autoreleasing *)error;
- (BOOL)removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError * _Nullable *)error;
@end
@interface ORKDataLogger (Tests)
/// The file handle to which to write
- (nullable NSFileHandle *)fileHandle;
@end
@interface NSURL (ORKDataLogger)
- (BOOL)ork_isUploaded;
- (BOOL)ork_setUploaded:(BOOL)uploaded error:(NSError * _Nullable *)error;
@end
+145 -122
View File
@@ -30,22 +30,21 @@
#import "ORKDataLogger.h"
#import <ResearchKit/ResearchKit.h>
#import "ORKHelpers.h"
#include <sys/xattr.h>
#import "ORKDataLogger_Private.h"
#import "HKSample+ORKJSONDictionary.h"
#import "ORKHelpers_Internal.h"
#import "CMMotionActivity+ORKJSONDictionary.h"
#import "ORKDefines_Private.h"
#import "HKSample+ORKJSONDictionary.h"
#include <sys/xattr.h>
static const char * kORKDataLoggerUploadedAttr = "com.apple.ResearchKit.uploaded";
static const char *ORKDataLoggerUploadedAttr = "com.apple.ResearchKit.uploaded";
// Default per-logfile settings when a data logger is used in an ORKDataLoggerManager
static const NSTimeInterval kORKDataLoggerManagerDefaultLogFileLifetime = 60*60*24*3; // 3 days
static const unsigned long long kORKDataLoggerManagerDefaultLogFileSize = 1024*1024; // 1 MB
static const NSTimeInterval ORKDataLoggerManagerDefaultLogFileLifetime = 60 * 60 * 24 * 3; // 3 days
static const unsigned long long ORKDataLoggerManagerDefaultLogFileSize = 1024 * 1024; // 1 MB
static NSString *const kORKDataLoggerManagerConfigurationFilename = @".ORKDataLoggerManagerConfiguration";
static NSString *const ORKDataLoggerManagerConfigurationFilename = @".ORKDataLoggerManagerConfiguration";
@interface ORKDataLogger ()
@@ -80,7 +79,7 @@ static NSString *const kORKDataLoggerManagerConfigurationFilename = @".ORKDataLo
- (NSString *)ork_logName {
NSString *lastComponent = [self lastPathComponent];
NSRange idx = [lastComponent rangeOfString:@"-"];
if (! idx.length) {
if (!idx.length) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not a completed log file" userInfo:@{@"url":self}];
}
@@ -91,28 +90,28 @@ static NSString *const kORKDataLoggerManagerConfigurationFilename = @".ORKDataLo
- (NSString *)ork_logDateComponent {
NSString *lastComponent = [self lastPathComponent];
NSRange idx = [lastComponent rangeOfString:@"-"];
if (! idx.length) {
if (!idx.length) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not a completed log file" userInfo:@{@"url":self}];
}
NSString *logDateComponent = [lastComponent substringFromIndex:idx.location+1];
NSString *logDateComponent = [lastComponent substringFromIndex:idx.location + 1];
return logDateComponent;
}
- (BOOL)ork_isUploaded {
NSData *data = [self ork_dataForAttr:kORKDataLoggerUploadedAttr];
NSData *data = [self ork_dataForAttr:ORKDataLoggerUploadedAttr];
if (!data) {
return NO;
}
NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return ([string integerValue] != 0);
return (string.integerValue != 0);
}
- (BOOL)ork_setUploaded:(BOOL)uploaded error:(NSError * __autoreleasing *)error {
- (BOOL)ork_setUploaded:(BOOL)uploaded error:(NSError **)error {
NSString *value = (uploaded ? @"1" : @"0");
NSData *encodedString = [value dataUsingEncoding:NSUTF8StringEncoding];
return [self ork_setData:encodedString forAttr:kORKDataLoggerUploadedAttr error:error];
return [self ork_setData:encodedString forAttr:ORKDataLoggerUploadedAttr error:error];
}
- (NSData *)ork_dataForAttr:(const char *)attr {
@@ -125,7 +124,7 @@ static NSString *const kORKDataLoggerManagerConfigurationFilename = @".ORKDataLo
}
NSMutableData *data = [NSMutableData dataWithLength:length];
length = getxattr(path, attr, [data mutableBytes], length, 0, 0);
length = getxattr(path, attr, data.mutableBytes, length, 0, 0);
if (length <= 0) {
return nil;
}
@@ -133,25 +132,25 @@ static NSString *const kORKDataLoggerManagerConfigurationFilename = @".ORKDataLo
return data;
}
- (BOOL)ork_setData:(NSData *)data forAttr:(const char *)attr error:(NSError * __autoreleasing *)error {
- (BOOL)ork_setData:(NSData *)data forAttr:(const char *)attr error:(NSError **)error {
const char *path = [self fileSystemRepresentation];
int rc = setxattr(path, attr, [data bytes], [data length], 0, 0);
int rc = setxattr(path, attr, data.bytes, data.length, 0, 0);
if (rc != 0) {
if (error) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:rc userInfo:@{NSLocalizedDescriptionKey : ORKLocalizedString(@"ERROR_DATALOGGER_SET_ATTRIBUTE", nil)}];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:rc userInfo:@{NSLocalizedDescriptionKey: ORKLocalizedString(@"ERROR_DATALOGGER_SET_ATTRIBUTE", nil)}];
}
}
return (rc == 0);
}
- (NSString *)ork_logNameInDirectory:(NSURL *)directory {
if (! [self isFileURL]) {
if (![self isFileURL]) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not a fileURL" userInfo:@{@"url":self}];
}
NSString *lastComponent = [self lastPathComponent];
NSRange idx = [lastComponent rangeOfString:@"-"];
if (! idx.length) {
if (!idx.length) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not a completed log file" userInfo:@{@"url":self}];
}
@@ -239,11 +238,11 @@ static void *ORKObjectObserverContext = &ORKObjectObserverContext;
return [object isKindOfClass:[NSData class]];
}
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
return YES;
}
- (BOOL)writeData:(NSData *)data fileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
- (BOOL)writeData:(NSData *)data fileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
BOOL result = YES;
@try {
[fileHandle writeData:data];
@@ -251,7 +250,7 @@ static void *ORKObjectObserverContext = &ORKObjectObserverContext;
@catch (NSException *exception) {
result = NO;
if (error) {
*error = [NSError errorWithDomain:ORKErrorDomain code:ORKErrorException userInfo:@{@"exception" : exception}];
*error = [NSError errorWithDomain:ORKErrorDomain code:ORKErrorException userInfo:@{@"exception": exception}];
}
}
return result;
@@ -266,14 +265,14 @@ static void *ORKObjectObserverContext = &ORKObjectObserverContext;
[fileHandle truncateFileAtOffset:offset];
}
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
if (! [self canAcceptLogObject:object]) {
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
if (![self canAcceptLogObject:object]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"ORKLogFormatter accepts NSData only" userInfo:nil];
}
return [self writeData:(NSData *)object fileHandle:fileHandle error:error];
}
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
unsigned long long checkpoint = [self checkpointWithFileHandle:fileHandle];
NSError *errorOut = nil;
@@ -285,7 +284,7 @@ static void *ORKObjectObserverContext = &ORKObjectObserverContext;
}
}
if (! success) {
if (!success) {
[self rollbackToCheckpoint:checkpoint fileHandle:fileHandle];
if (error) {
*error = errorOut;
@@ -312,8 +311,8 @@ static NSInteger _ORKJSON_terminatorLength = 0;
if (self) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_ORKJSON_emptyLogLength = [[kJSONLogEmptyLogString dataUsingEncoding:NSUTF8StringEncoding] length];
_ORKJSON_terminatorLength = [[kJSONLogFooterString dataUsingEncoding:NSUTF8StringEncoding] length];
_ORKJSON_emptyLogLength = [kJSONLogEmptyLogString dataUsingEncoding:NSUTF8StringEncoding].length;
_ORKJSON_terminatorLength = [kJSONLogFooterString dataUsingEncoding:NSUTF8StringEncoding].length;
});
}
return self;
@@ -327,7 +326,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return [object isKindOfClass:[NSDictionary class]] && [NSJSONSerialization isValidJSONObject:object];
}
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
- (BOOL)beginLogWithFileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
// Write valid JSON containing no objects
NSData *data = [kJSONLogEmptyLogString dataUsingEncoding:NSUTF8StringEncoding];
return [self writeData:data fileHandle:fileHandle error:error];
@@ -348,7 +347,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
}
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
- (BOOL)appendObject:(id)object fileHandle:(NSFileHandle *)fileHandle error:(NSError **)error {
return [self appendObjects:@[object] fileHandle:fileHandle error:error];
}
@@ -361,15 +360,15 @@ static NSInteger _ORKJSON_terminatorLength = 0;
* object being appended, and the footer bytes.
*/
- (BOOL)appendObjects:(NSArray *)objects fileHandle:(NSFileHandle *)fileHandle error:(NSError * __autoreleasing *)error {
if (! fileHandle) {
if (!fileHandle) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Filehandle is nil" userInfo:nil];
}
NSInteger numObjects = [objects count];
NSInteger numObjects = objects.count;
if (numObjects == 0) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"No objects" userInfo:nil];
}
for (NSObject *object in objects) {
if (! [self canAcceptLogObject:object]) {
if (![self canAcceptLogObject:object]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"ORKLogFormatter accepts JSON serializable objects only" userInfo:nil];
}
}
@@ -406,7 +405,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
}
}];
if (! success) {
if (!success) {
return success;
}
@@ -417,7 +416,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
success = [self writeData:outputData fileHandle:fileHandle error:error];
if (! success) {
if (!success) {
[self rollbackToCheckpoint:checkpoint fileHandle:fileHandle];
}
@@ -446,17 +445,25 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return [[ORKDataLogger alloc] initWithDirectory:url logName:logName formatter:[ORKJSONLogFormatter new] delegate:delegate];
}
+ (instancetype)new {
ORKThrowMethodUnavailableException();
}
- (instancetype)init {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithDirectory:(NSURL *)url logName:(NSString *)logName formatter:(ORKLogFormatter *)formatter delegate:(id<ORKDataLoggerDelegate>)delegate {
self = [super init];
if (self) {
_url = [url copy];
if (! [[NSFileManager defaultManager] fileExistsAtPath:[url path]]) {
if (![[NSFileManager defaultManager] fileExistsAtPath:[url path]]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"directory does not exist" userInfo:nil];
}
if ([logName hasSuffix:@"-"]) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"logName should not terminate with '-'" userInfo:nil];
}
if (! [logName length]) {
if (!logName.length) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"logName must be non-empty" userInfo:nil];
}
@@ -480,27 +487,27 @@ static NSInteger _ORKJSON_terminatorLength = 0;
- (instancetype)initWithDirectory:(NSURL *)url configuration:(NSDictionary *)configuration delegate:(id<ORKDataLoggerDelegate>)delegate {
Class formatterClass = NSClassFromString(configuration[@"formatterClass"]);
if (! formatterClass) {
if (!formatterClass) {
@throw [NSException exceptionWithName:NSGenericException reason:[NSString stringWithFormat:@"%@ is not a class", configuration[@"formatterClass"]] userInfo:nil];
}
self = [self initWithDirectory:url logName:configuration[@"logName"] formatter:[formatterClass new] delegate:delegate];
self = [self initWithDirectory:url logName:configuration[@"logName"] formatter:[[formatterClass alloc] init] delegate:delegate];
if (self) {
// Don't notify about initial setup
[_observer pause];
self.maximumCurrentLogFileSize = [configuration[@"maximumCurrentLogFileSize"] unsignedLongValue];
self.maximumCurrentLogFileLifetime = [configuration[@"maximumCurrentLogFileLifetime"] doubleValue];
self.maximumCurrentLogFileSize = ((NSNumber *)configuration[@"maximumCurrentLogFileSize"]).unsignedLongValue;
self.maximumCurrentLogFileLifetime = ((NSNumber *)configuration[@"maximumCurrentLogFileLifetime"]).doubleValue;
[_observer resume];
}
return self;
}
- (NSDictionary *)configuration {
return @{@"logName" : self.logName,
@"formatterClass" : NSStringFromClass([self.logFormatter class]),
@"fileProtectionMode" : @(self.fileProtectionMode),
@"maximumCurrentLogFileSize" : @(self.maximumCurrentLogFileSize),
@"maximumCurrentLogFileLifetime" : @(self.maximumCurrentLogFileLifetime)
return @{@"logName": self.logName,
@"formatterClass": NSStringFromClass([self.logFormatter class]),
@"fileProtectionMode": @(self.fileProtectionMode),
@"maximumCurrentLogFileSize": @(self.maximumCurrentLogFileSize),
@"maximumCurrentLogFileLifetime": @(self.maximumCurrentLogFileLifetime)
};
}
@@ -509,7 +516,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
- (void)setupDirectorySource {
int dirFD = open([_url fileSystemRepresentation], O_EVTONLY);
if (dirFD < 0) {
ORK_Log_Oops(@"Could not track directory %s (%d)", [_url fileSystemRepresentation], [[NSFileManager defaultManager] fileExistsAtPath:[_url path]]);
ORK_Log_Warning(@"Could not track directory %s (%d)", [_url fileSystemRepresentation], [[NSFileManager defaultManager] fileExistsAtPath:[_url path]]);
} else {
// Dispatch to a concurrent queue, so we don't store up blocks while our
// queue is working.
@@ -521,9 +528,9 @@ static NSInteger _ORKJSON_terminatorLength = 0;
if (_directorySource) {
dispatch_source_set_cancel_handler(_directorySource, ^{ close(dirFD); });
__weak __typeof(self) weakSelf = self;
ORKWeakTypeOf(self) weakSelf = self;
dispatch_source_set_event_handler(_directorySource, ^{
__strong __typeof(self) strongSelf = weakSelf;
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf directoryUpdated];
});
dispatch_resume(_directorySource);
@@ -588,11 +595,11 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return success;
}
- (BOOL)enumerateLogsNeedingUpload:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error {
- (BOOL)enumerateLogsNeedingUpload:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError **)error {
return [self enumerateLogsUploaded:NO block:block error:error];
}
- (BOOL)enumerateLogsAlreadyUploaded:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error {
- (BOOL)enumerateLogsAlreadyUploaded:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError **)error {
return [self enumerateLogsUploaded:YES block:block error:error];
}
@@ -608,7 +615,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
- (BOOL)appendObjects:(NSArray *)objects error:(NSError * __autoreleasing *)error {
if (![objects count]) {
if (!objects.count) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Empty array" userInfo:nil];
}
__block BOOL success = NO;
@@ -626,7 +633,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return success;
}
- (BOOL)removeUploadedFiles:(NSArray *)fileURLs withError:(NSError * __autoreleasing *)error {
- (BOOL)removeUploadedFiles:(NSArray<NSURL *> *)fileURLs withError:(NSError * __autoreleasing *)error {
__block BOOL success = NO;
dispatch_sync(_queue, ^{
success = [self queue_removeUploadedFiles:fileURLs withError:error];
@@ -658,7 +665,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
- (void)queue_setNeedsUpdateBytes {
if (! _directoryDirty) {
if (!_directoryDirty) {
_directoryDirty = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), _queue, ^{
@@ -680,7 +687,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
});
}
- (BOOL)queue_enumerateLogs:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error {
- (BOOL)queue_enumerateLogs:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError **)error {
static NSArray *keys = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@@ -698,7 +705,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
NSError *errorOut = nil;
NSMutableArray *urls = [NSMutableArray array];
for (NSURL *url in enumerator) {
if (! [self urlMatchesLogName:url]) {
if (![self urlMatchesLogName:url]) {
continue;
}
if ( [[url lastPathComponent] isEqualToString:_logName]) {
@@ -710,13 +717,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
// If there's been an error getting the resource values, give up
break;
}
if (! [resources[NSURLIsRegularFileKey] boolValue]) {
if (!((NSNumber *)resources[NSURLIsRegularFileKey]).boolValue) {
continue;
}
[urls addObject:url];
}
if (! errorOut) {
if (!errorOut) {
// Sort the URLs before beginning enumeration for the caller
[urls sortUsingComparator:^NSComparisonResult(NSURL *obj1, NSURL *obj2) {
// We can assume all relate to files in the same directory
@@ -738,7 +745,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return (errorOut ? NO : YES);
}
- (BOOL)queue_enumerateLogsUploaded:(BOOL)uploaded block:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error {
- (BOOL)queue_enumerateLogsUploaded:(BOOL)uploaded block:(void (^)(NSURL *logFileUrl, BOOL *stop))block error:(NSError **)error {
return [self queue_enumerateLogs:^(NSURL *logFileUrl, BOOL *stop) {
NSError *errorOut = nil;
BOOL wantUploaded = [logFileUrl ork_isUploaded];
@@ -752,7 +759,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
} error:error];
}
- (NSFileHandle *)queue_makeFileHandleWithError:(NSError * __autoreleasing *)error {
- (NSFileHandle *)queue_makeFileHandleWithError:(NSError **)error {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *url = [self currentLogFileURL];
@@ -760,12 +767,12 @@ static NSInteger _ORKJSON_terminatorLength = 0;
NSNumber *fileExists = nil;
[url getResourceValue:&fileExists forKey:NSURLIsRegularFileKey error:nil];
BOOL createNewFile = ! [fileExists boolValue];
BOOL createNewFile = !fileExists.boolValue;
NSFileHandle *fileHandle = nil;
if (!createNewFile) {
fileHandle = [NSFileHandle fileHandleForWritingToURL:url error:error];
if (! fileHandle) {
if (!fileHandle) {
// Assume it's because we can't open the file, perhaps for security reasons.
// Close and rename the log.
[self queue_closeAndRenameLog];
@@ -778,7 +785,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
BOOL success = [fileManager createFileAtPath:filePath contents:nil attributes:nil];
if (!success) {
if (error) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{NSLocalizedDescriptionKey : ORKLocalizedString(@"ERROR_DATALOGGER_CREATE_FILE", nil)}];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{NSLocalizedDescriptionKey: ORKLocalizedString(@"ERROR_DATALOGGER_CREATE_FILE", nil)}];
}
return nil;
}
@@ -793,7 +800,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
assert(fileHandle);
// Set file protection after opening the file, so that class B works as expected.
BOOL success = [fileManager setAttributes:@{NSFileProtectionKey : ORKFileProtectionFromMode(self.fileProtectionMode)} ofItemAtPath:[url path] error:error];
BOOL success = [fileManager setAttributes:@{NSFileProtectionKey: ORKFileProtectionFromMode(self.fileProtectionMode)} ofItemAtPath:[url path] error:error];
// Allow formatter to initialize the log file with header content
success = success && [self.logFormatter beginLogWithFileHandle:fileHandle error:error];
@@ -808,7 +815,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return _currentFileHandle;
}
- (NSFileHandle *)queue_fileHandleWithError:(NSError * __autoreleasing *)error {
- (NSFileHandle *)queue_fileHandleWithError:(NSError **)error {
if (!_currentFileHandle) {
_currentFileHandle = [self queue_makeFileHandleWithError:error];
@@ -818,15 +825,15 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
+ (NSURL *)nextUrlForDirectoryUrl:(NSURL *)directory logName:(NSString *)logName {
static NSDateFormatter *dfm = nil;
static NSDateFormatter *dateFromatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dfm = [NSDateFormatter new];
[dfm setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
dfm.dateFormat = @"yyyyMMddHHmmss";
dateFromatter = [NSDateFormatter new];
[dateFromatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
dateFromatter.dateFormat = @"yyyyMMddHHmmss";
});
NSString *datedLog = [NSString stringWithFormat:@"%@-%@",logName, [dfm stringFromDate:[NSDate date]]];
NSString *datedLog = [NSString stringWithFormat:@"%@-%@",logName, [dateFromatter stringFromDate:[NSDate date]]];
NSURL *destinationUrl = [directory URLByAppendingPathComponent:datedLog];
NSFileManager *fileManager = [NSFileManager defaultManager];
@@ -852,19 +859,19 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
// Check if a non-empty file exists, and create the file handle if so
NSDictionary *params = [url resourceValuesForKeys:@[NSURLIsRegularFileKey,NSURLFileSizeKey] error:nil];
NSDictionary *parameters = [url resourceValuesForKeys:@[NSURLIsRegularFileKey,NSURLFileSizeKey] error:nil];
if ( [params[NSURLIsRegularFileKey] boolValue]) {
if ([params[NSURLFileSizeKey] intValue] > 0) {
if (((NSNumber *)parameters[NSURLIsRegularFileKey]).boolValue) {
if (((NSNumber *)parameters[NSURLFileSizeKey]).intValue > 0) {
NSURL *destinationUrl = [ORKDataLogger nextUrlForDirectoryUrl:_url logName:_logName];
ORK_Log_Debug(@"Rollover: %@ to %@", [url lastPathComponent], [destinationUrl lastPathComponent]);
[fileManager moveItemAtURL:url toURL:destinationUrl error:nil];
if (self.fileProtectionMode == ORKFileProtectionCompleteUnlessOpen) {
// Upgrade to complete file protection after roll-over
NSError *error = nil;
if (! [fileManager setAttributes:@{NSFileProtectionKey : NSFileProtectionComplete}
ofItemAtPath:[destinationUrl path] error:&error]) {
ORK_Log_Debug(@"Error setting NSFileProtectionComplete on %@: %@", destinationUrl, error);
if (![fileManager setAttributes:@{NSFileProtectionKey: NSFileProtectionComplete}
ofItemAtPath:[destinationUrl path] error:&error]) {
ORK_Log_Warning(@"Error setting NSFileProtectionComplete on %@: %@", destinationUrl, error);
}
}
@@ -883,7 +890,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
NSURL *url = [self currentLogFileURL];
NSDictionary *parameters = [url resourceValuesForKeys:@[NSURLIsRegularFileKey, NSURLFileSizeKey, NSURLCreationDateKey] error:nil];
NSInteger fileSize = [parameters[NSURLFileSizeKey] integerValue];
NSInteger fileSize = ((NSNumber *)parameters[NSURLFileSizeKey]).integerValue;
NSDate *creationDate = parameters[NSURLCreationDateKey];
BOOL exceededSizeThreshold = ( (self.maximumCurrentLogFileSize > 0) && (fileSize >= self.maximumCurrentLogFileSize));
@@ -901,7 +908,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
[self queue_closeAndRenameLog];
}
- (BOOL)queue_append:(id)object error:(NSError * __autoreleasing *)error {
- (BOOL)queue_append:(id)object error:(NSError **)error {
[self queue_rolloverIfNeeded];
NSFileHandle *fileHandle = [self queue_fileHandleWithError:error];
@@ -919,7 +926,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return result;
}
- (BOOL)queue_appendObjects:(NSArray *)objects error:(NSError * __autoreleasing *)error {
- (BOOL)queue_appendObjects:(NSArray *)objects error:(NSError **)error {
[self queue_rolloverIfNeeded];
NSFileHandle *fileHandle = [self queue_fileHandleWithError:error];
@@ -936,13 +943,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return result;
}
- (BOOL)queue_markFileUploaded:(BOOL)uploaded atURL:(NSURL *)url error:(NSError * __autoreleasing *)error {
- (BOOL)queue_markFileUploaded:(BOOL)uploaded atURL:(NSURL *)url error:(NSError **)error {
BOOL success = [url ork_setUploaded:uploaded error:error];
[self queue_setNeedsUpdateBytes];
return success;
}
- (BOOL)queue_removeUploadedFiles:(NSArray *)fileURLs withError:(NSError * __autoreleasing *)error {
- (BOOL)queue_removeUploadedFiles:(NSArray<NSURL *> *)fileURLs withError:(NSError **)error {
NSFileManager *fileManager = [NSFileManager defaultManager];
__block NSMutableArray *errors = [NSMutableArray array];
BOOL success = [self queue_enumerateLogs:^(NSURL *logFileUrl, BOOL *stop) {
@@ -956,16 +963,20 @@ static NSInteger _ORKJSON_terminatorLength = 0;
}
} else {
// File was requested to be removed, but was not marked uploaded
[errors addObject:[NSError errorWithDomain:ORKErrorDomain code:ORKErrorInvalidObject userInfo:@{NSLocalizedDescriptionKey : ORKLocalizedString(@"ERROR_DATALOGGER_COULD_NOT_MAORK", nil), @"url" : logFileUrl}]];
[errors addObject:[NSError errorWithDomain:ORKErrorDomain
code:ORKErrorInvalidObject
userInfo:@{NSLocalizedDescriptionKey: ORKLocalizedString(@"ERROR_DATALOGGER_COULD_NOT_MAORK", nil), @"url": logFileUrl}]];
}
}
} error:error];
// Reporting multiple errors
if ([errors count]) {
if (errors.count) {
if (!success && error && *error) {
[errors addObject:*error];
*error = [NSError errorWithDomain:ORKErrorDomain code:ORKErrorMultipleErrors userInfo:@{NSLocalizedDescriptionKey : ORKLocalizedString(@"ERROR_DATALOGGER_MULTIPLE", nil), @"errors" : errors}];
*error = [NSError errorWithDomain:ORKErrorDomain
code:ORKErrorMultipleErrors
userInfo:@{NSLocalizedDescriptionKey: ORKLocalizedString(@"ERROR_DATALOGGER_MULTIPLE", nil), @"errors": errors}];
}
success = NO;
}
@@ -1036,11 +1047,19 @@ static NSInteger _ORKJSON_terminatorLength = 0;
@implementation ORKDataLoggerManager
+ (instancetype)new {
ORKThrowMethodUnavailableException();
}
- (instancetype)init {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithDirectory:(NSURL *)directory delegate:(id<ORKDataLoggerManagerDelegate>)delegate {
self = [super init];
if (self) {
_directory = directory;
if (! [[NSFileManager defaultManager] fileExistsAtPath:[_directory path]]) {
if (![[NSFileManager defaultManager] fileExistsAtPath:[_directory path]]) {
@throw [NSException exceptionWithName:NSGenericException reason:@"directory does not exist" userInfo:nil];
}
_delegate = delegate;
@@ -1053,39 +1072,43 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return nil;
}
NSDictionary *configuration = [NSDictionary dictionaryWithContentsOfURL:[_directory URLByAppendingPathComponent:kORKDataLoggerManagerConfigurationFilename]];
NSDictionary *configuration = [NSDictionary dictionaryWithContentsOfURL:[_directory URLByAppendingPathComponent:ORKDataLoggerManagerConfigurationFilename]];
[self loadConfiguration:configuration];
_observer = [[ORKObjectObserver alloc] initWithObject:self keys:@[@"pendingUploadBytesThreshold",@"totalBytesThreshold"] selector:@selector(configurationDidChange)];
_observer = [[ORKObjectObserver alloc] initWithObject:self keys:@[@"pendingUploadBytesThreshold", @"totalBytesThreshold"] selector:@selector(configurationDidChange)];
[self setNeedsUpdateBytes];
}
return self;
}
static NSString *const PendingUploadBytesThresholdKey = @"pendingUploadBytesThreshold";
static NSString *const TotalBytesThresholdKey = @"totalBytesThreshold";
static NSString *const LoggerConfigurationsKey = @"loggers";
- (void)loadConfiguration:(NSDictionary *)configuration {
self.pendingUploadBytesThreshold = [configuration[@"pendingUploadBytesThreshold"] unsignedLongLongValue];
self.totalBytesThreshold = [configuration[@"totalBytesThreshold"] unsignedLongLongValue];
self.pendingUploadBytesThreshold = ((NSNumber *)configuration[PendingUploadBytesThresholdKey]).unsignedLongLongValue;
self.totalBytesThreshold = ((NSNumber *)configuration[TotalBytesThresholdKey]).unsignedLongLongValue;
NSMutableDictionary *records = [NSMutableDictionary dictionary];
for (NSDictionary *loggerConfig in configuration[@"loggers"]) {
ORKDataLogger *logger = [[ORKDataLogger alloc] initWithDirectory:_directory configuration:loggerConfig delegate:self];
for (NSDictionary *loggerConfiguration in configuration[LoggerConfigurationsKey]) {
ORKDataLogger *logger = [[ORKDataLogger alloc] initWithDirectory:_directory configuration:loggerConfiguration delegate:self];
records[logger.logName] = logger;
}
_records = records;
}
- (NSDictionary *)queue_configuration {
NSMutableArray *loggerConfigurations = [[_records allValues] valueForKey:@"configuration"];
NSMutableArray *loggerConfigurations = [_records.allValues valueForKey:@"configuration"];
return @{@"pendingUploadBytesThreshold" : @(self.pendingUploadBytesThreshold),
@"totalBytesThreshold" : @(self.totalBytesThreshold),
@"loggers" : loggerConfigurations };
return @{PendingUploadBytesThresholdKey: @(self.pendingUploadBytesThreshold),
TotalBytesThresholdKey: @(self.totalBytesThreshold),
LoggerConfigurationsKey: loggerConfigurations };
}
- (void)queue_synchronizeConfiguration {
NSDictionary *configuration = [self queue_configuration];
[configuration writeToURL:[_directory URLByAppendingPathComponent:kORKDataLoggerManagerConfigurationFilename] atomically:YES];
[configuration writeToURL:[_directory URLByAppendingPathComponent:ORKDataLoggerManagerConfigurationFilename] atomically:YES];
}
- (void)configurationDidChange {
@@ -1102,8 +1125,8 @@ static NSInteger _ORKJSON_terminatorLength = 0;
ORKDataLogger *dataLogger = [[ORKDataLogger alloc] initWithDirectory:_directory logName:logName formatter:formatter delegate:self];
dataLogger.delegate = nil;
// Pick suitable defaults for a typical use pattern
dataLogger.maximumCurrentLogFileLifetime = kORKDataLoggerManagerDefaultLogFileLifetime;
dataLogger.maximumCurrentLogFileSize = kORKDataLoggerManagerDefaultLogFileSize;
dataLogger.maximumCurrentLogFileLifetime = ORKDataLoggerManagerDefaultLogFileLifetime;
dataLogger.maximumCurrentLogFileSize = ORKDataLoggerManagerDefaultLogFileSize;
dataLogger.delegate = self;
_records[logName] = dataLogger;
@@ -1151,19 +1174,19 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return dataLogger;
}
- (NSArray *)logNames {
__block NSArray *logNames = nil;
- (NSArray<NSString *> *)logNames {
__block NSArray<NSString *> *logNames = nil;
dispatch_sync(_queue, ^{
logNames = [_records allKeys];
logNames = _records.allKeys;
});
return logNames;
}
- (BOOL)queue_enumerateLogsNeedingUpload:(void (^)(ORKDataLogger *dataLogger, NSURL *logFileUrl, BOOL *stop))block error:(NSError * __autoreleasing *)error {
- (BOOL)queue_enumerateLogsNeedingUpload:(void (^)(ORKDataLogger *dataLogger, NSURL *logFileUrl, BOOL *stop))block error:(NSError **)error {
BOOL success = YES;
NSMutableArray *allFiles = [NSMutableArray array];
// Collect all the log file URLs so we can sort them by date rather than enumerating by logger.
for (ORKDataLogger *logger in [_records allValues]) {
for (ORKDataLogger *logger in _records.allValues) {
success = [logger enumerateLogsNeedingUpload:^(NSURL *logFileUrl, BOOL *stop) {
[allFiles addObject:logFileUrl];
} error:error];
@@ -1210,13 +1233,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return success;
}
- (BOOL)queue_removeUploadedFiles:(NSArray *)fileURLs error:(NSError * __autoreleasing *)error {
- (BOOL)queue_removeUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError **)error {
BOOL success = YES;
NSMutableArray *notRemoved = [NSMutableArray array];
for (NSURL *url in fileURLs) {
NSString *logName = [url ork_logNameInDirectory:_directory];
if (! _records[logName]) {
if (!_records[logName]) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not from a known logger" userInfo:@{@"url":url}];
}
@@ -1227,13 +1250,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
success = NO;
}
}
if (error && [notRemoved count]) {
if (error && notRemoved.count) {
*error = [NSError errorWithDomain:ORKErrorDomain code:ORKErrorMultipleErrors userInfo:@{@"notRemoved":notRemoved}];
}
return success;
}
- (BOOL)removeUploadedFiles:(NSArray *)fileURLs error:(NSError * __autoreleasing *)error {
- (BOOL)removeUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError * __autoreleasing *)error {
__block BOOL success = YES;
dispatch_sync(_queue, ^{
@@ -1242,13 +1265,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return success;
}
- (BOOL)queue_unmarkUploadedFiles:(NSArray *)fileURLs error:(NSError * __autoreleasing *)error {
- (BOOL)queue_unmarkUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError **)error {
BOOL success = YES;
NSMutableArray *notRemoved = [NSMutableArray array];
NSMutableArray<NSURL *> *notRemoved = [NSMutableArray array];
for (NSURL *url in fileURLs) {
NSString *logName = [url ork_logNameInDirectory:_directory];
ORKDataLogger *logger = _records[logName];
if (! logger) {
if (!logger) {
@throw [NSException exceptionWithName:NSGenericException reason:@"URL is not from a known logger" userInfo:@{@"url":url}];
}
@@ -1259,13 +1282,13 @@ static NSInteger _ORKJSON_terminatorLength = 0;
success = NO;
}
}
if (error && [notRemoved count]) {
if (error && notRemoved.count) {
*error = [NSError errorWithDomain:ORKErrorDomain code:ORKErrorMultipleErrors userInfo:@{@"notRemoved":notRemoved}];
}
return success;
}
- (BOOL)unmarkUploadedFiles:(NSArray *)fileURLs error:(NSError *__autoreleasing *)error {
- (BOOL)unmarkUploadedFiles:(NSArray<NSURL *> *)fileURLs error:(NSError * __autoreleasing *)error {
__block BOOL success = YES;
dispatch_sync(_queue, ^{
success = [self queue_unmarkUploadedFiles:fileURLs error:error];
@@ -1273,7 +1296,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return success;
}
- (BOOL)queue_removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError *__autoreleasing *)error {
- (BOOL)queue_removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError **)error {
if (bytes == 0) {
for (ORKDataLogger *logger in _records) {
[logger removeAllFilesWithError:nil];
@@ -1288,7 +1311,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
NSFileManager *fileManager = [NSFileManager defaultManager];
if (totalBytes > bytes) {
for (ORKDataLogger *logger in [_records allValues]) {
for (ORKDataLogger *logger in _records.allValues) {
[logger enumerateLogsAlreadyUploaded:^(NSURL *logFileUrl, BOOL *stop) {
unsigned long long fileSize = [[fileManager attributesOfItemAtPath:[logFileUrl path] error:nil] fileSize];
if (fileSize > 0) {
@@ -1330,7 +1353,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
return (totalBytes <= bytes);
}
- (BOOL)removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError *__autoreleasing *)error {
- (BOOL)removeOldAndUploadedLogsToThreshold:(unsigned long long)bytes error:(NSError * __autoreleasing *)error {
__block BOOL success = YES;
dispatch_sync(_queue, ^{
success = [self queue_removeOldAndUploadedLogsToThreshold:bytes error:error];
@@ -1341,7 +1364,7 @@ static NSInteger _ORKJSON_terminatorLength = 0;
- (void)queue_updateBytes {
unsigned long long pending = 0;
unsigned long long uploaded = 0;
for (ORKDataLogger *logger in [_records allValues]) {
for (ORKDataLogger *logger in _records.allValues) {
pending += logger.pendingBytes;
uploaded += logger.uploadedBytes;
}
@@ -1355,14 +1378,14 @@ static NSInteger _ORKJSON_terminatorLength = 0;
if (exceededPendingThreshold && !_pendingUploadDelegateSent) {
[self.delegate dataLoggerManager:self pendingUploadBytesReachedThreshold:pending];
_pendingUploadDelegateSent = YES;
} else if (! exceededPendingThreshold) {
} else if (!exceededPendingThreshold) {
_pendingUploadDelegateSent = NO;
}
if (exceededTotalThreshold && !_totalBytesDelegateSent) {
[self.delegate dataLoggerManager:self totalBytesReachedThreshold:(pending + uploaded)];
_totalBytesDelegateSent = YES;
} else if (! exceededTotalThreshold) {
} else if (!exceededTotalThreshold) {
_totalBytesDelegateSent = NO;
}
}
@@ -28,8 +28,11 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import <ResearchKit/ORKRecorder.h>
NS_ASSUME_NONNULL_BEGIN
@class CMDeviceMotion;
@@ -30,13 +30,16 @@
#import "ORKDeviceMotionRecorder.h"
#import "ORKHelpers.h"
#import "ORKRecorder_Internal.h"
#import "ORKRecorder_Private.h"
#import "ORKDataLogger.h"
#import <CoreMotion/CoreMotion.h>
#import "ORKRecorder_Internal.h"
#import "ORKHelpers_Internal.h"
#import "CMDeviceMotion+ORKJSONDictionary.h"
@import CoreMotion;
@interface ORKDeviceMotionRecorder () {
ORKDataLogger *_logger;
@@ -84,37 +87,32 @@
- (void)start {
[super start];
if (! _logger) {
NSError *err = nil;
_logger = [self makeJSONDataLoggerWithError:&err];
if (! _logger) {
[self finishRecordingWithError:err];
if (!_logger) {
NSError *error = nil;
_logger = [self makeJSONDataLoggerWithError:&error];
if (!_logger) {
[self finishRecordingWithError:error];
return;
}
}
self.motionManager = [self createMotionManager];
self.motionManager.deviceMotionUpdateInterval = 1.0/_frequency;
self.motionManager.deviceMotionUpdateInterval = 1.0 / _frequency;
self.uptime = [NSProcessInfo processInfo].systemUptime;
[self.motionManager stopDeviceMotionUpdates];
[self.motionManager
startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue]
withHandler:^(CMDeviceMotion *data, NSError *error)
{
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *data, NSError *error) {
BOOL success = NO;
if (data)
{
if (data) {
success = [_logger append:[data ork_JSONDictionary] error:&error];
id delegate = self.delegate;
if ([delegate respondsToSelector:@selector(deviceMotionRecorderDidUpdateWithMotion:)]) {
[delegate deviceMotionRecorderDidUpdateWithMotion:data];
}
}
if (!success)
{
if (!success) {
dispatch_async(dispatch_get_main_queue(), ^{
[self finishRecordingWithError:error];
});
@@ -170,11 +168,6 @@
@end
@interface ORKDeviceMotionRecorderConfiguration ()
@end
@implementation ORKDeviceMotionRecorderConfiguration
#pragma clang diagnostic push
+86 -77
View File
@@ -30,12 +30,16 @@
#import "ORKFitnessContentView.h"
#import "ORKHelpers.h"
#import <CoreMotion/CoreMotion.h>
#import "ORKSkin.h"
#import "ORKActiveStepQuantityView.h"
#import "ORKTintedImageView.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
@import CoreMotion;
@import HealthKit;
// #define LAYOUT_TEST 1
// #define LAYOUT_DEBUG 1
@@ -48,8 +52,6 @@
ORKTintedImageView *_imageView;
NSLengthFormatter *_lengthFormatter;
NSLayoutConstraint *_imageRatioConstraint;
ORKScreenType _screenType;
NSArray *_constraints;
NSLayoutConstraint *_topConstraint;
}
@@ -69,13 +71,12 @@
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_screenType = ORKScreenTypeiPhone4;
_timerLabel = [ORKQuantityLabel new];
_quantityPairView = [ORKQuantityPairView new];
_imageSpacer1 = [UIView new];
[_imageSpacer1 setTranslatesAutoresizingMaskIntoConstraints:NO];
_imageSpacer1.translatesAutoresizingMaskIntoConstraints = NO;
_imageSpacer2 = [UIView new];
[_imageSpacer2 setTranslatesAutoresizingMaskIntoConstraints:NO];
_imageSpacer2.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_imageSpacer1];
[self addSubview:_imageSpacer2];
[self heartRateView].image = [UIImage imageNamed:@"heart-fitness" inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil];
@@ -96,7 +97,7 @@
self.hasDistance = _hasDistance;
#if LAYOUT_TEST
self.timeLeft = 60*5;
self.timeLeft = 60 * 5;
self.hasHeartRate = YES;
self.hasDistance = YES;
self.distanceInMeters = 100;
@@ -113,7 +114,7 @@
[self addSubview:_quantityPairView];
[self addSubview:_imageView];
[self addSubview:_timerLabel];
[self setupConstraints];
[self setUpConstraints];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localeDidChange:) name:NSCurrentLocaleDidChangeNotification object:nil];
@@ -139,105 +140,114 @@
- (void)willMoveToWindow:(UIWindow *)newWindow {
[super willMoveToWindow:newWindow];
_screenType = ORKGetScreenTypeForWindow(newWindow);
[self updateConstraintConstants];
[self updateConstraintConstantsForWindow:newWindow];
}
- (void)updateConstraintConstants {
ORKScreenType screenType = _screenType;
const CGFloat CaptionBaselineToTimerTop = ORKGetMetricForScreenType(ORKScreenMetricCaptionBaselineToFitnessTimerTop, screenType);
const CGFloat CaptionBaselineToStepViewTop = ORKGetMetricForScreenType(ORKScreenMetricLearnMoreBaselineToStepViewTop, screenType);
- (void)updateConstraintConstantsForWindow:(UIWindow *)window {
const CGFloat CaptionBaselineToTimerTop = ORKGetMetricForWindow(ORKScreenMetricCaptionBaselineToFitnessTimerTop, window);
const CGFloat CaptionBaselineToStepViewTop = ORKGetMetricForWindow(ORKScreenMetricLearnMoreBaselineToStepViewTop, window);
_topConstraint.constant = (CaptionBaselineToTimerTop - CaptionBaselineToStepViewTop);
}
- (void)setupConstraints {
- (void)setUpConstraints {
NSMutableArray *constraints = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_timerLabel, _imageView, _quantityPairView, _imageSpacer1, _imageSpacer2);
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_timerLabel][_imageSpacer1(>=0)][_imageView]"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:views]];
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_timerLabel][_imageSpacer1(>=0)][_imageView]"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:views]];
_topConstraint = [NSLayoutConstraint constraintWithItem:_timerLabel
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeTop
multiplier:1
constant:0];
[self updateConstraintConstants];
multiplier:1.0
constant:0.0];
[constraints addObject:_topConstraint];
[constraints addObject:[NSLayoutConstraint
constraintWithItem:_timerLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1
constant:0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_timerLabel
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_timerLabel
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self attribute:NSLayoutAttributeWidth
multiplier:1
constant:0]];
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_imageView
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self attribute:NSLayoutAttributeWidth
multiplier:1
constant:0]];
multiplier:1.0
constant:0.0]];
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_imageView][_imageSpacer2(>=0)][_quantityPairView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_imageView][_imageSpacer2(>=0)][_quantityPairView]|"
options:0
metrics:nil
views:views]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_imageSpacer1
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:0]];
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_imageSpacer2
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:0]];
multiplier:1.0
constant:0.0]];
[constraints addObject:[NSLayoutConstraint constraintWithItem:_imageSpacer1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:_imageSpacer2
attribute:NSLayoutAttributeHeight
multiplier:1
constant:0]];
NSLayoutConstraint *constraint1 = [NSLayoutConstraint constraintWithItem:_imageSpacer1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:1000];
constraint1.priority = UILayoutPriorityDefaultLow-1;
[constraints addObject:constraint1];
multiplier:1.0
constant:0.0]];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_quantityPairView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
NSLayoutConstraint *imageSpacerHeightConstraint = [NSLayoutConstraint constraintWithItem:_imageSpacer1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:ORKScreenMetricMaxDimension];
imageSpacerHeightConstraint.priority = UILayoutPriorityDefaultLow - 1;
[constraints addObject:imageSpacerHeightConstraint];
NSLayoutConstraint *maxWidthConstraint = [NSLayoutConstraint constraintWithItem:self
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_quantityPairView]|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
NSLayoutConstraint *maxWidthConstraint = [NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
multiplier:1.0
constant:ORKScreenMetricMaxDimension];
maxWidthConstraint.priority = UILayoutPriorityRequired-1;
maxWidthConstraint.priority = UILayoutPriorityRequired - 1;
[constraints addObject:maxWidthConstraint];
[self addConstraints:constraints];
[NSLayoutConstraint activateConstraints:constraints];
[self updateConstraintConstantsForWindow:self.window];
}
- (void)setImage:(UIImage *)image {
@@ -253,8 +263,8 @@
relatedBy:NSLayoutRelationEqual
toItem:_imageView
attribute:NSLayoutAttributeWidth
multiplier:size
.height/size.width constant:0];
multiplier:size.height / size.width
constant:0.0];
_imageRatioConstraint.active = YES;
}
}
@@ -277,7 +287,7 @@
}
- (void)updateKeylineVisible {
[_quantityPairView setKeylineHidden:! (_hasDistance && _hasHeartRate)];
[_quantityPairView setKeylineHidden:!(_hasDistance && _hasHeartRate)];
}
- (void)setDistanceInMeters:(double)distanceInMeters {
@@ -304,12 +314,12 @@
double conversionFactor = 1.0;
if ([hkUnit isNull] && (unit == NSLengthFormatterUnitYard)) {
hkUnit = [HKUnit footUnit];
conversionFactor = 1/3.0;
conversionFactor = 1.0 / 3.0;
}
HKQuantity *quantity = [HKQuantity quantityWithUnit:[HKUnit meterUnit] doubleValue:displayDistance];
distanceString = [_lengthFormatter.numberFormatter stringFromNumber:@([quantity doubleValueForUnit:hkUnit]*conversionFactor)];
[self distanceView].title = [NSString stringWithFormat:ORKLocalizedString(@"FITNESS_DISTANCE_TITLE_FORMAT", nil), unitString];
[self distanceView].title = [NSString localizedStringWithFormat:ORKLocalizedString(@"FITNESS_DISTANCE_TITLE_FORMAT", nil), unitString];
[self distanceView].value = distanceString;
}
@@ -319,19 +329,18 @@
}
- (void)updateTimerLabel {
static NSDateComponentsFormatter *_formatter = nil;
static NSDateComponentsFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSDateComponentsFormatter *fmt = [NSDateComponentsFormatter new];
fmt.unitsStyle = NSDateComponentsFormatterUnitsStylePositional;
fmt.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorPad;
fmt.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitSecond;
_formatter = fmt;
formatter = [NSDateComponentsFormatter new];
formatter.unitsStyle = NSDateComponentsFormatterUnitsStylePositional;
formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorPad;
formatter.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitSecond;
});
NSString *s = [_formatter stringFromTimeInterval:MAX(round(_timeLeft),0)];
_timerLabel.text = s;
_timerLabel.hidden = (s == nil);
NSString *labelString = [formatter stringFromTimeInterval:MAX(round(_timeLeft),0)];
_timerLabel.text = labelString;
_timerLabel.hidden = (labelString == nil);
}
@end
+6 -1
View File
@@ -29,10 +29,13 @@
*/
#import <ResearchKit/ResearchKit.h>
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
NS_ASSUME_NONNULL_BEGIN
/**
Fitness step.
@@ -45,3 +48,5 @@ ORK_CLASS_AVAILABLE
@interface ORKFitnessStep : ORKActiveStep
@end
NS_ASSUME_NONNULL_END
+3 -2
View File
@@ -30,6 +30,7 @@
#import "ORKFitnessStep.h"
#import "ORKFitnessStepViewController.h"
@@ -52,8 +53,8 @@
NSTimeInterval const ORKFitnessStepMinimumDuration = 5.0;
if ( self.stepDuration < ORKFitnessStepMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"rest duration can not be shorter than %@ seconds.", @(ORKFitnessStepMinimumDuration)] userInfo:nil];
if (self.stepDuration < ORKFitnessStepMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"rest duration cannot be shorter than %@ seconds.", @(ORKFitnessStepMinimumDuration)] userInfo:nil];
}
}
@@ -29,9 +29,13 @@
*/
#import <ResearchKit/ResearchKit_Private.h>
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
/**
Step view controller corresponding to `ORKFitnessStep`.
@@ -42,3 +46,5 @@ ORK_CLASS_AVAILABLE
@interface ORKFitnessStepViewController : ORKActiveStepViewController
@end
NS_ASSUME_NONNULL_END
@@ -30,19 +30,24 @@
#import "ORKFitnessStepViewController.h"
#import "ORKHelpers.h"
#import "ORKStep_Private.h"
#import "ORKStepViewController_Internal.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKActiveStepTimer.h"
#import "ORKActiveStepView.h"
#import "ORKFitnessContentView.h"
#import "ORKVerticalContainerView.h"
#import "ORKFitnessStep.h"
#import "ORKStepViewController_Internal.h"
#import "ORKHealthQuantityTypeRecorder.h"
#import "ORKPedometerRecorder.h"
#import "ORKActiveStepView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKFitnessStep.h"
#import "ORKStep_Private.h"
#import "ORKHelpers_Internal.h"
@interface ORKFitnessStepViewController () <ORKHealthQuantityTypeRecorderDelegate,ORKPedometerRecorderDelegate> {
@interface ORKFitnessStepViewController () <ORKHealthQuantityTypeRecorderDelegate, ORKPedometerRecorderDelegate> {
NSInteger _intendedSteps;
ORKFitnessContentView *_contentView;
NSNumberFormatter *_hrFormatter;
@@ -29,6 +29,7 @@
*/
@import UIKit;
#import <ResearchKit/ORKRecorder.h>
@@ -30,7 +30,7 @@
#import "ORKHealthQuantityTypeRecorder.h"
#import "ORKHelpers.h"
#import "ORKHelpers_Internal.h"
#import "ORKDataLogger.h"
#import "ORKRecorder_Private.h"
#import "ORKRecorder_Internal.h"
@@ -43,12 +43,29 @@
HKHealthStore *_healthStore;
NSPredicate *_samplePredicate;
HKObserverQuery *_observerQuery;
NSInteger _anchor;
/// Either the HKQueryAnchor object *or* NSUInteger value are tracked since the initializer for
/// iOS 8 and iOS 9 use different objects. Only one will actually be referenced in the initalizer.
HKQueryAnchor *_anchor;
NSUInteger _anchorValue;
HKQuantitySample *_lastSample;
}
@end
#ifdef __IPHONE_10_0
/// Add a protocol defining the initializer for iOS 8 apps. This signature was deprecated in iOS 9
/// and deleted in iOS 10.
@interface HKAnchoredObjectQuery (iOS8)
- (instancetype)initWithType:(HKSampleType *)type
predicate:(NSPredicate *)predicate
anchor:(NSUInteger)anchor
limit:(NSUInteger)limit
completionHandler:(void (^)(HKAnchoredObjectQuery *query,
NSArray<__kindof HKSample *> *results,
NSUInteger newAnchor,
NSError *error))handler NS_DEPRECATED_IOS(8_0, 9_0);
@end
#endif
@implementation ORKHealthQuantityTypeRecorder
@@ -67,7 +84,8 @@
_quantityType = quantityType;
_unit = unit;
self.continuesInBackground = YES;
_anchor = HKAnchoredObjectQueryNoAnchor;
_anchorValue = HKAnchoredObjectQueryNoAnchor;
_anchor = [HKQueryAnchor anchorFromValue:_anchorValue];
}
return self;
}
@@ -89,9 +107,9 @@
static const NSInteger _HealthAnchoredQueryLimit = 100;
- (void)query_logResults:(NSArray *)results withAnchor:(NSUInteger)newAnchor {
- (void)query_logResults:(NSArray *)results withAnchor:(HKQueryAnchor*)newAnchor anchorValue:(NSUInteger)anchorValue {
NSUInteger resultCount = [results count];
NSUInteger resultCount = results.count;
if (resultCount == 0) {
return;
}
@@ -103,16 +121,17 @@ static const NSInteger _HealthAnchoredQueryLimit = 100;
}];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateMostRecentSample:[results lastObject]];
[self updateMostRecentSample:results.lastObject];
NSError *error = nil;
if (! [_logger appendObjects:dictionaries error:&error]) {
if (![_logger appendObjects:dictionaries error:&error]) {
// Logger writes are unrecoverable
[self finishRecordingWithError:error];
return;
}
_anchor = newAnchor;
_anchorValue = anchorValue;
if (resultCount == _HealthAnchoredQueryLimit) {
// Do another fetch immediately rather than wait for an observation
@@ -122,45 +141,68 @@ static const NSInteger _HealthAnchoredQueryLimit = 100;
}
- (void)doFetchNewData {
if (! _healthStore || ! _isRecording) {
if (!_healthStore || !_isRecording) {
return;
}
NSAssert(_samplePredicate != nil, @"Sample predicate should be non-nil if recording");
__weak typeof(self) weakSelf = self;
HKAnchoredObjectQuery *anchoredQuery = [[HKAnchoredObjectQuery alloc]
initWithType:_quantityType
predicate:_samplePredicate
anchor:_anchor
limit:_HealthAnchoredQueryLimit
completionHandler:^(HKAnchoredObjectQuery *query, NSArray *results, NSUInteger newAnchor, NSError *error)
{
if (error) {
// An error in the query's not the end of the world: we'll probably get another chance. Just log it.
ORK_Log_Debug(@"Anchored query error: %@", error);
return;
}
__typeof(self) strongSelf = weakSelf;
[strongSelf query_logResults:results withAnchor:newAnchor];
}];
void (^handleResults)(NSArray <__kindof HKSample *> *, HKQueryAnchor *, NSUInteger, NSError *) = ^ (NSArray *results, HKQueryAnchor *newAnchor, NSUInteger newAnchorValue, NSError *error) {
if (error) {
// An error in the query's not the end of the world: we'll probably get another chance. Just log it.
ORK_Log_Warning(@"Anchored query error: %@", error);
return;
}
__typeof(self) strongSelf = weakSelf;
[strongSelf query_logResults:results withAnchor:newAnchor anchorValue:newAnchorValue];
};
HKAnchoredObjectQuery *anchoredQuery;
if ([HKAnchoredObjectQuery instancesRespondToSelector:@selector(initWithType:predicate:anchor:limit:resultsHandler:)]) {
anchoredQuery = [[HKAnchoredObjectQuery alloc] initWithType:_quantityType
predicate:_samplePredicate
anchor:_anchor
limit:_HealthAnchoredQueryLimit
resultsHandler:
^(HKAnchoredObjectQuery *query, NSArray *sampleObjects, NSArray *deletedObjects, HKQueryAnchor *newAnchor, NSError *error) {
handleResults(sampleObjects, newAnchor, 0, error);
}];
} else if ([HKAnchoredObjectQuery instancesRespondToSelector:@selector(initWithType:predicate:anchor:limit:completionHandler:)]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
anchoredQuery = [[HKAnchoredObjectQuery alloc] initWithType:_quantityType
predicate:_samplePredicate
anchor:_anchorValue
limit:_HealthAnchoredQueryLimit
completionHandler:
^(HKAnchoredObjectQuery *query, NSArray<__kindof HKSample *> *results, NSUInteger newAnchor, NSError *error) {
handleResults(results, nil, newAnchor, error);
}];
#pragma clang diagnostic pop
}
else {
NSAssert(NO, @"Could not instantiate an HKAnchoredObjectQuery.");
}
[_healthStore executeQuery:anchoredQuery];
}
- (void)start {
[super start];
if (! _logger) {
if (!_logger) {
NSError *err = nil;
_logger = [self makeJSONDataLoggerWithError:&err];
if (! _logger) {
if (!_logger) {
[self finishRecordingWithError:err];
return;
}
}
if (! [HKHealthStore isHealthDataAvailable]) {
if (![HKHealthStore isHealthDataAvailable]) {
[self finishRecordingWithError:[NSError errorWithDomain:NSCocoaErrorDomain
code:NSFeatureUnsupportedError
userInfo:@{@"recorder" : self}]];
@@ -178,16 +220,6 @@ static const NSInteger _HealthAnchoredQueryLimit = 100;
}
}
[_healthStore enableBackgroundDeliveryForType:_quantityType
frequency:HKUpdateFrequencyImmediate
withCompletion:^(BOOL success, NSError *error) {
// Doesn't really matter if this succeeds, but nice if it does.
if (! success) {
ORK_Log_Debug(@"Failed to enable background delivery: %@", error);
}
}];
_lastSample = nil;
_samplePredicate = [HKQuery predicateForSamplesWithStartDate:[NSDate date] endDate:nil options:HKQueryOptionStrictStartDate];
@@ -222,7 +254,7 @@ static const NSInteger _HealthAnchoredQueryLimit = 100;
}
- (void)stop {
if (! _isRecording) {
if (!_isRecording) {
return;
}
@@ -275,11 +307,6 @@ static const NSInteger _HealthAnchoredQueryLimit = 100;
@end
@interface ORKHealthQuantityTypeRecorderConfiguration ()
@end
@implementation ORKHealthQuantityTypeRecorderConfiguration
#pragma clang diagnostic push
@@ -0,0 +1,66 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKCustomStepView_Internal.h"
#import "ORKTypes.h"
NS_ASSUME_NONNULL_BEGIN
@protocol ORKHolePegTestPlaceContentViewDelegate;
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestPlaceContentView : ORKActiveStepCustomView
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
- (instancetype)initWithMovingDirection:(ORKBodySagittal)movingDirection rotated:(BOOL)rotated NS_DESIGNATED_INITIALIZER;
@property (nonatomic, assign) ORKBodySagittal movingDirection;
@property (nonatomic, assign) double threshold;
@property (nonatomic, assign, getter = isRotated) BOOL rotated;
@property (nonatomic, weak) id<ORKHolePegTestPlaceContentViewDelegate> delegate;
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;
@end
@protocol ORKHolePegTestPlaceContentViewDelegate <NSObject>
- (void)holePegTestPlaceDidProgress:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView;
- (void)holePegTestPlaceDidSucceed:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView withDistance:(CGFloat)distance;
- (void)holePegTestPlaceDidFail:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,399 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestPlaceContentView.h"
#import "ORKDirectionView.h"
#import "ORKHolePegTestPlaceHoleView.h"
#import "ORKHolePegTestPlacePegView.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
static const CGFloat ORKOrientationThreshold = 12.0f;
static const CGFloat ORKHolePegViewDiameter = 88.0f;
#define degreesToRadians(degrees) ((degrees) / 180.0 * M_PI)
@interface ORKHolePegTestPlaceContentView () <UIGestureRecognizerDelegate>
@property (nonatomic, strong) UIProgressView *progressView;
@property (nonatomic, strong) ORKHolePegTestPlacePegView *pegView;
@property (nonatomic, strong) ORKHolePegTestPlaceHoleView *holeView;
@property (nonatomic, strong) ORKDirectionView *directionView;
@property (nonatomic, copy) NSArray *constraints;
@property (nonatomic, strong) UIPinchGestureRecognizer *pinchRecognizer;
@property (nonatomic, strong) UIPanGestureRecognizer *panRecognizer;
@property (nonatomic, strong) UIRotationGestureRecognizer *rotationRecognizer;
@property (nonatomic, assign, getter = isMovable) BOOL movable;
@property (nonatomic, assign, getter = hasMoveEnded) BOOL moveEnded;
@property (nonatomic, assign) CGFloat rotation;
@property (nonatomic, assign) CGFloat rotationOffset;
@property (nonatomic, assign) CGPoint translation;
@property (nonatomic, assign) CGPoint translationOffset;
@property (nonatomic, assign) CGPoint startPoint;
@end
@implementation ORKHolePegTestPlaceContentView
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithFrame:(CGRect)frame {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithMovingDirection:(ORKBodySagittal)movingDirection rotated:(BOOL)rotated {
self = [super initWithFrame:CGRectZero];
if (self) {
self.movingDirection = movingDirection;
self.rotated = rotated;
self.progressView = [UIProgressView new];
self.progressView.progressTintColor = self.tintColor;
[self.progressView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.progressView setAlpha:0];
[self addSubview:self.progressView];
self.holeView = [[ORKHolePegTestPlaceHoleView alloc] initWithFrame:CGRectMake(0, 0, ORKHolePegViewDiameter, ORKHolePegViewDiameter)];
self.holeView.rotated = self.isRotated;
[self.holeView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:self.holeView];
self.pegView = [[ORKHolePegTestPlacePegView alloc] initWithFrame:CGRectMake(0, 0, ORKHolePegViewDiameter, ORKHolePegViewDiameter)];
self.pegView.rotated = self.isRotated;
[self.pegView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:self.pegView];
self.directionView = [[ORKDirectionView alloc] initWithOrientation:(self.movingDirection == ORKBodySagittalLeft) ? ORKBodySagittalRight : ORKBodySagittalLeft];
[self.directionView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:self.directionView];
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
[self setNeedsUpdateConstraints];
self.movable = NO;
self.moveEnded = NO;
self.startPoint = CGPointZero;
self.pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePinch:)];
self.pinchRecognizer.delegate = self;
[self addGestureRecognizer:self.pinchRecognizer];
self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePan:)];
self.panRecognizer.delegate = self;
[self addGestureRecognizer:self.panRecognizer];
if (rotated) {
self.rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self
action:@selector(handleRotate:)];
self.rotationRecognizer.delegate = self;
[self addGestureRecognizer:self.rotationRecognizer];
}
}
return self;
}
- (void)tintColorDidChange {
[super tintColorDidChange];
self.progressView.progressTintColor = self.tintColor;
}
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated {
[self.progressView setProgress:progress animated:animated];
[UIView animateWithDuration:animated ? 0.2 : 0 animations:^{
[self.progressView setAlpha:(progress == 0) ? 0 : 1];
}];
}
- (void)updateLayoutMargins {
CGFloat margin = ORKStandardHorizontalMarginForView(self);
self.layoutMargins = (UIEdgeInsets){.left = margin * 2, .right = margin * 2};
}
- (void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self updateLayoutMargins];
}
- (void)setBounds:(CGRect)bounds {
[super setBounds:bounds];
[self updateLayoutMargins];
}
- (void)updateConstraints {
if ([self.constraints count]) {
[NSLayoutConstraint deactivateConstraints:self.constraints];
self.constraints = nil;
}
NSMutableArray *constraintsArray = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_progressView, _pegView, _holeView, _directionView);
NSDictionary *metrics = @{@"diameter": @(ORKHolePegViewDiameter)};
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_progressView]-|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:(self.movingDirection == ORKBodySagittalLeft) ? @"H:|-[_pegView]->=0-[_holeView]-|" : @"H:|-[_holeView]->=0-[_pegView]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_progressView]"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|->=0-[_pegView(diameter)]->=0-|"
options:(NSLayoutFormatOptions)0
metrics:metrics views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|->=0-[_holeView]->=0-|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObject:[NSLayoutConstraint constraintWithItem:self.pegView
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterY
multiplier:1
constant:0]];
[constraintsArray addObject:[NSLayoutConstraint constraintWithItem:self.directionView
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1
constant:0]];
[constraintsArray addObject:[NSLayoutConstraint constraintWithItem:self.directionView
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterY
multiplier:1
constant:0]];
self.constraints = constraintsArray;
[self addConstraints:self.constraints];
[NSLayoutConstraint activateConstraints:self.constraints];
[super updateConstraints];
}
#pragma mark - gesture recognizer methods
- (void)pickupPegWithGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
CGPoint touch = [gestureRecognizer locationInView:self];
CGPoint touch1 = [gestureRecognizer locationOfTouch:0 inView:self];
CGPoint touch2 = [gestureRecognizer locationOfTouch:1 inView:self];
double distance = hypot(touch1.x - touch2.x, touch1.y - touch2.y);
if (distance < 3 * CGRectGetWidth(self.pegView.frame) &&
CGRectContainsPoint(self.pegView.frame, touch)) {
self.movable = YES;
} else {
self.movable = NO;
}
}
- (void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer {
if ([pinchGestureRecognizer numberOfTouches] == 2) {
[self pickupPegWithGestureRecognizer:pinchGestureRecognizer];
}
}
- (void)handlePan:(UIPanGestureRecognizer *)panGestureRecognizer {
if ([panGestureRecognizer numberOfTouches] != 2 ||
panGestureRecognizer.state == UIGestureRecognizerStateEnded ||
panGestureRecognizer.state == UIGestureRecognizerStateCancelled ||
panGestureRecognizer.state == UIGestureRecognizerStateFailed) {
[self resetTransformAtPoint:[panGestureRecognizer locationInView:self]];
} else {
if (self.isMovable) {
self.translation = CGPointMake([panGestureRecognizer translationInView:self].x - self.translationOffset.x,
[panGestureRecognizer translationInView:self].y - self.translationOffset.y);
[self updateTransformAtPoint:[panGestureRecognizer locationInView:self]];
} else {
self.translationOffset = CGPointMake([panGestureRecognizer translationInView:self].x - self.translation.x,
[panGestureRecognizer translationInView:self].y - self.translation.y);
if (CGPointEqualToPoint(self.startPoint, CGPointZero)) {
[self pickupPegWithGestureRecognizer:panGestureRecognizer];
}
}
}
}
- (void)handleRotate:(UIRotationGestureRecognizer *)rotationGestureRecognizer {
if ([rotationGestureRecognizer numberOfTouches] != 2 ||
rotationGestureRecognizer.state == UIGestureRecognizerStateEnded ||
rotationGestureRecognizer.state == UIGestureRecognizerStateCancelled ||
rotationGestureRecognizer.state == UIGestureRecognizerStateFailed) {
[self resetTransformAtPoint:[rotationGestureRecognizer locationInView:self]];
} else {
if (self.isMovable) {
self.rotation = rotationGestureRecognizer.rotation - self.rotationOffset;
[self updateTransformAtPoint:[rotationGestureRecognizer locationInView:self]];
} else {
self.rotationOffset = rotationGestureRecognizer.rotation - self.rotation;
}
}
}
- (void)updateTransformAtPoint:(CGPoint)point {
self.pegView.transform = CGAffineTransformMakeTranslation(self.translation.x, self.translation.y);
self.pegView.transform = CGAffineTransformRotate(self.pegView.transform, self.rotation);
[self pegViewDidMoveAtPoint:point];
}
- (void)resetTransformAtPoint:(CGPoint)point {
if (!self.hasMoveEnded) {
self.movable = NO;
self.moveEnded = YES;
self.pinchRecognizer.enabled = NO;
self.panRecognizer.enabled = NO;
self.rotationRecognizer.enabled = NO;
BOOL animated = ![self pegViewMoveDidEndAtPoint:point];
self.pegView.hidden = !animated;
[UIView animateWithDuration:animated ? 0.15f : 0.0f
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^(){
self.pegView.transform = CGAffineTransformIdentity;
self.pegView.alpha = 1.0f;
}
completion:^(BOOL finished){
self.rotation = 0.0f;
self.rotationOffset = 0.0f;
self.translation = CGPointZero;
self.translationOffset = CGPointZero;
self.pinchRecognizer.enabled = YES;
self.panRecognizer.enabled = YES;
self.rotationRecognizer.enabled = YES;
self.moveEnded = NO;
self.pegView.hidden = NO;
}];
}
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
#pragma mark - peg view delegate
- (void)pegViewDidMoveAtPoint:(CGPoint)point {
self.directionView.hidden = YES;
if (CGPointEqualToPoint(self.startPoint, CGPointZero)) {
self.startPoint = point;
}
if ([self.delegate respondsToSelector:@selector(holePegTestPlaceDidProgress:)]) {
[self.delegate holePegTestPlaceDidProgress:self];
}
if (self.holeView.isSuccess) {
self.holeView.success = NO;
}
if ([self holeViewContainsPegView]) {
self.pegView.alpha = 1.0f;
} else {
self.pegView.alpha = 0.2f;
}
}
- (BOOL)pegViewMoveDidEndAtPoint:(CGPoint)point {
self.directionView.hidden = NO;
BOOL succeeded = NO;
if ([self holeViewContainsPegView]) {
if ([self.delegate respondsToSelector:@selector(holePegTestPlaceDidSucceed:withDistance:)]) {
CGFloat distance = hypotf(point.x - self.startPoint.x, point.y - self.startPoint.y);
[self.delegate holePegTestPlaceDidSucceed:self withDistance:distance];
}
self.holeView.success = YES;
succeeded = YES;
} else {
if ([self.delegate respondsToSelector:@selector(holePegTestPlaceDidFail:)]) {
[self.delegate holePegTestPlaceDidFail:self];
}
self.holeView.success = NO;
}
self.startPoint = CGPointZero;
return succeeded;
}
- (BOOL)holeViewContainsPegView {
CGRect detectionFrame = CGRectMake(CGRectGetMidX(self.holeView.frame) - (self.threshold * CGRectGetWidth(self.holeView.frame) / 2),
CGRectGetMidY(self.holeView.frame) - (self.threshold * CGRectGetHeight(self.holeView.frame) / 2),
self.threshold * CGRectGetWidth(self.holeView.frame),
self.threshold * CGRectGetHeight(self.holeView.frame));
CGPoint pegCenter = CGPointMake(CGRectGetMaxX(self.pegView.frame) - CGRectGetWidth(self.pegView.frame) / 2,
CGRectGetMaxY(self.pegView.frame) - CGRectGetHeight(self.pegView.frame) / 2);
if (CGRectContainsPoint(detectionFrame, pegCenter)) {
if (self.isRotated) {
double rotation = atan2(self.pegView.transform.b, self.pegView.transform.a);
double angle = fmod(fabs(rotation), M_PI_2);
if (angle > M_PI_4 - degreesToRadians(ORKOrientationThreshold) &&
angle < M_PI_4 + degreesToRadians(ORKOrientationThreshold)) {
return YES;
}
} else {
return YES;
}
}
return NO;
}
@end
@@ -0,0 +1,46 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKDefines.h"
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestPlaceHoleView : UIView <CAAnimationDelegate>
@property (nonatomic, assign, getter = isRotated) BOOL rotated;
@property (nonatomic, assign, getter = isSuccess) BOOL success;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,173 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestPlaceHoleView.h"
#import "ORKHelpers_Internal.h"
static const CGFloat ORKPlaceHoleViewRotation = 45.0f;
@interface ORKHolePegTestPlaceHoleView ()
@property (nonatomic, strong) CAShapeLayer *checkLayer;
@property (nonatomic, strong) CAShapeLayer *crossLayer;
@end
@implementation ORKHolePegTestPlaceHoleView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIBezierPath *path = [[UIBezierPath alloc] init];
[path moveToPoint:CGPointMake(27.7f, 46.9f)];
[path addLineToPoint:CGPointMake(36.1f, 56.3f)];
[path addLineToPoint:CGPointMake(62.8f, 30.3f)];
path.lineCapStyle = kCGLineCapRound;
path.lineWidth = 3.6f;
CAShapeLayer *checkLayer = [CAShapeLayer new];
checkLayer.path = path.CGPath;
checkLayer.lineWidth = 3.6f;
checkLayer.lineCap = kCALineCapRound;
checkLayer.lineJoin = kCALineJoinRound;
checkLayer.frame = self.layer.bounds;
checkLayer.strokeColor = self.tintColor.CGColor;
checkLayer.backgroundColor = [UIColor clearColor].CGColor;
checkLayer.fillColor = nil;
self.checkLayer = checkLayer;
self.opaque = NO;
self.success = NO;
}
return self;
}
- (CGSize)intrinsicContentSize {
return CGSizeMake(self.frame.size.width, self.frame.size.height);
}
#pragma mark - drawing method
- (void)tintColorDidChange {
[super tintColorDidChange];
self.checkLayer.strokeColor = self.tintColor.CGColor;
[self setNeedsDisplay];
}
- (void)setSuccess:(BOOL)success
{
_success = success;
[self.checkLayer removeFromSuperlayer];
[self.crossLayer removeFromSuperlayer];
[self setNeedsDisplay];
}
- (void)setRotated:(BOOL)rotated
{
_rotated = rotated;
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGRect bounds = self.bounds;
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(bounds, 1.0f, 1.0f)];
path.lineWidth = 2.0f;
[self.tintColor setStroke];
[path stroke];
if (self.isSuccess) {
[self.layer addSublayer:self.checkLayer];
CAMediaTimingFunction *timing = [[CAMediaTimingFunction alloc] initWithControlPoints:0.180739998817444
:0
:0.577960014343262
:0.918200016021729];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
[animation setTimingFunction:timing];
[animation setFillMode:kCAFillModeBoth];
animation.fromValue = @(0);
animation.toValue = @(1);
animation.duration = 0.3f;
animation.delegate = self;
[self.checkLayer addAnimation:animation forKey:@"strokeEnd"];
} else if (self.isRotated) {
UIBezierPath *crossPath = [[UIBezierPath alloc] init];
[crossPath moveToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 1/4)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 7/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 1/4, CGRectGetHeight(bounds) * 7/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 1/4, CGRectGetHeight(bounds) * 9/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 9/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 3/4)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 3/4)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 9/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 3/4, CGRectGetHeight(bounds) * 9/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 3/4, CGRectGetHeight(bounds) * 7/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 7/16)];
[crossPath addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 1/4)];
[crossPath closePath];
CAShapeLayer *crossLayer = [[CAShapeLayer alloc] init];
crossLayer.path = crossPath.CGPath;
crossLayer.bounds = CGPathGetBoundingBox(crossLayer.path);
crossLayer.anchorPoint = CGPointMake(0.5, 0.5);
crossLayer.fillColor = self.tintColor.CGColor;
CATransform3D transform = CATransform3DMakeTranslation(CGRectGetMidX(bounds), CGRectGetMidY(bounds), 1);
transform = CATransform3DRotate(transform, ORKPlaceHoleViewRotation * (M_PI / 180), 0, 0, 1);
crossLayer.transform = transform;
self.crossLayer = crossLayer;
[self.layer addSublayer:self.crossLayer];
}
CGContextRestoreGState(context);
}
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {
ORKWeakTypeOf(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ORKStrongTypeOf(self) strongSelf = weakSelf;
strongSelf.success = NO;
});
}
@end
@@ -0,0 +1,45 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKDefines.h"
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestPlacePegView : UIView
@property (nonatomic, assign, getter = isRotated) BOOL rotated;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,93 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestPlacePegView.h"
@implementation ORKHolePegTestPlacePegView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.opaque = NO;
}
return self;
}
- (CGSize)intrinsicContentSize {
return CGSizeMake(self.frame.size.width, self.frame.size.height);
}
#pragma mark - drawing method
- (void)tintColorDidChange {
[super tintColorDidChange];
[self setNeedsDisplay];
}
- (void)setRotated:(BOOL)rotated
{
_rotated = rotated;
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGRect bounds = self.bounds;
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:bounds];
if (self.isRotated) {
[path moveToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 1/4)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 7/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 1/4, CGRectGetHeight(bounds) * 7/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 1/4, CGRectGetHeight(bounds) * 9/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 9/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 7/16, CGRectGetHeight(bounds) * 3/4)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 3/4)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 9/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 3/4, CGRectGetHeight(bounds) * 9/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 3/4, CGRectGetHeight(bounds) * 7/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 7/16)];
[path addLineToPoint:CGPointMake(CGRectGetWidth(bounds) * 9/16, CGRectGetHeight(bounds) * 1/4)];
[path closePath];
}
[self.tintColor setFill];
[path fill];
CGContextRestoreGState(context);
}
@end
@@ -0,0 +1,50 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestPlaceStep : ORKActiveStep
@property (nonatomic, assign) ORKBodySagittal movingDirection;
@property (nonatomic, assign, getter = isDominantHandTested) BOOL dominantHandTested;
@property (nonatomic, assign) NSInteger numberOfPegs;
@property (nonatomic, assign) double threshold;
@property (nonatomic, assign, getter = isRotated) BOOL rotated;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,136 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestPlaceStep.h"
#import "ORKHolePegTestPlaceStepViewController.h"
#import "ORKHelpers_Internal.h"
@implementation ORKHolePegTestPlaceStep
+ (Class)stepViewControllerClass {
return [ORKHolePegTestPlaceStepViewController class];
}
- (instancetype)initWithIdentifier:(NSString *)identifier {
self = [super initWithIdentifier:identifier];
if (self) {
self.shouldShowDefaultTimer = NO;
self.shouldContinueOnFinish = YES;
}
return self;
}
- (void)validateParameters {
[super validateParameters];
int const ORKHolePegTestMinimumNumberOfPegs = 1;
double const ORKHolePegTestMinimumThreshold = 0.0f;
double const ORKHolePegTestMaximumThreshold = 1.0f;
NSTimeInterval const ORKHolePegTestMinimumDuration = 1.0f;
if (self.movingDirection != ORKBodySagittalLeft &&
self.movingDirection != ORKBodySagittalRight) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"moving direction should be left or right."] userInfo:nil];
}
if (self.numberOfPegs < ORKHolePegTestMinimumNumberOfPegs) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"number of pegs must be greater than or equal to %@.", @(ORKHolePegTestMinimumNumberOfPegs)] userInfo:nil];
}
if (self.threshold < ORKHolePegTestMinimumThreshold ||
self.threshold > ORKHolePegTestMaximumThreshold) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"threshold must be greater than or equal to %@ and lower or equal to %@.", @(ORKHolePegTestMinimumThreshold), @(ORKHolePegTestMaximumThreshold)] userInfo:nil];
}
if (self.stepDuration < ORKHolePegTestMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration cannot be shorter than %@ seconds.", @(ORKHolePegTestMinimumDuration)] userInfo:nil];
}
}
- (BOOL)allowsBackNavigation {
return NO;
}
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_ENUM(aDecoder, movingDirection);
ORK_DECODE_BOOL(aDecoder, dominantHandTested);
ORK_DECODE_INTEGER(aDecoder, numberOfPegs);
ORK_DECODE_DOUBLE(aDecoder, threshold);
ORK_DECODE_BOOL(aDecoder, rotated);
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
ORK_ENCODE_ENUM(aCoder, movingDirection);
ORK_ENCODE_BOOL(aCoder, dominantHandTested);
ORK_ENCODE_INTEGER(aCoder, numberOfPegs);
ORK_ENCODE_DOUBLE(aCoder, threshold);
ORK_ENCODE_BOOL(aCoder, rotated);
}
- (instancetype)copyWithZone:(NSZone *)zone {
__typeof(self) step = [super copyWithZone:zone];
step.movingDirection = self.movingDirection;
step.dominantHandTested = self.dominantHandTested;
step.numberOfPegs = self.numberOfPegs;
step.threshold = self.threshold;
step.rotated = self.rotated;
return step;
}
- (NSUInteger)hash {
return [super hash] ^ self.movingDirection ^ self.dominantHandTested ^ self.numberOfPegs ^ (NSInteger)(self.threshold * 100) ^ self.rotated;
}
- (BOOL)isEqual:(id)object {
BOOL isParentSame = [super isEqual:object];
__typeof(self) castObject = object;
return (isParentSame &&
(self.movingDirection == castObject.movingDirection) &&
(self.dominantHandTested == castObject.dominantHandTested) &&
(self.numberOfPegs == castObject.numberOfPegs) &&
(self.threshold == castObject.threshold) &&
(self.rotated == castObject.rotated));
}
@end
@@ -0,0 +1,44 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestPlaceStepViewController : ORKActiveStepViewController
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,181 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestPlaceStepViewController.h"
#import "ORKActiveStepView.h"
#import "ORKHolePegTestPlaceContentView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKStepViewController_Internal.h"
#import "ORKTaskViewController.h"
#import "ORKHolePegTestPlaceStep.h"
#import "ORKNavigableOrderedTask.h"
#import "ORKResult.h"
#import "ORKHelpers_Internal.h"
@interface ORKHolePegTestPlaceStepViewController () <ORKHolePegTestPlaceContentViewDelegate>
@property (nonatomic, strong) NSMutableArray *samples;
@property (nonatomic, strong) ORKHolePegTestPlaceContentView *holePegTestPlaceContentView;
@property (nonatomic, assign) NSTimeInterval sampleStart;
@property (nonatomic, assign) NSUInteger successes;
@property (nonatomic, assign) NSUInteger failures;
@end
@implementation ORKHolePegTestPlaceStepViewController
- (instancetype)initWithStep:(ORKStep *)step {
self = [super initWithStep:step];
if (self) {
self.suspendIfInactive = YES;
}
return self;
}
- (ORKHolePegTestPlaceStep *)holePegTestPlaceStep {
return (ORKHolePegTestPlaceStep *)self.step;
}
- (void)initializeInternalButtonItems {
[super initializeInternalButtonItems];
// Don't show next button
self.internalContinueButtonItem = nil;
self.internalDoneButtonItem = nil;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.holePegTestPlaceContentView = [[ORKHolePegTestPlaceContentView alloc] initWithMovingDirection:[self holePegTestPlaceStep].movingDirection
rotated:[self holePegTestPlaceStep].rotated];
self.holePegTestPlaceContentView.threshold = [self holePegTestPlaceStep].threshold;
self.holePegTestPlaceContentView.delegate = self;
self.activeStepView.activeCustomView = self.holePegTestPlaceContentView;
self.activeStepView.stepViewFillsAvailableSpace = YES;
}
#pragma mark - step life cycle methods
- (void)start {
self.successes = 0;
self.failures = 0;
self.samples = [NSMutableArray array];
[self.holePegTestPlaceContentView setProgress:0.001f animated:NO];
[super start];
}
#pragma mark - result methods
- (ORKStepResult *)result {
ORKStepResult *sResult = [super result];
NSMutableArray *results = [NSMutableArray arrayWithArray:sResult.results];
ORKHolePegTestResult *holePegTestResult = [[ORKHolePegTestResult alloc] initWithIdentifier:self.step.identifier];
holePegTestResult.movingDirection = [self holePegTestPlaceStep].movingDirection;
holePegTestResult.dominantHandTested = [self holePegTestPlaceStep].isDominantHandTested;
holePegTestResult.numberOfPegs = [self holePegTestPlaceStep].numberOfPegs;
holePegTestResult.threshold = [self holePegTestPlaceStep].threshold;
holePegTestResult.rotated = [self holePegTestPlaceStep].isRotated;
holePegTestResult.totalSuccesses = self.successes;
holePegTestResult.totalFailures = self.failures;
holePegTestResult.totalTime = [self holePegTestPlaceStep].stepDuration - self.timeRemaining;
double totalDistance = 0.0;
for (ORKHolePegTestSample *sample in self.samples) {
totalDistance += sample.distance;
}
holePegTestResult.totalDistance = totalDistance;
holePegTestResult.samples = self.samples;
[results addObject:holePegTestResult];
sResult.results = [results copy];
return sResult;
}
- (void)saveSampleWithDistance:(CGFloat)distance {
ORKHolePegTestSample *sample = [[ORKHolePegTestSample alloc] init];
sample.time = CACurrentMediaTime() - self.sampleStart;
sample.distance = distance;
self.sampleStart = CACurrentMediaTime();
[self.samples addObject:sample];
}
#pragma mark - hole peg test content view delegate
- (NSString *)stepTitle {
NSString *title = ([self holePegTestPlaceStep].movingDirection == ORKBodySagittalLeft) ? ORKLocalizedString(@"HOLE_PEG_TEST_PLACE_INSTRUCTION_LEFT_HAND", nil) : ORKLocalizedString(@"HOLE_PEG_TEST_PLACE_INSTRUCTION_RIGHT_HAND", nil);
return title;
}
- (void)holePegTestPlaceDidProgress:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView {
if (!self.isStarted) {
self.sampleStart = CACurrentMediaTime();
[self start];
}
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT_2", nil)];
}
- (void)holePegTestPlaceDidSucceed:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView withDistance:(CGFloat)distance {
self.successes++;
[self saveSampleWithDistance:distance];
[holePegTestPlaceContentView setProgress:((CGFloat)self.successes / [self holePegTestPlaceStep].numberOfPegs) animated:YES];
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT", nil)];
if (self.successes >= [self holePegTestPlaceStep].numberOfPegs) {
[((ORKNavigableOrderedTask *)self.taskViewController.task) removeNavigationRuleForTriggerStepIdentifier:[self holePegTestPlaceStep].identifier];
[self finish];
}
}
- (void)holePegTestPlaceDidFail:(ORKHolePegTestPlaceContentView *)holePegTestPlaceContentView {
self.failures++;
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT", nil)];
}
@end
@@ -0,0 +1,65 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKCustomStepView_Internal.h"
#import "ORKTypes.h"
NS_ASSUME_NONNULL_BEGIN
@protocol ORKHolePegTestRemoveContentViewDelegate;
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestRemoveContentView : ORKActiveStepCustomView
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
- (instancetype)initWithMovingDirection:(ORKBodySagittal)movingDirection NS_DESIGNATED_INITIALIZER;
@property (nonatomic, assign) ORKBodySagittal movingDirection;
@property (nonatomic, assign) double threshold;
@property (nonatomic, weak) id<ORKHolePegTestRemoveContentViewDelegate> delegate;
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;
@end
@protocol ORKHolePegTestRemoveContentViewDelegate <NSObject>
- (void)holePegTestRemoveDidProgress:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView;
- (void)holePegTestRemoveDidSucceed:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView withDistance:(CGFloat)distance;
- (void)holePegTestRemoveDidFail:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,358 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestRemoveContentView.h"
#import "ORKDirectionView.h"
#import "ORKHolePegTestRemovePegView.h"
#import "ORKSeparatorView.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
static const CGFloat PegViewDiameter = 88.0f;
static const CGFloat PegViewSeparatorWidth = 2.0f;
@interface ORKHolePegTestRemoveContentView () <UIGestureRecognizerDelegate>
@property (nonatomic, strong) UIProgressView *progressView;
@property (nonatomic, strong) ORKHolePegTestRemovePegView *pegView;
@property (nonatomic, strong) ORKSeparatorView *separatorView;
@property (nonatomic, strong) ORKDirectionView *directionView;
@property (nonatomic, strong) UIView *container;
@property (nonatomic, copy) NSArray *constraints;
@property (nonatomic, strong) UIPinchGestureRecognizer *pinchRecognizer;
@property (nonatomic, strong) UIPanGestureRecognizer *panRecognizer;
@property (nonatomic, assign, getter = isMovable) BOOL movable;
@property (nonatomic, assign, getter = hasMoveEnded) BOOL moveEnded;
@property (nonatomic, assign) CGPoint translation;
@property (nonatomic, assign) CGPoint translationOffset;
@property (nonatomic, assign) CGPoint startPoint;
@end
@implementation ORKHolePegTestRemoveContentView
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithFrame:(CGRect)frame {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithMovingDirection:(ORKBodySagittal)movingDirection {
self = [super initWithFrame:CGRectZero];
if (self) {
self.movingDirection = movingDirection;
self.opaque = NO;
self.container = [UIView new];
self.container.translatesAutoresizingMaskIntoConstraints = NO;
self.progressView = [UIProgressView new];
self.progressView.progressTintColor = self.tintColor;
[self.progressView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.progressView setAlpha:0];
[self addSubview:self.progressView];
self.pegView = [[ORKHolePegTestRemovePegView alloc] initWithFrame:CGRectMake(0, 0, PegViewDiameter, PegViewDiameter)];
[self.pegView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.container addSubview:self.pegView];
self.separatorView = [[ORKSeparatorView alloc] init];
[self.separatorView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.container addSubview:self.separatorView];
self.directionView = [[ORKDirectionView alloc] initWithOrientation:(self.movingDirection == ORKBodySagittalLeft) ? ORKBodySagittalRight : ORKBodySagittalLeft];
[self.directionView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:self.directionView];
[self addSubview:self.container];
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
[self setNeedsUpdateConstraints];
self.movable = NO;
self.moveEnded = NO;
self.startPoint = CGPointZero;
self.pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePinch:)];
self.pinchRecognizer.delegate = self;
[self addGestureRecognizer:self.pinchRecognizer];
self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePan:)];
self.panRecognizer.delegate = self;
[self addGestureRecognizer:self.panRecognizer];
}
return self;
}
- (void)tintColorDidChange {
[super tintColorDidChange];
self.progressView.progressTintColor = self.tintColor;
}
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated {
[self.progressView setProgress:progress animated:animated];
[UIView animateWithDuration:animated ? 0.2 : 0 animations:^{
[self.progressView setAlpha:(progress == 0) ? 0 : 1];
}];
}
- (void)updateLayoutMargins {
CGFloat margin = ORKStandardHorizontalMarginForView(self);
self.layoutMargins = (UIEdgeInsets){.left = margin * 2, .right = margin * 2};
}
- (void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self updateLayoutMargins];
}
- (void)setBounds:(CGRect)bounds {
[super setBounds:bounds];
[self updateLayoutMargins];
}
- (void)updateConstraints {
if ([self.constraints count]) {
[NSLayoutConstraint deactivateConstraints:self.constraints];
self.constraints = nil;
}
NSMutableArray *constraintsArray = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_progressView, _container, _pegView, _separatorView, _directionView);
NSDictionary *metrics = @{@"diameter": @(PegViewDiameter), @"separator": @(PegViewSeparatorWidth), @"margin": @((1 + self.threshold) * PegViewDiameter)};
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_progressView]-|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:(self.movingDirection == ORKBodySagittalLeft) ? @"H:|-[_pegView(diameter)]->=0-[_separatorView(separator)]-(margin)-|" : @"H:|-(margin)-[_separatorView(separator)]->=0-[_pegView(diameter)]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:metrics views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_container]|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=0)-[_pegView(diameter)]-(>=0)-|"
options:(NSLayoutFormatOptions)0
metrics:metrics views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[_separatorView]-|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[constraintsArray addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_progressView][_container]|"
options:(NSLayoutFormatOptions)0
metrics:metrics views:views]];
[constraintsArray addObject:[NSLayoutConstraint constraintWithItem:self.directionView
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterX
multiplier:1
constant:0]];
[constraintsArray addObject:[NSLayoutConstraint constraintWithItem:self.directionView
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self
attribute:NSLayoutAttributeCenterY
multiplier:1
constant:0]];
self.constraints = constraintsArray;
[self addConstraints:self.constraints];
[NSLayoutConstraint activateConstraints:self.constraints];
[super updateConstraints];
}
#pragma mark - gesture recognizer methods
- (void)pickupPegWithGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer {
CGPoint touch = [gestureRecognizer locationInView:self];
CGPoint touch1 = [gestureRecognizer locationOfTouch:0 inView:self];
CGPoint touch2 = [gestureRecognizer locationOfTouch:1 inView:self];
double distance = hypot(touch1.x - touch2.x, touch1.y - touch2.y);
if (distance < 3 * CGRectGetWidth(self.pegView.frame) &&
CGRectContainsPoint(self.pegView.frame, touch)) {
self.movable = YES;
} else {
self.movable = NO;
}
}
- (void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer {
if ([pinchGestureRecognizer numberOfTouches] == 2) {
[self pickupPegWithGestureRecognizer:pinchGestureRecognizer];
}
}
- (void)handlePan:(UIPanGestureRecognizer *)panGestureRecognizer {
if ([panGestureRecognizer numberOfTouches] != 2 ||
panGestureRecognizer.state == UIGestureRecognizerStateEnded ||
panGestureRecognizer.state == UIGestureRecognizerStateCancelled ||
panGestureRecognizer.state == UIGestureRecognizerStateFailed) {
[self resetTransformAtPoint:[panGestureRecognizer locationInView:self]];
} else {
if (self.isMovable) {
self.translation = CGPointMake([panGestureRecognizer translationInView:self].x - self.translationOffset.x,
[panGestureRecognizer translationInView:self].y - self.translationOffset.y);
[self updateTransformAtPoint:[panGestureRecognizer locationInView:self]];
} else {
self.translationOffset = CGPointMake([panGestureRecognizer translationInView:self].x - self.translation.x,
[panGestureRecognizer translationInView:self].y - self.translation.y);
if (CGPointEqualToPoint(self.startPoint, CGPointZero)) {
[self pickupPegWithGestureRecognizer:panGestureRecognizer];
}
}
}
}
- (void)updateTransformAtPoint:(CGPoint)point {
self.pegView.transform = CGAffineTransformMakeTranslation(self.translation.x, self.translation.y);
[self pegViewDidMoveAtPoint:point];
}
- (void)resetTransformAtPoint:(CGPoint)point {
if (!self.hasMoveEnded) {
self.movable = NO;
self.moveEnded = YES;
self.pinchRecognizer.enabled = NO;
self.panRecognizer.enabled = NO;
BOOL animated = ![self pegViewMoveDidEndAtPoint:point];
[UIView animateWithDuration:animated ? 0.15f : 0.0f
delay:animated ? 0.0f : 0.30f
options:UIViewAnimationOptionCurveEaseOut
animations:^(){
self.pegView.transform = CGAffineTransformIdentity;
self.pegView.alpha = 1.0f;
}
completion:^(BOOL finished){
self.translation = CGPointZero;
self.translationOffset = CGPointZero;
self.pinchRecognizer.enabled = YES;
self.panRecognizer.enabled = YES;
self.moveEnded = NO;
self.pegView.hidden = NO;
}];
}
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
#pragma mark - peg view delegate
- (void)pegViewDidMoveAtPoint:(CGPoint)point {
self.directionView.hidden = YES;
if (CGPointEqualToPoint(self.startPoint, CGPointZero)) {
self.startPoint = point;
}
if ([self.delegate respondsToSelector:@selector(holePegTestRemoveDidProgress:)]) {
[self.delegate holePegTestRemoveDidProgress:self];
}
if (self.pegView.isSuccess) {
self.pegView.success = NO;
}
if ([self pegViewBehindLine]) {
self.pegView.alpha = 1.0f;
} else {
self.pegView.alpha = 0.2f;
}
}
- (BOOL)pegViewMoveDidEndAtPoint:(CGPoint)point {
self.directionView.hidden = NO;
BOOL succeeded = NO;
if ([self pegViewBehindLine]) {
if ([self.delegate respondsToSelector:@selector(holePegTestRemoveDidSucceed:withDistance:)]) {
CGFloat distance = hypotf(point.x - self.startPoint.x, point.y - self.startPoint.y);
[self.delegate holePegTestRemoveDidSucceed:self withDistance:distance];
}
self.pegView.success = YES;
succeeded = YES;
} else {
if ([self.delegate respondsToSelector:@selector(holePegTestRemoveDidFail:)]) {
[self.delegate holePegTestRemoveDidFail:self];
}
self.pegView.success = NO;
}
self.startPoint = CGPointZero;
return succeeded;
}
- (BOOL)pegViewBehindLine {
if (self.movingDirection == ORKBodySagittalLeft) {
if (CGRectGetMinX(self.pegView.frame) > CGRectGetMaxX(self.separatorView.frame)) {
return YES;
} else {
return NO;
}
} else {
if (CGRectGetMaxX(self.pegView.frame) < CGRectGetMinX(self.separatorView.frame)) {
return YES;
} else {
return NO;
}
}
}
@end
@@ -0,0 +1,45 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKDefines.h"
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestRemovePegView : UIView <CAAnimationDelegate>
@property (nonatomic, assign, getter = isSuccess) BOOL success;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,122 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestRemovePegView.h"
@interface ORKHolePegTestRemovePegView ()
@property (nonatomic, strong) CAShapeLayer *checkLayer;
@end
@implementation ORKHolePegTestRemovePegView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIBezierPath *path = [[UIBezierPath alloc] init];
[path moveToPoint:CGPointMake(27.7f, 46.9f)];
[path addLineToPoint:CGPointMake(36.1f, 56.3f)];
[path addLineToPoint:CGPointMake(62.8f, 30.3f)];
path.lineCapStyle = kCGLineCapRound;
path.lineWidth = 3.6f;
CAShapeLayer *checkLayer = [CAShapeLayer new];
checkLayer.path = path.CGPath;
checkLayer.lineWidth = 3.6f;
checkLayer.lineCap = kCALineCapRound;
checkLayer.lineJoin = kCALineJoinRound;
checkLayer.frame = self.layer.bounds;
checkLayer.strokeColor = [UIColor whiteColor].CGColor;
checkLayer.backgroundColor = [UIColor clearColor].CGColor;
checkLayer.fillColor = nil;
self.checkLayer = checkLayer;
self.opaque = NO;
self.success = NO;
}
return self;
}
- (void)tintColorDidChange {
[super tintColorDidChange];
[self setNeedsDisplay];
}
#pragma mark - drawing method
- (void)setSuccess:(BOOL)success
{
_success = success;
[self.checkLayer removeFromSuperlayer];
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGRect bounds = self.bounds;
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:bounds];
path.lineWidth = 2.0f;
[self.tintColor setFill];
[path fill];
if (self.isSuccess) {
[self.layer addSublayer:self.checkLayer];
CAMediaTimingFunction *timing = [[CAMediaTimingFunction alloc] initWithControlPoints:0.180739998817444
:0
:0.577960014343262
:0.918200016021729];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
[animation setTimingFunction:timing];
[animation setFillMode:kCAFillModeBoth];
animation.fromValue = @(0);
animation.toValue = @(1);
animation.duration = 0.25f;
animation.delegate = self;
[self.checkLayer addAnimation:animation forKey:@"strokeEnd"];
}
CGContextRestoreGState(context);
}
- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag {
self.success = NO;
}
@end
@@ -0,0 +1,49 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestRemoveStep : ORKActiveStep
@property (nonatomic, assign) ORKBodySagittal movingDirection;
@property (nonatomic, assign, getter = isDominantHandTested) BOOL dominantHandTested;
@property (nonatomic, assign) NSInteger numberOfPegs;
@property (nonatomic, assign) double threshold;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,134 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestRemoveStep.h"
#import "ORKHolePegTestRemoveStepViewController.h"
#import "ORKHelpers_Internal.h"
@implementation ORKHolePegTestRemoveStep
+ (Class)stepViewControllerClass {
return [ORKHolePegTestRemoveStepViewController class];
}
- (instancetype)initWithIdentifier:(NSString *)identifier {
self = [super initWithIdentifier:identifier];
if (self) {
self.shouldShowDefaultTimer = NO;
self.shouldContinueOnFinish = YES;
}
return self;
}
- (void)validateParameters {
[super validateParameters];
int const ORKHolePegTestMinimumNumberOfPegs = 1;
double const ORKHolePegTestMinimumThreshold = 0.0f;
double const ORKHolePegTestMaximumThreshold = 1.0f;
NSTimeInterval const ORKHolePegTestMinimumDuration = 1.0f;
if (self.movingDirection != ORKBodySagittalLeft &&
self.movingDirection != ORKBodySagittalRight) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"moving direction should be left or right."] userInfo:nil];
}
if (self.numberOfPegs < ORKHolePegTestMinimumNumberOfPegs) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"number of pegs must be greater than or equal to %@.", @(ORKHolePegTestMinimumNumberOfPegs)] userInfo:nil];
}
if (self.threshold < ORKHolePegTestMinimumThreshold ||
self.threshold > ORKHolePegTestMaximumThreshold) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"threshold must be greater than or equal to %@ and lower or equal to %@.", @(ORKHolePegTestMinimumThreshold), @(ORKHolePegTestMaximumThreshold)] userInfo:nil];
}
if (self.stepDuration < ORKHolePegTestMinimumDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"duration cannot be shorter than %@ seconds.", @(ORKHolePegTestMinimumDuration)] userInfo:nil];
}
}
- (BOOL)allowsBackNavigation {
return NO;
}
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_ENUM(aDecoder, movingDirection);
ORK_DECODE_BOOL(aDecoder, dominantHandTested);
ORK_DECODE_INTEGER(aDecoder, numberOfPegs);
ORK_DECODE_DOUBLE(aDecoder, threshold);
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
ORK_ENCODE_ENUM(aCoder, movingDirection);
ORK_ENCODE_BOOL(aCoder, dominantHandTested);
ORK_ENCODE_INTEGER(aCoder, numberOfPegs);
ORK_ENCODE_DOUBLE(aCoder, threshold);
}
- (instancetype)copyWithZone:(NSZone *)zone {
__typeof(self) step = [super copyWithZone:zone];
step.movingDirection = self.movingDirection;
step.dominantHandTested = self.dominantHandTested;
step.numberOfPegs = self.numberOfPegs;
step.threshold = self.threshold;
return step;
}
- (NSUInteger)hash {
return [super hash] ^ self.movingDirection ^ self.dominantHandTested ^ self.numberOfPegs ^ (NSInteger)(self.threshold * 100);
}
- (BOOL)isEqual:(id)object {
BOOL isParentSame = [super isEqual:object];
__typeof(self) castObject = object;
return (isParentSame &&
(self.movingDirection == castObject.movingDirection) &&
(self.dominantHandTested == castObject.dominantHandTested) &&
(self.numberOfPegs == castObject.numberOfPegs) &&
(self.threshold == castObject.threshold));
}
@end
@@ -0,0 +1,44 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKHolePegTestRemoveStepViewController : ORKActiveStepViewController
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,180 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKHolePegTestRemoveStepViewController.h"
#import "ORKActiveStepView.h"
#import "ORKHolePegTestRemoveContentView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKStepViewController_Internal.h"
#import "ORKTaskViewController.h"
#import "ORKHolePegTestRemoveStep.h"
#import "ORKHelpers_Internal.h"
#import "ORKResult.h"
@interface ORKHolePegTestRemoveStepViewController () <ORKHolePegTestRemoveContentViewDelegate>
@property (nonatomic, strong) NSMutableArray *samples;
@property (nonatomic, strong) ORKHolePegTestRemoveContentView *holePegTestRemoveContentView;
@property (nonatomic, assign) NSTimeInterval sampleStart;
@property (nonatomic, assign) NSUInteger successes;
@property (nonatomic, assign) NSUInteger failures;
@end
@implementation ORKHolePegTestRemoveStepViewController
- (instancetype)initWithStep:(ORKStep *)step {
self = [super initWithStep:step];
if (self) {
self.suspendIfInactive = YES;
}
return self;
}
- (ORKHolePegTestRemoveStep *)holePegTestRemoveStep {
return (ORKHolePegTestRemoveStep *)self.step;
}
- (void)initializeInternalButtonItems {
[super initializeInternalButtonItems];
// Don't show next button
self.internalContinueButtonItem = nil;
self.internalDoneButtonItem = nil;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.holePegTestRemoveContentView = [[ORKHolePegTestRemoveContentView alloc] initWithMovingDirection:[self holePegTestRemoveStep].movingDirection];
self.holePegTestRemoveContentView.threshold = [self holePegTestRemoveStep].threshold;
self.holePegTestRemoveContentView.delegate = self;
self.activeStepView.activeCustomView = self.holePegTestRemoveContentView;
self.activeStepView.stepViewFillsAvailableSpace = YES;
NSString *identifier = [[self holePegTestRemoveStep].identifier stringByReplacingOccurrencesOfString:@"remove" withString:@"place"];
NSTimeInterval placeStepDuration = ((ORKHolePegTestResult *)[[self.taskViewController.result stepResultForStepIdentifier:identifier].results firstObject]).totalTime;
[self holePegTestRemoveStep].stepDuration -= placeStepDuration;
[self start];
}
#pragma mark - step life cycle methods
- (void)start {
self.sampleStart = CACurrentMediaTime();
self.successes = 0;
self.failures = 0;
self.samples = [NSMutableArray array];
[self.holePegTestRemoveContentView setProgress:0.001f animated:NO];
[super start];
}
#pragma mark - result methods
- (ORKStepResult *)result {
ORKStepResult *sResult = [super result];
NSMutableArray *results = [NSMutableArray arrayWithArray:sResult.results];
ORKHolePegTestResult *holePegTestResult = [[ORKHolePegTestResult alloc] initWithIdentifier:self.step.identifier];
holePegTestResult.movingDirection = [self holePegTestRemoveStep].movingDirection;
holePegTestResult.dominantHandTested = [self holePegTestRemoveStep].isDominantHandTested;
holePegTestResult.numberOfPegs = [self holePegTestRemoveStep].numberOfPegs;
holePegTestResult.threshold = [self holePegTestRemoveStep].threshold;
holePegTestResult.rotated = NO;
holePegTestResult.totalSuccesses = self.successes;
holePegTestResult.totalFailures = self.failures;
holePegTestResult.totalTime = [self holePegTestRemoveStep].stepDuration - self.timeRemaining;
double totalDistance = 0.0;
for (ORKHolePegTestSample *sample in self.samples) {
totalDistance += sample.distance;
}
holePegTestResult.totalDistance = totalDistance;
holePegTestResult.samples = self.samples;
[results addObject:holePegTestResult];
sResult.results = [results copy];
return sResult;
}
- (void)saveSampleWithDistance:(CGFloat)distance {
ORKHolePegTestSample *sample = [[ORKHolePegTestSample alloc] init];
sample.time = CACurrentMediaTime() - self.sampleStart;
sample.distance = distance;
self.sampleStart = CACurrentMediaTime();
[self.samples addObject:sample];
}
#pragma mark - hole peg test content view delegate
- (NSString *)stepTitle {
NSString *title = ([self holePegTestRemoveStep].movingDirection == ORKBodySagittalLeft) ? ORKLocalizedString(@"HOLE_PEG_TEST_REMOVE_INSTRUCTION_RIGHT_HAND", nil) : ORKLocalizedString(@"HOLE_PEG_TEST_REMOVE_INSTRUCTION_LEFT_HAND", nil);
return title;
}
- (void)holePegTestRemoveDidProgress:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView {
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT_2", nil)];
}
- (void)holePegTestRemoveDidSucceed:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView withDistance:(CGFloat)distance {
self.successes++;
[self saveSampleWithDistance:distance];
[holePegTestRemoveContentView setProgress:((CGFloat)self.successes / [self holePegTestRemoveStep].numberOfPegs) animated:YES];
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT", nil)];
if (self.successes >= [self holePegTestRemoveStep].numberOfPegs) {
[self finish];
}
}
- (void)holePegTestRemoveDidFail:(ORKHolePegTestRemoveContentView *)holePegTestRemoveContentView {
self.failures++;
[self.activeStepView updateTitle:[self stepTitle]
text:ORKLocalizedString(@"HOLE_PEG_TEST_TEXT", nil)];
}
@end
@@ -29,6 +29,8 @@
*/
@import UIKit;
@import CoreLocation;
#import <ResearchKit/ORKRecorder.h>
@@ -58,6 +60,12 @@ ORK_CLASS_AVAILABLE
step:(nullable ORKStep *)step
outputDirectory:(nullable NSURL *)outputDirectory NS_DESIGNATED_INITIALIZER;
/**
The location manager, if any, being used by this recorder.
*/
@property (nonatomic, strong, nullable, readonly) CLLocationManager *locationManager;
@end
NS_ASSUME_NONNULL_END
+16 -18
View File
@@ -30,11 +30,14 @@
#import "ORKLocationRecorder.h"
#import <CoreLocation/CoreLocation.h>
#import "CLLocation+ORKJSONDictionary.h"
#import "ORKDataLogger.h"
#import "ORKRecorder_Internal.h"
#import "ORKRecorder_Private.h"
#import "CLLocation+ORKJSONDictionary.h"
#import <CoreLocation/CoreLocation.h>
@interface ORKLocationRecorder () <CLLocationManagerDelegate> {
@@ -43,7 +46,7 @@
BOOL _started;
}
@property (nonatomic, strong) CLLocationManager *locationManager;
@property (nonatomic, strong, nullable) CLLocationManager *locationManager;
@property (nonatomic) NSTimeInterval uptime;
@@ -75,11 +78,11 @@
- (void)start {
[super start];
if (! _logger) {
NSError *err = nil;
_logger = [self makeJSONDataLoggerWithError:&err];
if (! _logger) {
[self finishRecordingWithError:err];
if (!_logger) {
NSError *error = nil;
_logger = [self makeJSONDataLoggerWithError:&error];
if (!_logger) {
[self finishRecordingWithError:error];
return;
}
}
@@ -91,10 +94,10 @@
self.locationManager.pausesLocationUpdatesAutomatically = NO;
self.locationManager.delegate = self;
if (! self.locationManager) {
if (!self.locationManager) {
NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain
code:NSFeatureUnsupportedError
userInfo:@{@"recorder" : self}];
userInfo:@{@"recorder": self}];
[self finishRecordingWithError:error];
return;
}
@@ -128,10 +131,10 @@
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations {
BOOL success = YES;
NSParameterAssert([locations count] >= 0);
NSParameterAssert(locations.count >= 0);
NSError *error = nil;
if (locations) {
NSMutableArray *dictionaries = [NSMutableArray arrayWithCapacity:[locations count]];
NSMutableArray *dictionaries = [NSMutableArray arrayWithCapacity:locations.count];
[locations enumerateObjectsUsingBlock:^(CLLocation *obj, NSUInteger idx, BOOL *stop) {
NSDictionary *d = [obj ork_JSONDictionary];
[dictionaries addObject:d];
@@ -169,11 +172,6 @@
@end
@interface ORKLocationRecorderConfiguration ()
@end
@implementation ORKLocationRecorderConfiguration
- (instancetype)initWithIdentifier:(NSString *)identifier {
@@ -0,0 +1,53 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKTypes.h"
#import "ORKCustomStepView_Internal.h"
NS_ASSUME_NONNULL_BEGIN
@class ORKPSATKeyboardView;
@interface ORKPSATContentView : ORKActiveStepCustomView
@property (nonatomic, strong) ORKPSATKeyboardView *keyboardView;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
- (instancetype)initWithPresentationMode:(ORKPSATPresentationMode)presentationMode NS_DESIGNATED_INITIALIZER;
- (void)setEnabled:(BOOL)enabled;
- (void)setAddition:(NSUInteger)additionIndex forTotal:(NSUInteger)totalAddition withDigit:(NSNumber *)digit;
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,164 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKPSATContentView.h"
#import "ORKBorderedButton.h"
#import "ORKPSATKeyboardView.h"
#import "ORKTapCountLabel.h"
#import "ORKVoiceEngine.h"
#import "ORKHelpers_Internal.h"
#import "ORKSkin.h"
@interface ORKPSATContentView ()
@property (nonatomic, assign, getter = isAuditory) BOOL auditory;
@property (nonatomic, strong) UIProgressView *progressView;
@property (nonatomic, strong) ORKTapCountLabel *digitLabel;
@end
@implementation ORKPSATContentView
- (instancetype)initWithFrame:(CGRect)frame {
ORKThrowMethodUnavailableException();
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [self initWithPresentationMode:ORKPSATPresentationModeAuditory];
return self;
}
- (instancetype)initWithPresentationMode:(ORKPSATPresentationMode)presentationMode {
self = [super initWithFrame:CGRectZero];
if (self) {
_digitLabel = [ORKTapCountLabel new];
_digitLabel.textAlignment = NSTextAlignmentCenter;
_digitLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_digitLabel];
_auditory = (presentationMode & ORKPSATPresentationModeAuditory) ? YES : NO;
if (!(presentationMode & ORKPSATPresentationModeVisual)) {
_digitLabel.hidden = YES;
}
_progressView = [UIProgressView new];
_progressView.translatesAutoresizingMaskIntoConstraints = NO;
_progressView.progressTintColor = [self tintColor];
[_progressView setAlpha:0];
[self addSubview:_progressView];
_keyboardView = [ORKPSATKeyboardView new];
_keyboardView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_keyboardView];
self.translatesAutoresizingMaskIntoConstraints = NO;
[self setNeedsUpdateConstraints];
}
return self;
}
- (void)setEnabled:(BOOL)enabled {
self.keyboardView.enabled = enabled;
}
- (void)setAddition:(NSUInteger)additionIndex forTotal:(NSUInteger)totalAddition withDigit:(NSNumber *)digit {
if (digit.integerValue == -1) {
self.digitLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.3f];
self.digitLabel.text = ORKLocalizedString(@"PSAT_NO_DIGIT", nil);
} else {
[self.keyboardView.selectedAnswerButton setSelected:NO];
self.digitLabel.textColor = nil;
self.digitLabel.text = [NSNumberFormatter localizedStringFromNumber:digit
numberStyle:NSNumberFormatterNoStyle];
if (self.isAuditory) {
[[ORKVoiceEngine sharedVoiceEngine] speakInt:digit.integerValue];
}
}
}
- (void)tintColorDidChange {
[super tintColorDidChange];
self.progressView.progressTintColor = self.tintColor;
}
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated {
[self.progressView setProgress:progress animated:animated];
[UIView animateWithDuration:animated ? 0.2 : 0 animations:^{
[self.progressView setAlpha:(progress == 0) ? 0 : 1];
}];
}
- (void)updateConstraints {
[NSLayoutConstraint deactivateConstraints:self.constraints];
const CGFloat ORKPSATKeyboardWidth = ORKGetMetricForWindow(ORKScreenMetricPSATKeyboardViewWidth, self.window);
const CGFloat ORKPSATKeyboardHeight = ORKGetMetricForWindow(ORKScreenMetricPSATKeyboardViewHeight, self.window);
NSMutableArray *constraints = [NSMutableArray array];
NSDictionary *views = NSDictionaryOfVariableBindings(_progressView, _digitLabel, _keyboardView);
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_progressView]-|"
options:(NSLayoutFormatOptions)0
metrics:nil
views:views]];
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_keyboardView(==keyboardWidth)]-|"
options:(NSLayoutFormatOptions)0
metrics:@{ @"keyboardWidth": @(ORKPSATKeyboardWidth) }
views:views]];
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_keyboardView(==keyboardHeight)]"
options:(NSLayoutFormatOptions)0
metrics:@{ @"keyboardHeight": @(ORKPSATKeyboardHeight) }
views:views]];
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_progressView]-[_digitLabel]-(>=10)-[_keyboardView]-|"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:views]];
[NSLayoutConstraint activateConstraints:constraints];
[super updateConstraints];
}
@end
@@ -0,0 +1,56 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import "ORKDefines.h"
NS_ASSUME_NONNULL_BEGIN
@class ORKBorderedButton;
@protocol ORKPSATKeyboardViewDelegate;
@interface ORKPSATKeyboardView : UIView
@property (nonatomic, weak) id<ORKPSATKeyboardViewDelegate> delegate;
@property (nonatomic, weak) ORKBorderedButton *selectedAnswerButton;
- (void)setEnabled:(BOOL)enabled;
@end
@protocol ORKPSATKeyboardViewDelegate <NSObject>
- (void)keyboardView:(ORKPSATKeyboardView *)keyboardView didSelectAnswer:(NSInteger)answer;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,153 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKPSATKeyboardView.h"
#import "ORKBorderedButton.h"
NSUInteger const ORKPSATMinimumAnswer = 3;
NSUInteger const ORKPSATMaximumAnswer = 17;
@interface ORKPSATKeyboardView ()
@property (nonatomic, strong, readonly) NSArray *answerButtons;
@property (nonatomic, strong) NSArray *constraints;
@end
@implementation ORKPSATKeyboardView
- (instancetype)init {
self = [super init];
if (self) {
NSMutableArray *buttonsArray = [[NSMutableArray alloc] initWithCapacity:(ORKPSATMaximumAnswer - ORKPSATMinimumAnswer) + 1];
ORKBorderedButton *answerButton = nil;
for (int i = ORKPSATMinimumAnswer; i <= ORKPSATMaximumAnswer; i++) {
answerButton = [self answerButtonWithTitle:[NSNumberFormatter localizedStringFromNumber:@(i)
numberStyle:NSNumberFormatterNoStyle]];
[buttonsArray addObject:answerButton];
[self addSubview:answerButton];
}
_answerButtons = [NSArray arrayWithArray:buttonsArray];
self.translatesAutoresizingMaskIntoConstraints = NO;
[self setNeedsUpdateConstraints];
}
return self;
}
- (ORKBorderedButton *)answerButtonWithTitle:(NSString *)title {
ORKBorderedButton *answerButton = [ORKBorderedButton new];
answerButton.translatesAutoresizingMaskIntoConstraints = NO;
[answerButton setTitle:title forState:UIControlStateNormal];
[answerButton addTarget:self action:@selector(buttonPressed:forEvent:) forControlEvents:UIControlEventTouchUpInside];
answerButton.accessibilityTraits |= UIAccessibilityTraitKeyboardKey;
return answerButton;
}
- (void)setEnabled:(BOOL)enabled {
for (ORKBorderedButton *answerButton in self.answerButtons) {
[answerButton setEnabled:enabled];
}
}
- (void)updateConstraints {
[NSLayoutConstraint deactivateConstraints:self.constraints];
NSMutableArray *constraints = [NSMutableArray array];
ORKBorderedButton *answer3Button = self.answerButtons[0];
ORKBorderedButton *answer4Button = self.answerButtons[1];
ORKBorderedButton *answer5Button = self.answerButtons[2];
ORKBorderedButton *answer6Button = self.answerButtons[3];
ORKBorderedButton *answer7Button = self.answerButtons[4];
ORKBorderedButton *answer8Button = self.answerButtons[5];
ORKBorderedButton *answer9Button = self.answerButtons[6];
ORKBorderedButton *answer10Button = self.answerButtons[7];
ORKBorderedButton *answer11Button = self.answerButtons[8];
ORKBorderedButton *answer12Button = self.answerButtons[9];
ORKBorderedButton *answer13Button = self.answerButtons[10];
ORKBorderedButton *answer14Button = self.answerButtons[11];
ORKBorderedButton *answer15Button = self.answerButtons[12];
ORKBorderedButton *answer16Button = self.answerButtons[13];
ORKBorderedButton *answer17Button = self.answerButtons[14];
NSDictionary *views = NSDictionaryOfVariableBindings(answer3Button, answer4Button, answer5Button, answer6Button, answer7Button, answer8Button, answer9Button, answer10Button, answer11Button, answer12Button, answer13Button, answer14Button, answer15Button, answer16Button, answer17Button);
// First line of answer buttons
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[answer3Button]-[answer4Button(==answer3Button)]-[answer5Button(==answer3Button)]-[answer6Button(==answer3Button)]-[answer7Button(==answer3Button)]-|"
options:NSLayoutFormatAlignAllCenterY|NSLayoutFormatAlignAllTop|NSLayoutFormatAlignAllBottom
metrics:nil views:views]];
// Second line of answer buttons
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[answer8Button]-[answer9Button(==answer8Button)]-[answer10Button(==answer8Button)]-[answer11Button(==answer8Button)]-[answer12Button(==answer8Button)]-|"
options:NSLayoutFormatAlignAllCenterY|NSLayoutFormatAlignAllTop|NSLayoutFormatAlignAllBottom
metrics:nil views:views]];
// Third line of answer buttons
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[answer13Button]-[answer14Button(==answer13Button)]-[answer15Button(==answer13Button)]-[answer16Button(==answer13Button)]-[answer17Button(==answer13Button)]-|"
options:NSLayoutFormatAlignAllCenterY|NSLayoutFormatAlignAllTop|NSLayoutFormatAlignAllBottom
metrics:nil views:views]];
// Align vertically
[constraints addObjectsFromArray:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[answer3Button]-[answer8Button(==answer3Button)]-[answer13Button(==answer3Button)]-|"
options:(NSLayoutFormatOptions)0
metrics:nil views:views]];
[NSLayoutConstraint activateConstraints:constraints];
[super updateConstraints];
}
#pragma mark buttonAction
- (IBAction)buttonPressed:(id)button forEvent:(UIEvent *)event {
ORKBorderedButton *tappedAnswerButton = (ORKBorderedButton *)button;
[self.selectedAnswerButton setSelected:NO];
self.selectedAnswerButton = tappedAnswerButton;
[self.selectedAnswerButton setSelected:YES];
if ([self.delegate respondsToSelector:@selector(keyboardView:didSelectAnswer:)]) {
NSInteger answerValue = [self.answerButtons indexOfObject:tappedAnswerButton] + ORKPSATMinimumAnswer;
[self.delegate keyboardView:self didSelectAnswer:answerValue];
}
}
@end
+49
View File
@@ -0,0 +1,49 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKPSATStep : ORKActiveStep
@property (nonatomic, assign) ORKPSATPresentationMode presentationMode;
@property (nonatomic, assign) NSTimeInterval interStimulusInterval;
@property (nonatomic, assign) NSTimeInterval stimulusDuration;
@property (nonatomic, assign) NSInteger seriesLength;
@end
NS_ASSUME_NONNULL_END
+143
View File
@@ -0,0 +1,143 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKPSATStep.h"
#import "ORKPSATStepViewController.h"
#import "ORKHelpers_Internal.h"
@implementation ORKPSATStep
+ (Class)stepViewControllerClass {
return [ORKPSATStepViewController class];
}
- (instancetype)initWithIdentifier:(NSString *)identifier {
self = [super initWithIdentifier:identifier];
if (self) {
self.shouldStartTimerAutomatically = YES;
self.shouldShowDefaultTimer = NO;
self.shouldContinueOnFinish = YES;
}
return self;
}
- (void)validateParameters {
[super validateParameters];
NSTimeInterval const ORKPSATInterStimulusMinimumInterval = 1.0;
NSTimeInterval const ORKPSATInterStimulusMaximumInterval = 5.0;
NSTimeInterval const ORKPSATStimulusMinimumDuration = 0.2;
NSInteger const ORKPSATSerieMinimumLength = 10;
NSInteger const ORKPSATSerieMaximumLength = 120;
NSTimeInterval totalDuration = (self.seriesLength + 1) * self.interStimulusInterval;
if (self.stepDuration != totalDuration) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"step duration must be equal to %@ seconds.", @(totalDuration)] userInfo:nil];
}
if (!(self.presentationMode & ORKPSATPresentationModeAuditory) &&
!(self.presentationMode & ORKPSATPresentationModeVisual)) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"step presentation mode must be auditory and/or visual." userInfo:nil];
}
if (self.interStimulusInterval < ORKPSATInterStimulusMinimumInterval ||
self.interStimulusInterval > ORKPSATInterStimulusMaximumInterval) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"inter stimulus interval must be greater than or equal to %@ seconds and less than or equal to %@ seconds.", @(ORKPSATInterStimulusMinimumInterval), @(ORKPSATInterStimulusMaximumInterval)] userInfo:nil];
}
if ((self.presentationMode & ORKPSATPresentationModeVisual) &&
(self.stimulusDuration < ORKPSATStimulusMinimumDuration || self.stimulusDuration > self.interStimulusInterval)) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"stimulus duration must be greater than or equal to %@ seconds and less than or equal to %@ seconds.", @(ORKPSATStimulusMinimumDuration), @(self.interStimulusInterval)] userInfo:nil];
}
if (self.seriesLength < ORKPSATSerieMinimumLength ||
self.seriesLength > ORKPSATSerieMaximumLength) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:[NSString stringWithFormat:@"serie length must be greater than or equal to %@ additions and less than or equal to %@ additions.", @(ORKPSATSerieMinimumLength), @(ORKPSATSerieMaximumLength)] userInfo:nil];
}
}
- (BOOL)allowsBackNavigation {
return NO;
}
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_ENUM(aDecoder, presentationMode);
ORK_DECODE_DOUBLE(aDecoder, interStimulusInterval);
ORK_DECODE_DOUBLE(aDecoder, stimulusDuration);
ORK_DECODE_INTEGER(aDecoder, seriesLength);
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
ORK_ENCODE_ENUM(aCoder, presentationMode);
ORK_ENCODE_DOUBLE(aCoder, interStimulusInterval);
ORK_ENCODE_DOUBLE(aCoder, stimulusDuration);
ORK_ENCODE_INTEGER(aCoder, seriesLength);
}
- (instancetype)copyWithZone:(NSZone *)zone {
ORKPSATStep *step = [super copyWithZone:zone];
step.presentationMode = self.presentationMode;
step.interStimulusInterval = self.interStimulusInterval;
step.stimulusDuration = self.stimulusDuration;
step.seriesLength = self.seriesLength;
return step;
}
- (NSUInteger)hash {
return [super hash] ^ self.presentationMode ^ (NSInteger)(self.interStimulusInterval*100) ^ (NSInteger)(self.stimulusDuration*100) ^ self.seriesLength;
}
- (BOOL)isEqual:(id)object {
BOOL isParentSame = [super isEqual:object];
__typeof(self) castObject = object;
return (isParentSame &&
(self.presentationMode == castObject.presentationMode) &&
(self.interStimulusInterval == castObject.interStimulusInterval) &&
(self.stimulusDuration == castObject.stimulusDuration) &&
(self.seriesLength == castObject.seriesLength));
}
@end
@@ -0,0 +1,44 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import UIKit;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStepViewController.h>
NS_ASSUME_NONNULL_BEGIN
ORK_CLASS_AVAILABLE
@interface ORKPSATStepViewController : ORKActiveStepViewController
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,243 @@
/*
Copyright (c) 2015, Shazino SAS. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKPSATStepViewController.h"
#import "ORKActiveStepTimer.h"
#import "ORKActiveStepView.h"
#import "ORKPSATContentView.h"
#import "ORKPSATKeyboardView.h"
#import "ORKVerticalContainerView.h"
#import "ORKActiveStepViewController_Internal.h"
#import "ORKPSATStep.h"
#import "ORKResult.h"
#import "ORKStepViewController_Internal.h"
#import "ORKHelpers_Internal.h"
@interface ORKPSATStepViewController () <ORKPSATKeyboardViewDelegate>
@property (nonatomic, strong) NSMutableArray *samples;
@property (nonatomic, strong) ORKPSATContentView *psatContentView;
@property (nonatomic, strong) NSArray<NSNumber *> *digits;
@property (nonatomic, assign) NSUInteger currentDigitIndex;
@property (nonatomic, assign) NSInteger currentAnswer;
@property (nonatomic, strong) ORKActiveStepTimer *clearDigitsTimer;
@property (nonatomic, assign) NSTimeInterval answerStart;
@property (nonatomic, assign) NSTimeInterval answerEnd;
@end
@implementation ORKPSATStepViewController
- (instancetype)initWithStep:(ORKStep *)step {
self = [super initWithStep:step];
if (self) {
self.suspendIfInactive = YES;
}
return self;
}
- (ORKPSATStep *)psatStep {
NSAssert(self.step == nil || [self.step isKindOfClass:[ORKPSATStep class]], @"Step class must be subclass of ORKPSATStep.");
return (ORKPSATStep *)self.step;
}
- (NSArray *)arrayWithPSATDigits {
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:[self psatStep].seriesLength + 1];
NSUInteger digit = 0;
for (NSUInteger i = 0; i < [self psatStep].seriesLength + 1; i++) {
do
{
digit = (arc4random() % (9)) + 1;
} while (digit == ((NSNumber *)[array lastObject]).integerValue);
[array addObject:@(digit)];
}
return array;
}
- (void)initializeInternalButtonItems {
[super initializeInternalButtonItems];
// Don't show buttons
self.internalContinueButtonItem = nil;
self.internalDoneButtonItem = nil;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.activeStepView.stepViewFillsAvailableSpace = YES;
self.psatContentView = [[ORKPSATContentView alloc] initWithPresentationMode:[self psatStep].presentationMode];
self.psatContentView.keyboardView.delegate = self;
[self.psatContentView setEnabled:NO];
self.activeStepView.activeCustomView = self.psatContentView;
self.timerUpdateInterval = [self psatStep].interStimulusInterval;
}
- (ORKStepResult *)result {
ORKStepResult *sResult = [super result];
NSMutableArray *results = [NSMutableArray arrayWithArray:sResult.results];
ORKPSATResult *PSATResult = [[ORKPSATResult alloc] initWithIdentifier:self.step.identifier];
PSATResult.presentationMode = [self psatStep].presentationMode;
PSATResult.interStimulusInterval = [self psatStep].interStimulusInterval;
if ([self psatStep].presentationMode & ORKPSATPresentationModeVisual) {
PSATResult.stimulusDuration = [self psatStep].stimulusDuration;
} else {
PSATResult.stimulusDuration = 0.0;
}
PSATResult.length = [self psatStep].seriesLength;
PSATResult.initialDigit = self.digits[0].integerValue;
NSInteger totalCorrect = 0;
BOOL previousAnswerCorrect = NO;
NSInteger totalDyad = 0;
CGFloat totalTime = 0.0;
for (ORKPSATSample *sample in self.samples) {
totalTime += sample.time;
if (sample.isCorrect) {
totalCorrect++;
if (previousAnswerCorrect) {
totalDyad++;
}
}
previousAnswerCorrect = sample.isCorrect;
}
PSATResult.totalCorrect = totalCorrect;
PSATResult.totalTime = totalTime;
PSATResult.totalDyad = totalDyad;
PSATResult.samples = self.samples;
[results addObject:PSATResult];
sResult.results = [results copy];
return sResult;
}
- (void)start {
self.digits = [self arrayWithPSATDigits];
self.currentDigitIndex = 0;
[self.psatContentView setAddition:self.currentDigitIndex forTotal:[self psatStep].seriesLength withDigit:self.digits[self.currentDigitIndex]];
[self.psatContentView setProgress:0.001 animated:NO];
self.currentAnswer = -1;
self.samples = [NSMutableArray array];
if ([self psatStep].presentationMode & ORKPSATPresentationModeVisual &&
([self psatStep].interStimulusInterval - [self psatStep].stimulusDuration) > 0.05 ) {
// Don't show `-` if the difference between stimulusDuration and interStimulusInterval is less than timer's resolution.
ORKWeakTypeOf(self) weakSelf = self;
self.clearDigitsTimer = [[ORKActiveStepTimer alloc] initWithDuration:[self psatStep].stepDuration
interval:[self psatStep].interStimulusInterval
runtime:-[self psatStep].stimulusDuration
handler:^(ORKActiveStepTimer *timer, BOOL finished) {
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf clearDigitsTimerFired];
}];
[self.clearDigitsTimer resume];
}
[super start];
}
- (void)suspend {
[self.clearDigitsTimer pause];
[super suspend];
}
- (void)resume {
[self.clearDigitsTimer resume];
[super resume];
}
- (void)finish {
[self.clearDigitsTimer reset];
self.clearDigitsTimer = nil;
[super finish];
}
- (void)countDownTimerFired:(ORKActiveStepTimer *)timer finished:(BOOL)finished {
if (self.currentDigitIndex == 0) {
[self.psatContentView setEnabled:YES];
[self.activeStepView updateTitle:ORKLocalizedString(@"PSAT_INSTRUCTION", nil) text:nil];
} else {
[self saveSample];
}
self.currentDigitIndex++;
self.answerStart = CACurrentMediaTime();
self.answerEnd = 0;
if (self.currentDigitIndex <= [self psatStep].seriesLength) {
[self.psatContentView setAddition:self.currentDigitIndex forTotal:[self psatStep].seriesLength withDigit:self.digits[self.currentDigitIndex]];
}
self.currentAnswer = -1;
CGFloat progress = finished ? 1 : (timer.runtime / timer.duration);
[self.psatContentView setProgress:progress animated:YES];
[super countDownTimerFired:timer finished:finished];
}
- (void)clearDigitsTimerFired {
[self.psatContentView setAddition:self.currentDigitIndex forTotal:[self psatStep].seriesLength withDigit:@(-1)];
}
- (void)saveSample {
ORKPSATSample *sample = [[ORKPSATSample alloc] init];
NSInteger previousDigit = self.digits[self.currentDigitIndex - 1].integerValue;
NSInteger currentDigit = self.digits[self.currentDigitIndex].integerValue;;
sample.correct = previousDigit + currentDigit == self.currentAnswer ? YES : NO;
sample.digit = currentDigit;
sample.answer = self.currentAnswer;
sample.time = self.answerEnd == 0 ? [self psatStep].interStimulusInterval : self.answerEnd - self.answerStart;
[self.samples addObject:sample];
}
#pragma mark - keyboard view delegate
- (void)keyboardView:(ORKPSATKeyboardView *)keyboardView didSelectAnswer:(NSInteger)answer {
self.currentAnswer = answer;
self.answerEnd = CACurrentMediaTime();
}
@end
@@ -29,6 +29,7 @@
*/
@import UIKit;
#import <ResearchKit/ORKRecorder.h>
+17 -19
View File
@@ -30,10 +30,13 @@
#import "ORKPedometerRecorder.h"
#import "ORKDataLogger.h"
#import "CMPedometerData+ORKJSONDictionary.h"
#import "ORKRecorder_Internal.h"
#import "ORKRecorder_Private.h"
#import "ORKHelpers_Internal.h"
#import "CMPedometerData+ORKJSONDictionary.h"
@interface ORKPedometerRecorder () {
@@ -66,9 +69,9 @@
- (void)updateStatisticsWithData:(CMPedometerData *)pedometerData {
_lastUpdateDate = pedometerData.endDate;
_totalNumberOfSteps = [pedometerData.numberOfSteps integerValue];
_totalNumberOfSteps = pedometerData.numberOfSteps.integerValue;
if (pedometerData.distance) {
_totalDistance = [pedometerData.distance doubleValue];
_totalDistance = pedometerData.distance.doubleValue;
} else {
_totalDistance = -1;
}
@@ -90,39 +93,39 @@
_totalNumberOfSteps = 0;
_totalDistance = -1;
if (! _logger) {
NSError *err = nil;
_logger = [self makeJSONDataLoggerWithError:&err];
if (! _logger) {
[self finishRecordingWithError:err];
if (!_logger) {
NSError *error = nil;
_logger = [self makeJSONDataLoggerWithError:&error];
if (!_logger) {
[self finishRecordingWithError:error];
return;
}
}
self.pedometer = [self createPedometer];
if (! [[self.pedometer class] isStepCountingAvailable]) {
if (![[self.pedometer class] isStepCountingAvailable]) {
[self finishRecordingWithError:[NSError errorWithDomain:NSCocoaErrorDomain
code:NSFeatureUnsupportedError
userInfo:@{@"recorder" : self}]];
userInfo:@{@"recorder": self}]];
return;
}
_isRecording = YES;
__weak __typeof(self) weakSelf = self;
ORKWeakTypeOf(self) weakSelf = self;
[self.pedometer startPedometerUpdatesFromDate:[NSDate date] withHandler:^(CMPedometerData *pedometerData, NSError *error) {
BOOL success = NO;
if (pedometerData) {
success = [_logger append:[pedometerData ork_JSONDictionary] error:&error];
dispatch_async(dispatch_get_main_queue(), ^{
__typeof(self) strongSelf = weakSelf;
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf updateStatisticsWithData:pedometerData];
});
}
if (!success || error) {
dispatch_async(dispatch_get_main_queue(), ^{
__typeof(self) strongSelf = weakSelf;
ORKStrongTypeOf(self) strongSelf = weakSelf;
[strongSelf finishRecordingWithError:error];
});
}
@@ -179,11 +182,6 @@
@end
@interface ORKPedometerRecorderConfiguration ()
@end
@implementation ORKPedometerRecorderConfiguration
- (instancetype)initWithIdentifier:(NSString *)identifier {
@@ -0,0 +1,52 @@
/*
Copyright (c) 2016, Darren Levy. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import Foundation;
#import <ResearchKit/ORKDefines.h>
#import <ResearchKit/ORKActiveStep.h>
#import <ResearchKit/ORKOrderedTask.h>
NS_ASSUME_NONNULL_BEGIN
/**
The `ORKRangeOfMotionStep` class represents a step that takes a range of motion measurement.
*/
ORK_CLASS_AVAILABLE
@interface ORKRangeOfMotionStep : ORKActiveStep
@property (nonatomic, assign) ORKPredefinedTaskLimbOption limbOption; //The left and/or right limb to be tested during the task
- (instancetype)initWithIdentifier:(NSString *)identifier limbOption:(ORKPredefinedTaskLimbOption)limbOption;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,101 @@
/*
Copyright (c) 2016, Darren Levy. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "ORKRangeOfMotionStep.h"
#import "ORKRangeOfMotionStepViewController.h"
#import "ORKHelpers_Internal.h"
@implementation ORKRangeOfMotionStep
+ (Class)stepViewControllerClass {
return [ORKRangeOfMotionStepViewController class];
}
- (instancetype)initWithIdentifier:(NSString *)identifier limbOption:(ORKPredefinedTaskLimbOption)limbOption {
self = [super initWithIdentifier:identifier];
if (self) {
self.shouldVibrateOnStart = YES;
self.shouldPlaySoundOnStart = YES;
self.shouldVibrateOnFinish = YES;
self.shouldPlaySoundOnFinish = YES;
self.shouldContinueOnFinish = YES;
self.shouldStartTimerAutomatically = YES;
self.limbOption = limbOption;
}
return self;
}
- (void)validateParameters {
[super validateParameters];
if (self.limbOption != ORKPredefinedTaskLimbOptionLeft && self.limbOption != ORKPredefinedTaskLimbOptionRight) {
@throw [NSException exceptionWithName:NSInvalidArgumentException
reason:ORKLocalizedString(@"LIMB_OPTION_LEFT_OR_RIGHT_ERROR", nil)
userInfo:nil];
}
}
- (BOOL)startsFinished {
return NO;
}
+ (BOOL)supportsSecureCoding {
return YES;
}
- (instancetype)copyWithZone:(NSZone *)zone {
ORKRangeOfMotionStep *step = [super copyWithZone:zone];
step.limbOption = self.limbOption;
return step;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
ORK_DECODE_INTEGER(aDecoder, limbOption);
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder {
[super encodeWithCoder:aCoder];
ORK_ENCODE_INTEGER(aCoder, limbOption);
}
- (BOOL)isEqual:(id)object {
BOOL isParentSame = [super isEqual:object];
__typeof(self) castObject = object;
return (isParentSame && (self.limbOption == castObject.limbOption));
}
@end
@@ -0,0 +1,50 @@
/*
Copyright (c) 2016, Darren Levy. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <ResearchKit/ResearchKit.h>
#import <CoreMotion/CMDeviceMotion.h>
NS_ASSUME_NONNULL_BEGIN
/**
This class is used by the `ORKRangeOfMotionStep.` Its result corresponds to the device's orientation
as recorded by CoreMotion.
*/
ORK_CLASS_AVAILABLE
@interface ORKRangeOfMotionStepViewController : ORKActiveStepViewController {
double _flexedAngle;
double _rangeOfMotionAngle;
}
@end
NS_ASSUME_NONNULL_END

Some files were not shown because too many files have changed in this diff Show More