removeStudyDeployment method

void removeStudyDeployment(
  1. String studyDeploymentId
)

Removes all tasks for a study deployment from the queue and cancels all notifications generated for these tasks.

Implementation

void removeStudyDeployment(String studyDeploymentId) {
  // first cancel notifications for all the tasks
  _userTaskMap.values
      .where((task) =>
          task.appTaskExecutor.deployment?.studyDeploymentId ==
          studyDeploymentId)
      .forEach((userTask) => SmartPhoneClientManager()
          .notificationController
          ?.cancelNotification(userTask));

  // then remove from queue
  _userTaskMap.removeWhere((key, task) =>
      task.appTaskExecutor.deployment?.studyDeploymentId ==
      studyDeploymentId);
}