EssentialGG / Vigilance

Configuration Utility using Elementa
GNU Lesser General Public License v3.0
54 stars 12 forks source link

Kotlin DSL: Add protectedText property to text method #45

Closed FluxCapacitor2 closed 2 years ago

FluxCapacitor2 commented 2 years ago

Adds a protectedText property to the Vigilant DSL's text method while retaining a method with the original signature for compatibility.

New usage:

fun text(
  field: KMutableProperty0<String>,
  name: String = field.name,
  description: String = "",
  placeholder: String = "",
  triggerActionOnInitialization: Boolean = true,
  hidden: Boolean = false,
  protectedText: Boolean = false, // new parameter added
  action: ((String) -> Unit)? = null
)

The property method remains unchanged because I have modified the makeProperty method, which doesn't have to be binary compatible.

Johni0702 commented 2 years ago

I believe the old text method would need to be deprecated with HIDDEN level. Otherwise you'll run into compilation issues when you don't specify protectedText because the compiler doesn't know which of the two overloads you're trying to call?

FluxCapacitor2 commented 2 years ago

I believe the old text method would need to be deprecated with HIDDEN level. Otherwise you'll run into compilation issues when you don't specify protectedText because the compiler doesn't know which of the two overloads you're trying to call?

Good catch, I didn't see that! Thanks