override fun apply()

in intellij-plugin/educational-core/src/com/jetbrains/edu/learning/agreement/UserAgreementOptions.kt [70:87]


  override fun apply() {
    super.apply()
    if (!isModified) return

    val pluginAgreementAccepted = pluginAgreementAccepted.get()
    val solutionSharingAccepted = solutionSharingAccepted.get()
    val pluginAgreementState =
      if (pluginAgreementAccepted) UserAgreementState.ACCEPTED else UserAgreementState.TERMINATED
    val aiServiceAgreementState =
      if (aiAgreementAccepted.get() && pluginAgreementAccepted) UserAgreementState.ACCEPTED else UserAgreementState.TERMINATED
    val solutionSharingPreference = if (solutionSharingAccepted && pluginAgreementAccepted)
      SolutionSharingPreference.ALWAYS else SolutionSharingPreference.NEVER

    userAgreementSettings.updatePluginAgreementState(
      UserAgreementProperties(pluginAgreementState, aiServiceAgreementState, solutionSharingPreference),
      UserAgreementModificationPlace.SETTINGS
    )
  }