Fix bug where LoginRecord would turn nil into empty strings improperly. Fixes #623

This commit is contained in:
Thom Chiovoloni 2019-02-07 17:36:52 -08:00 коммит произвёл Thom
Родитель 3d9a5fa16e
Коммит 581deb7765
2 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -4,6 +4,17 @@
[Full Changelog](https://github.com/mozilla/application-services/compare/v0.16.0...master)
## Logins
### What's Fixed
- iOS `LoginRecord`s will no longer use empty strings for `httpRealm` and `formSubmitUrl` in cases where they claim to use nil. ([#623](https://github.com/mozilla/application-services/issues/623))
- More broadly, all optional strings in LoginRecords were were being represented as empty strings (instead of nil) unintentionally. This is fixed.
- iOS: Errors that were being accidentally swallowed should now be properly reported. ([#640](https://github.com/mozilla/application-services/issues/640))
### Breaking changes
- iOS: Code that expects empty strings (and not nil) for optional strings should be updated to check for nil instead. ([#623](https://github.com/mozilla/application-services/issues/623))
# 0.16.0 (_2019-02-06_)

Просмотреть файл

@ -121,18 +121,18 @@ open class LoginRecord {
password: dict["password"] as? String ?? "",
hostname: dict["hostname"] as? String ?? "",
username: dict["username"] as? String ?? "",
username: dict["username"] as? String,
formSubmitURL: dict["formSubmitURL"] as? String ?? "",
httpRealm: dict["httpRealm"] as? String ?? "",
formSubmitURL: dict["formSubmitURL"] as? String,
httpRealm: dict["httpRealm"] as? String,
timesUsed: (dict["timesUsed"] as? Int) ?? 0,
timeLastUsed: (dict["timeLastUsed"] as? Int64) ?? 0,
timeCreated: (dict["timeCreated"] as? Int64) ?? 0,
timePasswordChanged: (dict["timePasswordChanged"] as? Int64) ?? 0,
usernameField: dict["usernameField"] as? String ?? "",
passwordField: dict["passwordField"] as? String ?? ""
usernameField: dict["usernameField"] as? String,
passwordField: dict["passwordField"] as? String
)
}