Skip to content

Commit

Permalink
Merge pull request #1563 from RADAR-base/release-2.6.2-alpha
Browse files Browse the repository at this point in the history
Release 2.6.2-alpha
  • Loading branch information
mpgxvii committed Oct 12, 2022
2 parents 17c2f0c + 8ee0b49 commit 41ff0e3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 31 deletions.
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="571" id="org.phidatalab.radar_armt" ios-CFBundleIdentifier="org.phidatalab.radar-armt" ios-CFBundleVersion="1" version="2.6.1-alpha" xmlns:android="http://schemas.android.com/apk/res/android">
<widget android-versionCode="572" id="org.phidatalab.radar_armt" ios-CFBundleIdentifier="org.phidatalab.radar-armt" ios-CFBundleVersion="1" version="2.6.2-alpha" xmlns:android="http://schemas.android.com/apk/res/android">
<name>RADAR Questionnaire</name>
<description>An application that collects active data for research.</description>
<author email="radar-base@kcl.ac.uk" href="http://radar-base.org/">RADAR-Base</author>
Expand Down Expand Up @@ -60,7 +60,7 @@
</feature>
<preference name="WKWebViewOnly" value="true" />
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
<preference name="AllowsInlineMediaPlayback" value="true" />
<preference name="AllowInlineMediaPlayback" value="true" />
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>The app would like to use the camera to scan QR codes.</string>
</edit-config>
Expand Down
1 change: 1 addition & 0 deletions src/app/core/services/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export class ConfigService {
}

updateConfigStateOnProtocolChange(protocol) {
this.questionnaire.reset()
const assessments = protocol.protocols
this.logger.log(assessments)
return this.questionnaire
Expand Down
7 changes: 5 additions & 2 deletions src/app/pages/home/containers/home-page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@

<div #taskCalendar class="taskCalendar" [@displayCalendar]="showCalendar">
<task-calendar
*ngIf="(sortedTasks | async)?.size"
*ngIf="
(sortedTasks | async)?.size &&
(isTaskCalendarTaskNameShown | async) !== null
"
[show]="showCalendar"
(task)="startQuestionnaire($event)"
[tasks]="sortedTasks | async"
[currentDate]="currentDate.getTime()"
[isTaskNameShown]="isTaskNameShown"
[isTaskNameShown]="isTaskCalendarTaskNameShown | async"
>
</task-calendar>
</div>
Expand Down
10 changes: 2 additions & 8 deletions src/app/pages/home/containers/home-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class HomePageComponent implements OnDestroy {
taskIsNow = false
checkTaskInterval
showMiscTasksButton: Promise<boolean>
isTaskCalendarTaskNameShown = false
isTaskCalendarTaskNameShown: Promise<boolean>

APP_CREDITS = '&#169; RADAR-Base'
HTML_BREAK = '<br>'
Expand All @@ -62,7 +62,6 @@ export class HomePageComponent implements OnDestroy {
this.navCtrl.setRoot(HomePageComponent)
}
)
this.getisTaskCalendarTaskNameShown()
}

getIsLoadingSpinnerShown() {
Expand All @@ -72,12 +71,6 @@ export class HomePageComponent implements OnDestroy {
)
}

getisTaskCalendarTaskNameShown() {
this.tasksService
.getIsTaskCalendarTaskNameShown()
.then(res => (this.isTaskCalendarTaskNameShown = res))
}

getIsStartButtonShown() {
return (
this.taskIsNow &&
Expand Down Expand Up @@ -114,6 +107,7 @@ export class HomePageComponent implements OnDestroy {
this.hasOnDemandTasks = this.tasksService.getHasOnDemandTasks()
this.hasClinicalTasks = this.tasksService.getHasClinicalTasks()
this.title = this.tasksService.getPlatformInstanceName()
this.isTaskCalendarTaskNameShown = this.tasksService.getIsTaskCalendarTaskNameShown()
this.onDemandIcon = this.tasksService.getOnDemandAssessmentIcon()
this.showMiscTasksButton = this.getShowMiscTasksButton()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="toolbar-progress-bar" [style.width]="progress + '%'"></div>
</div>
<ion-title *ngIf="isProgressCountShown" text-center color="light">
{{ currentQuestionId + '/' + totalQuestions }}
{{ currentQuestionId + 1 + '/' + totalQuestions }}
</ion-title>
<ion-buttons left>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
[isRightButtonDisabled]="isRightButtonDisabled"
[currentQuestionId]="currentQuestionGroupId"
[totalQuestions]="groupedQuestions?.size"
[isProgressCountShown]="showProgressCount"
[isProgressCountShown]="showProgressCount | async"
></toolbar>
</ion-footer>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class QuestionsServiceMock {
return Promise.resolve({})
}

initRemoteConfigParams() {
return Promise.resolve({})
}

getIsProgressCountShown() {
return false
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/questions/containers/questions-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class QuestionsPageComponent implements OnInit {
ShowIntroductionType.ONCE
])
MATRIX_FIELD_NAME = 'matrix'
showProgressCount = false
showProgressCount: Promise<boolean>

constructor(
public navCtrl: NavController,
Expand Down Expand Up @@ -100,7 +100,8 @@ export class QuestionsPageComponent implements OnInit {
this.task = this.navParams.data
this.showProgressCount = this.questionsService.getIsProgressCountShown()
return this.questionsService
.getQuestionnairePayload(this.task)
.initRemoteConfigParams()
.then(() => this.questionsService.getQuestionnairePayload(this.task))
.then(res => {
this.initQuestionnaire(res)
return this.updateToolbarButtons()
Expand Down Expand Up @@ -206,16 +207,15 @@ export class QuestionsPageComponent implements OnInit {
}

nextAction(event) {
if (event == NextButtonEventType.AUTO) return this.nextQuestion()
if (event == NextButtonEventType.AUTO)
return setTimeout(() => this.nextQuestion(), 100)
if (event == NextButtonEventType.ENABLE)
return setTimeout(() => this.updateToolbarButtons(), 100)
if (event == NextButtonEventType.DISABLE)
return (this.isRightButtonDisabled = true)
}

nextQuestion() {
if (this.isRightButtonDisabled) return

const questionPosition = this.questionsService.getNextQuestion(
this.groupedQuestions,
this.currentQuestionGroupId
Expand Down
24 changes: 12 additions & 12 deletions src/app/pages/questions/services/questions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ export class QuestionsService {
private finish: FinishTaskService,
private remoteConfig: RemoteConfigService,
private util: Utility
) {
this.init()
}
) {}

init() {
initRemoteConfigParams() {
return this.remoteConfig
.read()
.then(config =>
Expand All @@ -61,16 +59,10 @@ export class QuestionsService {
config.getOrDefault(
ConfigKeys.SKIPPABLE_QUESTIONNAIRE_TYPES,
DefaultSkippableQuestionnaireTypes.toString()
),
config.getOrDefault(
ConfigKeys.SHOW_TASK_PROGRESS_COUNT,
DefaultShowTaskProgressCount.toString()
)
])
)
.then(([autoNextSet, skippableSet, showTaskProgressCount]) => {
if (showTaskProgressCount.length)
this.isProgressCountShown = JSON.parse(showTaskProgressCount)
.then(([autoNextSet, skippableSet]) => {
if (autoNextSet.length)
this.NEXT_BUTTON_AUTOMATIC_SET = new Set(
this.stringToArray(autoNextSet, this.DELIMITER)
Expand Down Expand Up @@ -270,6 +262,14 @@ export class QuestionsService {
}

getIsProgressCountShown() {
return this.isProgressCountShown
return this.remoteConfig
.read()
.then(config =>
config.getOrDefault(
ConfigKeys.SHOW_TASK_PROGRESS_COUNT,
DefaultShowTaskProgressCount
)
)
.then(res => JSON.parse(res))
}
}

0 comments on commit 41ff0e3

Please sign in to comment.