diff --git a/config.xml b/config.xml index 56ee14c09..eb723a609 100755 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + RADAR Questionnaire An application that collects active data for research. RADAR-Base diff --git a/src/app/core/services/app-server/app-server.service.ts b/src/app/core/services/app-server/app-server.service.ts index e7de6585e..83ea1beeb 100644 --- a/src/app/core/services/app-server/app-server.service.ts +++ b/src/app/core/services/app-server/app-server.service.ts @@ -41,15 +41,17 @@ export class AppServerService { this.subjectConfig.getParticipantLogin(), this.subjectConfig.getProjectName(), this.subjectConfig.getEnrolmentDate(), + this.subjectConfig.getParticipantAttributes(), this.getFCMToken() ]) ) - .then(([subjectId, projectId, enrolmentDate, fcmToken]) => + .then(([subjectId, projectId, enrolmentDate, attributes, fcmToken]) => this.addProjectIfMissing(projectId).then(() => this.addSubjectIfMissing( subjectId, projectId, enrolmentDate, + attributes, fcmToken ) ) @@ -117,6 +119,7 @@ export class AppServerService { subjectId, projectId, enrolmentDate, + attributes, fcmToken ): Promise { // NOTE: Adds subject if missing, updates subject if it exists @@ -126,7 +129,8 @@ export class AppServerService { fcmToken, lastOpened: new Date(), timezone: moment.tz.guess(), - language: this.localization.getLanguage().value + language: this.localization.getLanguage().value, + attributes }) ) .catch(e => { @@ -135,13 +139,20 @@ export class AppServerService { subjectId, projectId, enrolmentDate, - fcmToken + fcmToken, + attributes ) else throw e }) } - addSubjectToServer(subjectId, projectId, enrolmentDate, fcmToken) { + addSubjectToServer( + subjectId, + projectId, + enrolmentDate, + fcmToken, + attributes + ) { return this.getHeaders().then(headers => this.http .post( @@ -157,7 +168,8 @@ export class AppServerService { subjectId, fcmToken, timezone: moment.tz.guess(), - language: this.localization.getLanguage().value + language: this.localization.getLanguage().value, + attributes }, { headers, params: { forceFcmToken: 'true' } } ) diff --git a/src/app/core/services/config/subject-config.service.ts b/src/app/core/services/config/subject-config.service.ts index b3aa3eaa8..736324c30 100644 --- a/src/app/core/services/config/subject-config.service.ts +++ b/src/app/core/services/config/subject-config.service.ts @@ -74,19 +74,19 @@ export class SubjectConfigService { return this.storage.set(this.SUBJECT_CONFIG_STORE.BASE_URI, uri) } - getParticipantID() { + getParticipantID(): Promise { return this.storage.get(this.SUBJECT_CONFIG_STORE.PARTICIPANTID) } - getEnrolmentDate() { + getEnrolmentDate(): Promise { return this.storage.get(this.SUBJECT_CONFIG_STORE.ENROLMENTDATE) } - getProjectName() { + getProjectName(): Promise { return this.storage.get(this.SUBJECT_CONFIG_STORE.PROJECTNAME) } - getSourceID() { + getSourceID(): Promise { return this.storage.get(this.SUBJECT_CONFIG_STORE.SOURCEID) } @@ -94,11 +94,11 @@ export class SubjectConfigService { return this.storage.get(this.SUBJECT_CONFIG_STORE.PARTICIPANTLOGIN) } - getParticipantAttributes() { + getParticipantAttributes(): Promise> { return this.storage.get(this.SUBJECT_CONFIG_STORE.PARTICIPANT_ATTRIBUTES) } - getBaseUrl() { + getBaseUrl(): Promise { return this.storage.get(this.SUBJECT_CONFIG_STORE.BASE_URI) } diff --git a/src/app/shared/enums/localisations.ts b/src/app/shared/enums/localisations.ts index 122ce17a8..955b454f0 100644 --- a/src/app/shared/enums/localisations.ts +++ b/src/app/shared/enums/localisations.ts @@ -168,7 +168,7 @@ export class LocKeys { static CONFIG_ERROR_DESC = new LocKeys('CONFIG_ERROR_DESC') static AUDIO_TASK_ALERT = new LocKeys('AUDIO_TASK_ALERT') static AUDIO_TASK_ALERT_DESC = new LocKeys('AUDIO_TASK_ALERT_DESC') - static AUDIO_TASK_BUTTON_ALERT_DESC = new LocKeys('AUDIO_TASK_ALERT_DESC') + static AUDIO_TASK_BUTTON_ALERT_DESC = new LocKeys('AUDIO_TASK_BUTTON_ALERT_DESC') static AUDIO_TASK_ATTEMPT_ALERT = new LocKeys('AUDIO_TASK_ATTEMPT_ALERT') static AUDIO_TASK_HAPPY_ALERT = new LocKeys('AUDIO_TASK_HAPPY_ALERT') static SPLASH_STATUS_UPDATING_CONFIG = new LocKeys(