Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

2454 #2517

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

2454 #2517

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MindLogger 0.19.11
# MindLogger 0.19.12

_Note: v0.1 is deprecated as of June 12, 2019._

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion app/state/responses/responses.thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
32 changes: 13 additions & 19 deletions app/widgets/StabilityTracker/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand All @@ -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];
}
Expand All @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions ios/MDCApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.19.11</string>
<string>0.19.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>524</string>
<string>525</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down