startSurvey method

void startSurvey()

Implementation

void startSurvey() async {
  bool checkValidationValue = false;
  for (int i = 0; i < _multipleTokens.length; i++) {
    userInfo(customAttributehashMap ?? {}, _multipleTokens[i]);
    await DataManager().createContactForDynamicAttribute(
      customAttributehashMap ?? {},
      _multipleTokens[i],
      true,
    );
    checkValidationValue = await checkValidation(_multipleTokens[i]);
    if (checkValidationValue) {
      _survey = Survey(_multipleTokens[i], _regionValue);
      await SessionService().syncSessionServer(_multipleTokens[i]);
      SessionService().sessionStarted();
      break;
    }
  }

  if (checkValidationValue) {
    await _getZfSurveyUrl();
    String openUrl = _url + Constant.EMBED_URL;
    if (uiType == 'popup') {
      await ZFSurveyDialog.show(
        context: _context,
        surveyUrl: openUrl,
        autoClose: _autoClose ?? true,
        fixedHeight: _fixedHeightValue ?? 100,
        expandedHeight: _expandedHeightValue ?? 100,
        crossIconPosition: _crossIconPosition ?? "left",
      );
    } else if (uiType == 'slide-up') {
      await ZfBottomSheetDialog.show(
        context: _context,
        surveyUrl: openUrl,
        autoClose: _autoClose ?? true,
        fixedHeight: _fixedHeightValue ?? 100,
        expandedHeight: _expandedHeightValue ?? 100,
        crossIconPosition: _crossIconPosition ?? "left",
      );
    }
  }
}