fmasa / wfrp-master

Unofficial Android companion app for 4th edition of Warhammer Fantasy Roleplay
GNU General Public License v3.0
10 stars 3 forks source link

Trim all text field values and make TextInput API safer #250

Closed fmasa closed 4 months ago

fmasa commented 4 months ago

Closes https://github.com/fmasa/wfrp-master/issues/247

This PR unifies the way TextInput values are sanitized. Previously InputValue.value would contain raw text field value and InputValue.normalizedValue would contain normalized value (whitespaces trimmed by default). This made it error-prone, so I renamed value to rawTextFieldValue and added annotation that requires opt-in (effectively the compilation will fail on accidental use) and renamed normalizedValue to value. This means that all text fields are now automatically trimmed before saving (which was always the goal).