futuretap / InAppSettingsKit

This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app.
https://www.futuretap.com/blog/inappsettingskit-3-0
Other
3.18k stars 544 forks source link

v3 validation changes cause unvalidated partial fields updates to be sent to listeners #436

Closed 696GrocuttT closed 3 years ago

696GrocuttT commented 3 years ago

It looks like the changes to the way field validation is done in v3 removed the validation specific behaviour in the IASKAppSettingsViewController.textChanged() function. As a result any code listening to kIASKAppSettingChanged notifications receives unvalidated intermediate values. This can cause downstream code to crash (eg if it was expecting a string that could be parsed as an integer)

Since its valid to have intermediate values of a text field that don't pass the validation (eg an email address before the user has typed the @ symbol), there needs to be a way of preventing these change notifications being sent for intermediate values.

futuretap commented 3 years ago

This should be fixed in 3.1.4. We now skip saving intermediate values if the delegate implements the field validation callback. However, for list groups we have to save these intermediate values (albeit to a transient in-memory store) if the child pane validation callback is implemented.

696GrocuttT commented 3 years ago

Great, thanks for fixing this.

Tom