diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f5ab6c3..803212cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.19.12] - 2022-04-5 +- Fix tilt version of stability tracker + ## [0.19.11] - 2022-04-4 - Fix an issue with variable name - Fix an issue with Sthare Report button diff --git a/README.md b/README.md index 278a65954..b04196dff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MindLogger 0.19.11 +# MindLogger 0.19.12 _Note: v0.1 is deprecated as of June 12, 2019._ diff --git a/android/app/build.gradle b/android/app/build.gradle index 80cc6bbe8..96ea53ed2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -130,8 +130,8 @@ android { applicationId "lab.childmindinstitute.data" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 524 - versionName "0.19.11" + versionCode 525 + versionName "0.19.12" missingDimensionStrategy 'react-native-camera', 'general' multiDexEnabled true } diff --git a/app/state/responses/responses.thunks.js b/app/state/responses/responses.thunks.js index 4110b4ca8..45e5555f0 100644 --- a/app/state/responses/responses.thunks.js +++ b/app/state/responses/responses.thunks.js @@ -539,7 +539,7 @@ export const completeResponse = (isTimeout = false) => (dispatch, getState) => { const { cumActivities, nonHiddenCumActivities } = evaluateCumulatives(inProgressResponse.responses, activity); const cumulativeActivities = state.activities.cumulativeActivities; - if (cumActivities.length || nonHiddenCumActivities.length) { + if (cumActivities.length || nonHiddenCumActivities && nonHiddenCumActivities.length) { let archieved = [...cumulativeActivities[applet.id].archieved]; let available = [...cumulativeActivities[applet.id].available]; const activityId = activity.id.split('/').pop(); diff --git a/app/widgets/StabilityTracker/index.js b/app/widgets/StabilityTracker/index.js index c842191eb..7f477be6c 100644 --- a/app/widgets/StabilityTracker/index.js +++ b/app/widgets/StabilityTracker/index.js @@ -1,9 +1,9 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'; import PropTypes from 'prop-types'; -import { View, Text, StyleSheet } from 'react-native'; +import { View, Text, StyleSheet, Platform } from 'react-native'; import { connect } from 'react-redux'; import Svg, { Circle, Rect } from 'react-native-svg'; -import { magnetometer } from "react-native-sensors"; +import { orientation } from "react-native-sensors"; import { useAnimationFrame } from '../../services/hooks'; import { showToast } from '../../state/app/app.thunks'; @@ -104,7 +104,7 @@ const StabilityTrackerScreen = ({ onChange, config, isCurrent, maxLambda, applet const trialNumber = useRef(0); const responses = useRef([]); const controlBar = useRef(true); - const magnRef = useRef(), baseAcc = useRef(); + const oriRef = useRef(), baseOri = useRef(); const lastCrashTime = useRef(0); const lambdaLimit = configObj.phaseType == 'challenge-phase' ? 0 : maxLambda * 0.3; @@ -127,19 +127,13 @@ const StabilityTrackerScreen = ({ onChange, config, isCurrent, maxLambda, applet useEffect(() => { if (configObj.userInputType == 'gyroscope') { if (moving) { - magnRef.current = magnetometer.subscribe(({ x, y, z }) => { - let yRot = Math.asin(x / Math.sqrt(x*x + z*z)); - let xRot = Math.asin(y / Math.sqrt(y*y + z*z + x*x)); - - if (y < 0) { - yRot += Math.PI; - } - - if (!baseAcc.current) { - baseAcc.current = [xRot, yRot]; + oriRef.current = orientation.subscribe(({ pitch, yaw, roll, timestamp }) => { + if (!baseOri.current) { + baseOri.current = [roll, pitch]; } else { - const x = center + (yRot - baseAcc.current[1]) / configObj.maxRad * panelRadius; - const y = center - (xRot - baseAcc.current[0]) / configObj.maxRad * panelRadius; + const x = center + (roll - baseOri.current[0]) / configObj.maxRad * panelRadius; + + const y = center + (Platform.OS == 'ios' ? 1 : -1) * (pitch - baseOri.current[1]) / configObj.maxRad * panelRadius; userPos.current = [x, y]; } @@ -153,15 +147,15 @@ const StabilityTrackerScreen = ({ onChange, config, isCurrent, maxLambda, applet configObj.userInputType = 'touch' }) } else { - if (magnRef.current) { - magnRef.current.unsubscribe(); + if (oriRef.current) { + oriRef.current.unsubscribe(); } } } return () => { - if (magnRef.current) { - magnRef.current.unsubscribe(); + if (oriRef.current) { + oriRef.current.unsubscribe(); } } }, [moving]) diff --git a/ios/MDCApp/Info.plist b/ios/MDCApp/Info.plist index 69decea8f..0c3ef6247 100644 --- a/ios/MDCApp/Info.plist +++ b/ios/MDCApp/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.19.11 + 0.19.12 CFBundleSignature ???? CFBundleVersion - 524 + 525 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/package.json b/package.json index 7d34e88fc..d689da78d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MindLogger", - "version": "0.19.11", + "version": "0.19.12", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", @@ -114,7 +114,7 @@ "react-native-router-flux": "4.2.0", "react-native-screens": "^1.0.0-alpha.23", "react-native-select-dropdown": "^1.0.9", - "react-native-sensors": "^7.3.3", + "react-native-sensors": "^7.3.5", "react-native-slider": "^0.11.0", "react-native-sound-player": "^0.10.5", "react-native-svg": "^12.1.0",