addStudyFromInvitation method

Future<SmartphoneStudy> addStudyFromInvitation(
  1. ActiveParticipationInvitation invitation
)

Add a study based on an invitation which needs to be executed on this client.

This is similar to the addStudy method, but the study is created from the invitation.

Returns the newly added study.

Implementation

Future<SmartphoneStudy> addStudyFromInvitation(
    ActiveParticipationInvitation invitation) async {
  assert(deploymentService != null,
      'Deployment Service has not been configured. Call configure() first.');

  final study = SmartphoneStudy(
    studyId: invitation.studyId,
    studyDeploymentId: invitation.studyDeploymentId,
    deviceRoleName: invitation.deviceRoleName ?? Smartphone.DEFAULT_ROLE_NAME,
    participantId: invitation.participantId,
    participantRoleName: invitation.participantRoleName,
  );

  return await addStudy(study);
}